1From c26495025ab1a2597e5433b67a3bf793d3ce1e08 Mon Sep 17 00:00:00 2001
2From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
3Date: Fri, 25 Oct 2019 13:37:14 +0200
4Subject: [PATCH] Do not use PYCEXT, and rely on the installed file name
5
6PYCEXT is computed by asking the Python intrepreter what is the
7file extension used for native Python modules.
8
9Unfortunately, when cross-compiling, the host Python doesn't give the
10proper result: it gives the result matching the build machine, and not
11the target machine. Due to this, the symlink has an incorrect name,
12and doesn't point to the .so file that was actually built/installed.
13
14To address this and keep things simple, this patch just changes the ln
15invocation to rely on the name of the _selinux*.so Python module that
16was installed.
17
18Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
19[Refreshed for 3.1]
20Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
21[Refreshed for 3.0]
22Signed-off-by: Adam Duskett <Aduskett@gmail.com>
23---
24 src/Makefile | 3 +--
25 1 file changed, 1 insertion(+), 2 deletions(-)
26
27diff --git a/src/Makefile b/src/Makefile
28index 190016e2af34..7ee22fd35da3 100644
29--- a/src/Makefile
30+++ b/src/Makefile
31@@ -15,7 +15,6 @@ INCLUDEDIR ?= $(PREFIX)/include
32 PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
33 PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX))
34 PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(plat_specific=1, prefix='$(PREFIX)'))")
35-PYCEXT ?= $(shell $(PYTHON) -c 'import importlib.machinery;print(importlib.machinery.EXTENSION_SUFFIXES[0])')
36 RUBYINC ?= $(shell $(RUBY) -e 'puts "-I" + RbConfig::CONFIG["rubyarchhdrdir"] + " -I" + RbConfig::CONFIG["rubyhdrdir"]')
37 RUBYLIBS ?= $(shell $(RUBY) -e 'puts "-L" + RbConfig::CONFIG["libdir"] + " -L" + RbConfig::CONFIG["archlibdir"] + " " + RbConfig::CONFIG["LIBRUBYARG_SHARED"]')
38 RUBYINSTALL ?= $(shell $(RUBY) -e 'puts RbConfig::CONFIG["vendorarchdir"]')
39@@ -184,7 +183,7 @@ install: all
40 install-pywrap: pywrap
41 	$(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTHON_SETUP_ARGS)
42 	install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py
43-	ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT)
44+	ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux*.so $(DESTDIR)$(PYTHONLIBDIR)/
45
46 install-rubywrap: rubywrap
47 	test -d $(DESTDIR)$(RUBYINSTALL) || install -m 755 -d $(DESTDIR)$(RUBYINSTALL)
48--
492.26.2
50
51