diff options
author | fuzzard <fuzzard@kodi.tv> | 2021-10-09 15:08:38 +1000 |
---|---|---|
committer | fuzzard <fuzzard@kodi.tv> | 2021-10-18 15:28:55 +1000 |
commit | b4ad968d77027901418151be1ebe5ab61a24859d (patch) | |
tree | 9e17df8898ab6f5087ef9d9cd342beb86c30d021 /tools | |
parent | 4d442e17c7a75584bde16e6f99120a924ce69199 (diff) |
[tools/depends] utilise Makefile.include vars for python
Create a single version variable for python to remove hardcoded version numbers in
multiple dependencies
Do the same for the target site-packages folder
Diffstat (limited to 'tools')
-rw-r--r-- | tools/depends/Makefile.include.in | 4 | ||||
-rw-r--r-- | tools/depends/target/python3/Makefile | 6 | ||||
-rw-r--r-- | tools/depends/target/pythonmodule-pil/Makefile | 6 | ||||
-rw-r--r-- | tools/depends/target/pythonmodule-pycryptodome/Makefile | 10 | ||||
-rw-r--r-- | tools/depends/target/pythonmodule-setuptools/Makefile | 10 |
5 files changed, 20 insertions, 16 deletions
diff --git a/tools/depends/Makefile.include.in b/tools/depends/Makefile.include.in index 38888ce6a6..5930ac3958 100644 --- a/tools/depends/Makefile.include.in +++ b/tools/depends/Makefile.include.in @@ -102,6 +102,10 @@ NATIVE_CXXFLAGS=@host_includes@ -I@prefix@/@tool_dir@/include VERSION.TXT := $(CMAKE_SOURCE_DIR)/version.txt APP_NAME=$(shell awk '/APP_NAME/ {print tolower($$2)}' $(VERSION.TXT)) +# Python related vars +PYTHON_VERSION=3.8 +PYTHON_SITE_PKG=@prefix@/@deps_dir@/lib/python${PYTHON_VERSION}/site-packages + ifeq ($(CPU), arm64) export GASPP_FIX_XCODE5=1 endif diff --git a/tools/depends/target/python3/Makefile b/tools/depends/target/python3/Makefile index 9a908e41be..f724f581a6 100644 --- a/tools/depends/target/python3/Makefile +++ b/tools/depends/target/python3/Makefile @@ -34,7 +34,7 @@ CONFIGURE=./configure --prefix=$(PREFIX) \ $(EXTRA_CONFIGURE) -LIBDYLIB=$(PLATFORM)/libpython3.8.a +LIBDYLIB=$(PLATFORM)/libpython$(PYTHON_VERSION).a all: .installed-$(PLATFORM) @@ -69,12 +69,12 @@ endif cd $(PLATFORM); $(CONFIGURE) $(LIBDYLIB): $(PLATFORM) - $(MAKE) -C $(PLATFORM) $(HOSTPLATFORM) PYTHON_FOR_BUILD=$(NATIVEPREFIX)/bin/python3 CROSS_COMPILE_TARGET=yes libpython3.8.a + $(MAKE) -C $(PLATFORM) $(HOSTPLATFORM) PYTHON_FOR_BUILD=$(NATIVEPREFIX)/bin/python3 CROSS_COMPILE_TARGET=yes libpython$(PYTHON_VERSION).a touch $@ .installed-$(PLATFORM): $(LIBDYLIB) $(MAKE) -C $(PLATFORM) $(HOSTPLATFORM) PYTHON_FOR_BUILD=$(NATIVEPREFIX)/bin/python3 CROSS_COMPILE_TARGET=yes install - find $(PREFIX)/lib/python3.8 -type f -name "*.pyc" -delete + find $(PREFIX)/lib/python$(PYTHON_VERSION) -type f -name "*.pyc" -delete touch $(LIBDYLIB) touch $@ diff --git a/tools/depends/target/pythonmodule-pil/Makefile b/tools/depends/target/pythonmodule-pil/Makefile index 37aab820b3..feabc7a791 100644 --- a/tools/depends/target/pythonmodule-pil/Makefile +++ b/tools/depends/target/pythonmodule-pil/Makefile @@ -7,7 +7,7 @@ VERSION=7.1.2 SOURCE=$(LIBNAME)-$(VERSION) ARCHIVE=$(SOURCE).tar.gz -PYTHONPATH=$(PREFIX)/lib/python3.8/site-packages/ +PYTHONPATH=$(PYTHON_SITE_PKG) PILPATH=$(PYTHONPATH) LDSHARED=$(CC) -shared @@ -21,12 +21,12 @@ endif ifeq ($(OS),android) PILPATH=$(PREFIX)/share/$(APP_NAME)/addons/script.module.pil PILPATHLIB=$(PILPATH)/lib -PYTHONPATH=$(PILPATH):$(PREFIX)/lib/python3.8/site-packages/ +PYTHONPATH=$(PILPATH):$(PYTHON_SITE_PKG) EXTRALDFLAGS=-L$(PREFIX)/lib/dummy-lib$(APP_NAME)/ -l$(APP_NAME) -lm else ifeq ($(OS),darwin_embedded) PILPATH=$(PREFIX)/share/$(APP_NAME)/addons/script.module.pil PILPATHLIB=$(PILPATH)/lib -PYTHONPATH=$(PILPATH):$(PREFIX)/lib/python3.8/site-packages/ +PYTHONPATH=$(PILPATH):$(PYTHON_SITE_PKG) endif ifeq (darwin, $(findstring darwin, $(HOST))) diff --git a/tools/depends/target/pythonmodule-pycryptodome/Makefile b/tools/depends/target/pythonmodule-pycryptodome/Makefile index afd123da0e..d77fbb5d77 100644 --- a/tools/depends/target/pythonmodule-pycryptodome/Makefile +++ b/tools/depends/target/pythonmodule-pycryptodome/Makefile @@ -7,9 +7,9 @@ VERSION=3.4.3 SOURCE=$(LIBNAME)-$(VERSION) ARCHIVE=$(SOURCE).tar.gz -CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS)" PYTHONPATH="$(PREFIX)/lib/python3.8/site-packages/" +CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS)" PYTHONPATH="$(PYTHON_SITE_PKG)" ifeq ($(OS),android) -CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS) -L$(PREFIX)/lib/dummy-lib$(APP_NAME)/ -l$(APP_NAME) -lm" PYTHONPATH="$(PREFIX)/lib/python3.8/site-packages/" +CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS) -L$(PREFIX)/lib/dummy-lib$(APP_NAME)/ -l$(APP_NAME) -lm" PYTHONPATH="$(PYTHON_SITE_PKG)" endif ifeq (darwin, $(findstring darwin, $(HOST))) @@ -18,12 +18,12 @@ PYTHON_O=$(abs_top_srcdir)/target/python3/$(PLATFORM)/Programs/python.o endif #ensure that only our target ldflags are passed to the python build LDSHARED:=$(CC) -bundle -undefined dynamic_lookup $(LDFLAGS) -CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" CCSHARED="$(CC) $(CFLAGS) $(PYTHON_O)" LDFLAGS="$(LDFLAGS)" PYTHONPATH="$(PREFIX)/lib/python3.8/site-packages/" LDSHARED="$(LDSHARED)" +CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" CCSHARED="$(CC) $(CFLAGS) $(PYTHON_O)" LDFLAGS="$(LDFLAGS)" PYTHONPATH="$(PYTHON_SITE_PKG)" LDSHARED="$(LDSHARED)" endif -LIBDYLIB=$(PLATFORM)/build/lib.$(OS)-$(CPU)-3.8/Cryptodome +LIBDYLIB=$(PLATFORM)/build/lib.$(OS)-$(CPU)-$(PYTHON_VERSION)/Cryptodome ifeq ($(NATIVE_OS), osx) - LIBDYLIB=$(PLATFORM)/build/lib.macosx-10.4-x86_64-3.8/Cryptodome + LIBDYLIB=$(PLATFORM)/build/lib.macosx-10.4-x86_64-$(PYTHON_VERSION)/Cryptodome endif all: .installed-$(PLATFORM) diff --git a/tools/depends/target/pythonmodule-setuptools/Makefile b/tools/depends/target/pythonmodule-setuptools/Makefile index ba4a26ae7b..a954a78280 100644 --- a/tools/depends/target/pythonmodule-setuptools/Makefile +++ b/tools/depends/target/pythonmodule-setuptools/Makefile @@ -7,20 +7,20 @@ VERSION=18.4 SOURCE=$(LIBNAME)-$(VERSION) ARCHIVE=$(SOURCE).tar.gz -CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS)" PYTHONPATH="$(PREFIX)/lib/python3.8/site-packages/" +CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS)" PYTHONPATH="$(PYTHON_SITE_PKG)" ifeq ($(OS),android) #PYTHONPATH=$(PREFIX)/share/$(APP_NAME)/addons/script.module.pil -CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS) -L$(PREFIX)/lib/dummy-lib$(APP_NAME)/ -l$(APP_NAME) -lm" PYTHONPATH="$(PREFIX)/lib/python3.8/site-packages/" +CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS) -L$(PREFIX)/lib/dummy-lib$(APP_NAME)/ -l$(APP_NAME) -lm" PYTHONPATH="$(PYTHON_SITE_PKG)" endif ifeq ($(OS),osx) -CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS) -lpython" PYTHONPATH="$(PREFIX)/lib/python3.8/site-packages/" +CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS) -lpython" PYTHONPATH="$(PYTHON_SITE_PKG)" endif ifeq ($(OS),darwin_embedded) PYTHON_O=$(abs_top_srcdir)/target/python3/$(PLATFORM)/Programs/python.o -CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" CCSHARED="$(CC) $(CFLAGS) $(PYTHON_O)" LDFLAGS="$(LDFLAGS)" PYTHONPATH="$(PREFIX)/lib/python3.8/site-packages/" +CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" CCSHARED="$(CC) $(CFLAGS) $(PYTHON_O)" LDFLAGS="$(LDFLAGS)" PYTHONPATH="$(PYTHON_SITE_PKG)" endif -LIBDYLIB=$(PLATFORM)/dist/$(LIBNAME)-$(VERSION)-py3.8.egg +LIBDYLIB=$(PLATFORM)/dist/$(LIBNAME)-$(VERSION)-py$(PYTHON_VERSION).egg all: .installed-$(PLATFORM) |