Source: libseccomp
Version: 2.3.3-3
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

libseccomp fails to cross build from source. It cross builds fine with
the nopython build profile, but without it doesn't.

The starting issue is Build-Depends. Rather than depending on
python-all-dev, you need to split it into libpython-all-dev,
python-all-dev:any (and python 3 likewise). That still leaves cython. We
want to run cython, so we likely need the build architecture cython, but
Build-Depends request host architecture by default. It is not clear to
me whether cython needs to be marked Multi-Arch: foreign, so the
attached patch simply annotates it :native for the time being. That
makes Build-Depends cross satisfiable.

I noticed that the dh_auto_build --sourcedirectory=src/python
invocations do nothing as make treats them as incremental builds. Thus
the attached patch discards them.

Now telling Python to perform cross builds is difficult. Matthias Klose
spent long hours with upstream to find a solution and now we have two,
neither of which is pretty. For python2, you prepend a certain directory
to PYTHONPATH. For python3, you set up _PYTHON_SYSCONFIGDATA_NAME.
Neither of these is particularly obvious, but I don't have any working
alternative to offer. I note that the pybuild debhelper buildsystem
takes care of _PYTHON_SYSCONFIGDATA_NAME.

The attached patch implements all of that and makes libseccomp cross
build the python extensions. Please consider applying it.

Helmut
diff --minimal -Nru libseccomp-2.3.3/debian/changelog 
libseccomp-2.3.3/debian/changelog
--- libseccomp-2.3.3/debian/changelog   2018-07-01 20:32:03.000000000 +0200
+++ libseccomp-2.3.3/debian/changelog   2018-07-11 11:00:01.000000000 +0200
@@ -1,3 +1,15 @@
+libseccomp (2.3.3-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Multiarchify python Build-Depends.
+    + Annotate cython dependencies with :native for now.
+    + Drop noop dh_auto_build invocations.
+    + Pass a suitable PYTHONPATH for python2.
+    + Pass _PYTHON_SYSCONFIGDATA_NAME for python3.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Wed, 11 Jul 2018 11:00:01 +0200
+
 libseccomp (2.3.3-3) unstable; urgency=medium
 
   * Fix FTBFS: Adapt to renamed README file. (Closes: #902767)
diff --minimal -Nru libseccomp-2.3.3/debian/control 
libseccomp-2.3.3/debian/control
--- libseccomp-2.3.3/debian/control     2018-05-09 22:04:08.000000000 +0200
+++ libseccomp-2.3.3/debian/control     2018-07-11 11:00:01.000000000 +0200
@@ -6,10 +6,12 @@
 Build-Depends: debhelper (>= 10~),
                linux-libc-dev,
                dh-python <!nopython>,
-               python-all-dev <!nopython>,
-               python3-all-dev <!nopython>,
-               cython <!nopython>,
-               cython3 <!nopython>
+               python-all-dev:any <!nopython>,
+               libpython-all-dev <!nopython>,
+               python3-all-dev:any <!nopython>,
+               libpython3-all-dev <!nopython>,
+               cython:native <!nopython>,
+               cython3:native <!nopython>
 Standards-Version: 3.9.7
 Homepage: https://github.com/seccomp/libseccomp
 Vcs-Git: https://salsa.debian.org/debian/libseccomp.git
diff --minimal -Nru libseccomp-2.3.3/debian/rules libseccomp-2.3.3/debian/rules
--- libseccomp-2.3.3/debian/rules       2018-04-30 20:29:48.000000000 +0200
+++ libseccomp-2.3.3/debian/rules       2018-07-11 11:00:01.000000000 +0200
@@ -7,6 +7,8 @@
 # Enable verbose build details.
 export V=1
 
+include /usr/share/dpkg/architecture.mk
+
 %:
 ifeq ($(filter nopython,$(DEB_BUILD_PROFILES)),)
        dh $@ --with python2,python3
@@ -19,15 +21,12 @@
        dh_auto_configure -- --enable-python
 
 override_dh_auto_build:
-       dh_auto_build
-       set -e && for pyver in `py3versions -s`; do \
-               dh_auto_build --sourcedirectory=src/python -- PYTHON=$$pyver; \
-       done
+       
PYTHONPATH="/usr/lib/python2.7/plat-${DEB_HOST_GNU_TYPE}$${PYTHONPATH:+:$$PYTHONPATH}"
 dh_auto_build
 
 override_dh_auto_install:
        dh_auto_install
        set -e && for pyver in `py3versions -s`; do \
-               dh_auto_install --sourcedirectory=src/python -- PYTHON=$$pyver; 
\
+               
_PYTHON_SYSCONFIGDATA_NAME='_sysconfigdata_m_${DEB_HOST_ARCH_OS}_${DEB_HOST_MULTIARCH}'
 dh_auto_install --sourcedirectory=src/python -- PYTHON=$$pyver; \
        done
 endif
 

Reply via email to