Subject: [alpine-aports] [PATCH] main/libcap-ng: fix cross-compiling without python pre-installed

From: alpine-mips-patches <[email-masked]>
Date: Thu, 21 Dec 2018 07:02:38 +0000

This aport have no intention to package python bindings so:
 - tell ./configure explicitly there is no 'swig';
 - tell ./configure explicitly neither python nor python3 is needed
   (this effectively avoids fatal AM_PATH_PYTHON invocation);
 - replace makedepends= with empty makedepends_build= for symmetry
   with makedepends_host=.

Rationale follows.

If neither python nor python3 is pre-installed in the build system,
cross-compilation fails:

checking for swig... no
configure: WARNING: "Swig not found - python bindings will not be made"
checking whether to create python bindings... testing
checking for python... no
checking for python2... no
checking for python3... no
checking for python3.5... no
checking for python3.4... no
checking for python3.3... no
checking for python3.2... no
checking for python3.1... no
checking for python3.0... no
checking for python2.7... no
checking for python2.6... no
checking for python2.5... no
checking for python2.4... no
checking for python2.3... no
checking for python2.2... no
checking for python2.1... no
checking for python2.0... no
configure: error: no suitable Python interpreter found
>>> ERROR: libcap-ng: build failed

This error is printed by AM_PATH_PYTHON at ./configure.ac:125 which
assumes lack of python is fatal when invoked without the third arg.

Also note the swig warning.

After replacing 'makedepends="python3 $depends_dev"' at APKBUILD:10
with 'makedepends_build="python3"', cross-configure succeeds saying
python is of no use anyway:

checking whether to create python bindings... testing
checking for python... no
checking for python2... no
checking for python3... /usr/bin/python3
checking for python version... 3.6
checking for python platform... linux
checking for python script directory... ${prefix}/lib/python3.6/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python3.6/site-packages
configure: WARNING: "Python headers not found - python bindings will not be made"
checking whether to create python3 bindings... investigating
checking for python3-config... no
sh: yes: unknown operand
Python3 bindings will NOT be built
---
 main/libcap-ng/APKBUILD | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/main/libcap-ng/APKBUILD b/main/libcap-ng/APKBUILD
index 69444c9248..857f971bf8 100644
--- a/main/libcap-ng/APKBUILD
+++ b/main/libcap-ng/APKBUILD
@@ -1,13 +1,13 @@
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=libcap-ng
 pkgver=0.7.9
-pkgrel=0
+pkgrel=1
 pkgdesc="POSIX capabilities library"
 url="http://people.redhat.com/sgrubb/libcap-ng/index.html"
 arch="all"
 license="GPL-2.0-or-later LGPL-2.1-or-later"
 depends_dev="linux-headers"
-makedepends="python3 $depends_dev"
+makedepends_build=""
 makedepends_host="$depends_dev"
 subpackages="$pkgname-dev $pkgname-doc $pkgname-utils"
 source="https://people.redhat.com/sgrubb/libcap-ng/libcap-ng-$pkgver.tar.gz
@@ -17,13 +17,16 @@ builddir="$srcdir/$pkgname-$pkgver"
 
 build() {
 	cd "$builddir"
+	ac_cv_prog_swig_found=no \
 	./configure \
 		--build=$CBUILD \
 		--host=$CHOST \
 		--prefix=/usr \
 		--sysconfdir=/etc \
 		--mandir=/usr/share/man \
-		--infodir=/usr/share/info
+		--infodir=/usr/share/info \
+		--without-python \
+		--without-python3
 	make
 }
 
-- 
2.20.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---