package/libselinux: fix the build with Python 3.8
authorThomas Petazzoni <thomas.petazzoni@bootlin.com>
Fri, 25 Oct 2019 13:27:31 +0000 (15:27 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sat, 26 Oct 2019 10:36:54 +0000 (12:36 +0200)
commit3fce6f1c150dbe4be58d083008ca8dbe7257836e
treef4a79899fa4eef3e109a58f524b63505bcbaa03e
parentccd08dc6f5cd552b5083b376a7ebbbf77de8421b
package/libselinux: fix the build with Python 3.8

Following the switch to Python 3.8, the libselinux Python extension
started to fail building. This is fixed by upstream commit
2efa06857575e4118e91ca250b6b92da68b130d5, which we backport as
0003-libselinux-Use-Python-distutils-to-install-SELinux-p.patch.

This patch has the nice merit of switching to using distutils to build
the Python extension of libselinux, instead of some custom logic. This
allows to significantly simplify our libselinux.mk: we can rely on
PKG_PYTHON_DISTUTILS_ENV and HOST_PKG_PYTHON_DISTUTILS_ENV instead of
lots of custom variables.

However, upstream commit 2efa06857575e4118e91ca250b6b92da68b130d5 had
its own issues:

 * Hardcode of -I $(DESTDIR)/$(INCLUDEDIR) -L $(DESTDIR)/$(LIBDIR) at
   build time, while DESTDIR is normally empty at build time, causing
   bogus -I /usr/include -L /usr/lib to be used

   This is fixed in
   0004-src-Makefile-don-t-pass-bogus-I-and-L-to-python-setu.patch

 * New usage of ln --relative, which is not supported in older
   distributions.

   This is fixed in
   0005-Remove-ln-relative-usage-in-install-pywrap.patch

 * Usage of the host Python "imp" module to query the extension used
   for native Python module, but that returns an incorrect result when
   cross-compiling. We chose to simplify the code to not have to query
   for this information.

   This is fixed in
   0006-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch

With this patch, the libselinux Python module was built-tested with
Python 2 and Python 3, and run-time tested as well in both
configurations, for both the target and host variants of libselinux.

Fixes:

  http://autobuild.buildroot.net/results/aeb58de7ad674b980258e6ed30c7da3949a04452/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/libselinux/0003-libselinux-Use-Python-distutils-to-install-SELinux-p.patch [new file with mode: 0644]
package/libselinux/0004-src-Makefile-don-t-pass-bogus-I-and-L-to-python-setu.patch [new file with mode: 0644]
package/libselinux/0005-Remove-ln-relative-usage-in-install-pywrap.patch [new file with mode: 0644]
package/libselinux/0006-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch [new file with mode: 0644]
package/libselinux/libselinux.mk