summaryrefslogtreecommitdiffstats
path: root/tools/depends/native/python3
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /tools/depends/native/python3
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/depends/native/python3')
-rw-r--r--tools/depends/native/python3/01-distutil-flags.patch12
-rw-r--r--tools/depends/native/python3/Makefile46
-rw-r--r--tools/depends/native/python3/PYTHON3-VERSION4
3 files changed, 62 insertions, 0 deletions
diff --git a/tools/depends/native/python3/01-distutil-flags.patch b/tools/depends/native/python3/01-distutil-flags.patch
new file mode 100644
index 0000000..28cd2f9
--- /dev/null
+++ b/tools/depends/native/python3/01-distutil-flags.patch
@@ -0,0 +1,12 @@
+--- a/Lib/distutils/sysconfig.py
++++ b/Lib/distutils/sysconfig.py
+@@ -214,6 +214,9 @@
+ (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
+ get_config_vars('CC', 'CXX', 'CFLAGS',
+ 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
++ # get_config_vars returns host vars. clear cflags, ldshared for crosscompile use
++ cflags = ""
++ ldshared = cc + " -shared"
+
+ if 'CC' in os.environ:
+ newcc = os.environ['CC']
diff --git a/tools/depends/native/python3/Makefile b/tools/depends/native/python3/Makefile
new file mode 100644
index 0000000..74ebe06
--- /dev/null
+++ b/tools/depends/native/python3/Makefile
@@ -0,0 +1,46 @@
+include ../../Makefile.include PYTHON3-VERSION ../../download-files.include
+PLATFORM=$(NATIVEPLATFORM)
+DEPS = ../../Makefile.include Makefile PYTHON3-VERSION ../../download-files.include \
+ 01-distutil-flags.patch
+
+CONFIGURE=./configure --prefix=$(NATIVEPREFIX) \
+ --disable-shared \
+ --disable-framework \
+ --without-pymalloc \
+ --with-system-ffi
+
+NATIVE_SITEPACKAGES=$(NATIVEPREFIX)/lib/python$(PYTHON_VERSION)/site-packages
+
+ifeq ($(OS),linux)
+ CONFIGURE += --with-system-expat
+endif
+
+LIBDYLIB=$(PLATFORM)/python
+ifeq ($(NATIVE_OS), osx)
+ # Case insensitive FS will add .exe to buildexe regardless of --with-suffix=no
+ LIBDYLIB=$(PLATFORM)/python.exe
+endif
+
+all: .installed-$(PLATFORM)
+
+$(PLATFORM): $(DEPS) | $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE)
+ rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+ cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+ cd $(PLATFORM); $(MAKE)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+ cd $(PLATFORM); patch -p1 -i ../01-distutil-flags.patch
+ cd $(PLATFORM); $(MAKE) install
+# Sed patch setuptools that is installed via ensurepip as we cant patch the source
+ cd $(NATIVE_SITEPACKAGES); sed -ie "s|cflags = cflags + ' ' + os.environ\['CFLAGS'\]|cflags = os.environ\['CFLAGS'\]|" setuptools/_distutils/sysconfig.py
+ touch $(LIBDYLIB)
+ touch $@
+
+clean:
+ rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
+distclean::
+ rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/python3/PYTHON3-VERSION b/tools/depends/native/python3/PYTHON3-VERSION
new file mode 100644
index 0000000..290e333
--- /dev/null
+++ b/tools/depends/native/python3/PYTHON3-VERSION
@@ -0,0 +1,4 @@
+LIBNAME=Python
+VERSION=3.11.2
+ARCHIVE=$(LIBNAME)-$(VERSION).tar.xz
+SHA512=5684ec7eae2dce26facc54d448ccdb6901bbfa1cab03abbe8fd34e4268a2b701daa13df15903349492447035be78380d473389e8703b4e910a65b088d2462e8b