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