kumquat-buildroot/package/libselinux/0004-src-Makefile-don-t-pass-bogus-I-and-L-to-python-setu.patch
Thomas Petazzoni 3fce6f1c15 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>
2019-10-26 12:36:54 +02:00

35 lines
1.3 KiB
Diff

From 4b1568bce5bbdc7bf76a4bbf1066ba7e7b84649f Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Fri, 25 Oct 2019 11:45:04 +0200
Subject: [PATCH] src/Makefile: don't pass bogus -I and -L to python setup.py
build_ext
Using $(DESTDIR) during the build does not follow the normal/standard
semantic of DESTDIR: it is normally only needed during the
installation. Therefore, a lot of build systems/environments don't
pass any DESTDIR at build time, which causes setup.py to be called
with -I /usr/include -L /usr/lib, which breaks cross-compilation.
[Upstream: https://github.com/SELinuxProject/selinux/pull/183]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
src/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Makefile b/src/Makefile
index 2b1696a0..3b8bad81 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -130,7 +130,7 @@ SWIGRUBY = swig -Wall -ruby -o $(SWIGRUBYCOUT) -outdir ./ $(DISABLE_FLAGS)
all: $(LIBA) $(LIBSO) $(LIBPC)
pywrap: all selinuxswig_python_exception.i
- CFLAGS="$(CFLAGS) $(SWIG_CFLAGS)" $(PYTHON) setup.py build_ext -I $(DESTDIR)$(INCLUDEDIR) -L $(DESTDIR)$(LIBDIR)
+ CFLAGS="$(CFLAGS) $(SWIG_CFLAGS)" $(PYTHON) setup.py build_ext
rubywrap: all $(SWIGRUBYSO)
--
2.21.0