45 lines
1.7 KiB
Diff
45 lines
1.7 KiB
Diff
diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile
|
|
index 7acf63d..cdd8388 100644
|
|
--- a/libsemanage/src/Makefile
|
|
+++ b/libsemanage/src/Makefile
|
|
@@ -1,9 +1,15 @@
|
|
+# Support building the Python bindings multiple times, against various Python
|
|
+# runtimes (e.g. Python 2 vs Python 3) by optionally prefixing the build
|
|
+# targets with "PYPREFIX":
|
|
+PYTHON ?= python
|
|
+PYPREFIX ?=
|
|
+
|
|
# Installation directories.
|
|
PREFIX ?= $(DESTDIR)/usr
|
|
LIBDIR ?= $(PREFIX)/lib
|
|
SHLIBDIR ?= $(PREFIX)/lib
|
|
INCLUDEDIR ?= $(PREFIX)/include
|
|
-PYLIBVER ?= $(shell python -c 'import sys;print "python%d.%d" % sys.version_info[0:2]')
|
|
+PYLIBVER ?= $(shell $(PYTHON) -c 'import sys;print("python%d.%d" % sys.version_info[0:2])')
|
|
PYINC ?= /usr/include/${PYLIBVER}
|
|
PYLIBDIR ?= $(LIBDIR)/${PYLIBVER}
|
|
RUBYLIBVER ?= $(shell ruby -e 'print RUBY_VERSION.split(".")[0..1].join(".")')
|
|
@@ -34,9 +40,9 @@ SWIGIF= semanageswig_python.i
|
|
SWIGRUBYIF= semanageswig_ruby.i
|
|
SWIGCOUT= semanageswig_wrap.c
|
|
SWIGRUBYCOUT= semanageswig_ruby_wrap.c
|
|
-SWIGLOBJ:= $(patsubst %.c,%.lo,$(SWIGCOUT))
|
|
+SWIGLOBJ:= $(patsubst %.c,$(PYPREFIX)%.lo,$(SWIGCOUT))
|
|
SWIGRUBYLOBJ:= $(patsubst %.c,%.lo,$(SWIGRUBYCOUT))
|
|
-SWIGSO=_semanage.so
|
|
+SWIGSO=$(PYPREFIX)_semanage.so
|
|
SWIGFILES=$(SWIGSO) semanage.py
|
|
SWIGRUBYSO=_rubysemanage.so
|
|
LIBSO=$(TARGET).$(LIBVERSION)
|
|
@@ -132,7 +138,9 @@ install: all
|
|
|
|
install-pywrap: pywrap
|
|
test -d $(PYLIBDIR)/site-packages || install -m 755 -d $(PYLIBDIR)/site-packages
|
|
- install -m 755 $(SWIGFILES) $(PYLIBDIR)/site-packages
|
|
+ install -m 755 $(SWIGSO) $(PYLIBDIR)/site-packages/_semanage.so
|
|
+ install -m 755 semanage.py $(PYLIBDIR)/site-packages
|
|
+
|
|
|
|
install-rubywrap: rubywrap
|
|
test -d $(RUBYINSTALL) || install -m 755 -d $(RUBYINSTALL)
|