2
1

0002-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch 2.5 KB

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