Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] dissociate python optional test wheels builds + python313 #6282

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b85599e
python311: Remove optional wheels (to be migrated to its own spk)
th0ma7 Oct 14, 2024
2fd5d21
python313: Initial commit, fails to build on readline
th0ma7 Oct 14, 2024
76f4774
python-wheels: First attempt, to be further developed
th0ma7 Oct 14, 2024
96c6e9d
py311: Re-enable lto
th0ma7 Oct 14, 2024
330bc50
python313: First working build
th0ma7 Oct 14, 2024
adbb8bd
python313: Remove pgo optimizations as non-functional in cross-builds
th0ma7 Oct 15, 2024
2318d4d
python-wheels: First integration of additional wheels for testing
th0ma7 Oct 15, 2024
c358ff7
mariadb-connector-c: Update from version 3.3.5 to 3.3.11 and fix buil…
th0ma7 Oct 15, 2024
f848cb2
python313: No longer support armv5 arch due to c++11 support needed
th0ma7 Oct 16, 2024
3a7e454
spksrc.crossenv.mk: First iteration of on-demand crossenv creation
th0ma7 Oct 30, 2024
6bc5b8a
spksrc.crossenv.mk: Print crossenv resulting package list
th0ma7 Oct 30, 2024
7975ca6
py310-311-313: Remove crossenv creation
th0ma7 Nov 2, 2024
aa40c41
mk/crossenv: Remove aiohttp example as obsolete
th0ma7 Nov 2, 2024
dbb2820
mk/crossenv: disable meson and scikit-build-core temporarily
th0ma7 Nov 2, 2024
3cf00e5
spksrc.crossenv.mk: Misc fixes
th0ma7 Nov 2, 2024
6f65dca
python-module.mk: Make compatible with spksrc.crossenv.mk
th0ma7 Nov 2, 2024
ba8d9bd
wheel.mk: Make compatible with spksrc.crossenv.mk
th0ma7 Nov 2, 2024
78ed01a
crossenv.mk: Allow building from PYTHON_PACKAGE dependend spk
th0ma7 Nov 4, 2024
decf8dc
py310-311: Fix lto vs pgo optimizations
th0ma7 Nov 5, 2024
6ef9309
borgbackup: Package bump to force build
th0ma7 Nov 5, 2024
34d793a
wheel.mk: Use $name-$version using - instead of == for crossenv
th0ma7 Nov 5, 2024
e831c42
python.mk: do not symlink crossenv and python-cc.mk
th0ma7 Nov 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions cross/mariadb-connector-c/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKG_NAME = mariadb-connector-c
PKG_VERS = 3.3.5
PKG_VERS = 3.3.11
PKG_EXT = tar.gz
PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT)
PKG_DIST_FILE = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
Expand All @@ -10,8 +10,7 @@ HOMEPAGE = https://mariadb.com/kb/en/mariadb-connector-c/
COMMENT = MariaDB C Connector
LICENSE = LGPL

#USE_NATIVE_CMAKE_LEGACY = 1
#CMAKE_USE_TOOLCHAIN_FILE = OFF
CMAKE_USE_TOOLCHAIN_FILE = OFF
CMAKE_DISABLE_EXE_LINKER_FLAGS = 1

include ../../mk/spksrc.cross-cmake.mk
Expand Down
6 changes: 3 additions & 3 deletions cross/mariadb-connector-c/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mariadb-connector-c-3.3.5.tar.gz SHA1 29ad65e81a87e41a93e8984f2c3d1662dcec7c1c
mariadb-connector-c-3.3.5.tar.gz SHA256 c0fda1fa6e52dc85de27156cd847088a72d40d9de6514f7efa57c8d93134a54c
mariadb-connector-c-3.3.5.tar.gz MD5 b8967cf63d4fc5660f230762c0e39ee2
mariadb-connector-c-3.3.11.tar.gz SHA1 2fa1fe042bcc65297d6d22196685701faf3e96d1
mariadb-connector-c-3.3.11.tar.gz SHA256 6ecada1f3fc32ad95efcd2c982b319191f5e6479f3f521bc4b714e6158f5e415
mariadb-connector-c-3.3.11.tar.gz MD5 700afe8ebff69bdf66b3c37747d1d527
84 changes: 7 additions & 77 deletions cross/python310/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,20 @@ CONFIGURE_ARGS += --without-ensurepip
CONFIGURE_ARGS += --enable-loadable-sqlite-extensions
CONFIGURE_ARGS += --with-computed-gotos=yes
CONFIGURE_ARGS += --with-build-python
CONFIGURE_ARGS += --disable-test-modules

include ../../mk/spksrc.archs.mk

# optionally generate optimized code
ifeq ($(strip $(PYTHON_OPTIMIZE)),1)
CONFIGURE_ARGS += --enable-optimizations
# old compilers fail with unrecognized command line options: -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none
ifneq ($(findstring $(ARCH),$(OLD_PPC_ARCHS)),$(ARCH))
# Some tests (like test_base64) must find libpython shared library at runtime.
# python: error while loading shared libraries: libpython3.10.so.1.0: cannot open shared object file: No such file or directory
ENV += LD_LIBRARY_PATH=$(WORK_DIR)/$(PKG_DIR)
#
# Enable Link-Time Optimization
CONFIGURE_ARGS += --with-lto
endif
else
# test modules are required for optimization only
CONFIGURE_ARGS += --disable-test-modules
#
# pgo optimization can only be run native platform and now
# exit on errors which had no impact (and effects) previously.
# https://github.com/python/cpython/pull/111950
#CONFIGURE_ARGS += --enable-optimizations
endif

# older gcc does not know -Wno-unused-result
Expand Down Expand Up @@ -86,21 +83,11 @@ POST_PATCH_TARGET = python310_post_patch
PRE_CONFIGURE_TARGET = python310_pre_configure
COMPILE_TARGET = python310_compile
INSTALL_TARGET = python310_install
POST_INSTALL_TARGET = python310_post_install

include ../../mk/spksrc.cross-cc.mk

HOST_ARCH = $(shell uname -m)
BUILD_ARCH = $(shell expr "$(TC_TARGET)" : '\([^-]*\)' )
PYTHON_NATIVE = $(WORK_DIR)/../../../native/$(PKG_NAME)/work-native/install/usr/local/bin/python3
PIP_NATIVE = $(WORK_DIR)/../../../native/$(PKG_NAME)/work-native/install/usr/local/bin/pip
HOSTPYTHON = $(WORK_DIR)/$(PKG_DIR)/hostpython
HOSTPYTHON_LIB_NATIVE = $(WORK_DIR)/../../../native/$(PKG_NAME)/work-native/$(PKG_DIR)/build/lib.linux-$(HOST_ARCH)-$(PKG_VERS_MAJOR_MINOR)
PYTHON_LIB_NATIVE = $(WORK_DIR)/$(PKG_DIR)/build/lib.linux-$(HOST_ARCH)-$(PKG_VERS_MAJOR_MINOR)
PYTHON_SITE_PACKAGES_NATIVE = $(WORK_DIR)/../../../native/$(PKG_NAME)/work-native/install/usr/local/lib/python$(PKG_VERS_MAJOR_MINOR)/site-packages
PYTHON_LIB_CROSS = $(WORK_DIR)/$(PKG_DIR)/build/lib.linux-$(BUILD_ARCH)-$(PKG_VERS_MAJOR_MINOR)
PYTHON_LIB_DIR = lib/python$(PKG_VERS_MAJOR_MINOR)
PYTHON_INC_DIR = include/python$(PKG_VERS_MAJOR_MINOR)

# Required so that the python3 binaries and libraries generated by native compilation
# take precedence over current environment python3 when generating
Expand Down Expand Up @@ -134,60 +121,3 @@ python310_install:
@install -m 755 -d $(STAGING_INSTALL_PREFIX)/etc
@install -m 644 src/mime.types $(STAGING_INSTALL_PREFIX)/etc/
$(RUN) _PYTHON_HOST_PLATFORM=$(TC_TARGET) $(MAKE) install prefix=$(STAGING_INSTALL_PREFIX)

# default wheels to install in crossenv
CROSSENV_WHEELS = cffi==1.17.0
#
# Cython version >= 3.x breaks PyYAML wheel
# https://github.com/yaml/pyyaml/issues/601
#
# It also breaks numpy at crossenv creation time using github-action
# https://numpy.org/devdocs/reference/distutils_status_migration.html
# Python 3.12 considerations: scikit-build-core, meson-python
CROSSENV_WHEELS += Cython==3.0.2
#CROSSENV_WHEELS += Cython==0.29.37
CROSSENV_WHEELS += flit==3.9.0
CROSSENV_WHEELS += scikit-build==0.18.1
CROSSENV_WHEELS += setuptools-rust==1.10.2
CROSSENV_WHEELS += setuptools-scm==8.1.0
# For future use when building numpy >= 1.26
#CROSSENV_WHEELS += meson-python==1.5.2
#CROSSENV_WHEELS += scikit-build-core==0.10.7
ifneq ($(findstring $(ARCH),$(OLD_PPC_ARCHS)),$(ARCH))
CROSSENV_WHEELS += cryptography==43.0.1
CROSSENV_WHEELS += maturin==1.7.4
CROSSENV_WHEELS += poetry==1.8.3
endif

# Create the crossenv in preparation for
# cross-compiling all the necessary wheels
.PHONY: python310_post_install
python310_post_install: $(WORK_DIR)/python-cc.mk
mkdir -p $(PYTHON_LIB_CROSS)
cp -R $(HOSTPYTHON_LIB_NATIVE) $(PYTHON_LIB_CROSS)/../
@$(RUN) $(PYTHON_NATIVE) -m crossenv $(STAGING_INSTALL_PREFIX)/bin/python$(PKG_VERS_MAJOR_MINOR) --cc $(TC_PATH)$(TC_PREFIX)gcc --cxx $(TC_PATH)$(TC_PREFIX)c++ --ar $(TC_PATH)$(TC_PREFIX)ar --sysroot $(TC_SYSROOT) --env LIBRARY_PATH= --manylinux manylinux2014 $(WORK_DIR)/crossenv/
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) wget --no-verbose https://bootstrap.pypa.io/get-pip.py
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-python get-pip.py "pip==24.2" --no-setuptools --no-wheel --disable-pip-version-check
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) python get-pip.py "pip==24.2" --no-setuptools --no-wheel --disable-pip-version-check
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip --disable-pip-version-check install "setuptools==75.1.0" "wheel==0.44.0" "pip-tools==7.4.1"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) pip --disable-pip-version-check install "setuptools==75.1.0" "wheel==0.44.0" "pip-tools==7.4.1"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip --disable-pip-version-check install $(CROSSENV_WHEELS)
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) pip --disable-pip-version-check install $(CROSSENV_WHEELS)
ifneq ($(PYTHON_LIB_NATIVE),$(PYTHON_LIB_CROSS))
cp $(PYTHON_LIB_CROSS)/_sysconfigdata_*.py $(PYTHON_LIB_NATIVE)/_sysconfigdata.py
endif

$(WORK_DIR)/python-cc.mk:
@echo HOSTPYTHON=$(HOSTPYTHON) > $@
@echo CROSSENV=$(WORK_DIR)/crossenv/bin/activate >> $@
@echo HOSTPYTHON_LIB_NATIVE=$(HOSTPYTHON_LIB_NATIVE) >> $@
@echo PYTHON_LIB_NATIVE=$(PYTHON_LIB_NATIVE) >> $@
@echo PYTHON_SITE_PACKAGES_NATIVE=$(PYTHON_SITE_PACKAGES_NATIVE) >> $@
@echo PYTHON_INTERPRETER=$(INSTALL_PREFIX)/bin/python$(PKG_VERS_MAJOR_MINOR) >> $@
@echo PYTHON_VERSION=$(PKG_VERS_MAJOR_MINOR) >> $@
@echo PYTHON_LIB_CROSS=$(PYTHON_LIB_CROSS) >> $@
@echo PYTHON_LIB_DIR=$(PYTHON_LIB_DIR) >> $@
@echo PYTHON_INC_DIR=$(PYTHON_INC_DIR) >> $@
@echo PIP=$(PIP_NATIVE) >> $@
@echo CROSS_COMPILE_WHEELS=1 >> $@
@echo ADDITIONAL_WHEEL_BUILD_ARGS=--no-build-isolation >> $@
82 changes: 7 additions & 75 deletions cross/python311/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ CONFIGURE_ARGS += --without-ensurepip
CONFIGURE_ARGS += --enable-loadable-sqlite-extensions
CONFIGURE_ARGS += --with-computed-gotos=yes
CONFIGURE_ARGS += --with-build-python
CONFIGURE_ARGS += --disable-test-modules

include ../../mk/spksrc.archs.mk

# optionally generate optimized code
ifeq ($(strip $(PYTHON_OPTIMIZE)),1)
CONFIGURE_ARGS += --enable-optimizations
# Some tests (like test_base64) must find libpython shared library at runtime.
# python: error while loading shared libraries: libpython3.11.so.1.0: cannot open shared object file: No such file or directory
ENV += LD_LIBRARY_PATH=$(WORK_DIR)/$(PKG_DIR)
#
# Enable Link-Time Optimization
CONFIGURE_ARGS += --with-lto
else
# test modules are required for optimization only
CONFIGURE_ARGS += --disable-test-modules
#
# pgo optimization can only be run native platform and now
# exit on errors which had no impact (and effects) previously.
# https://github.com/python/cpython/pull/111950
#CONFIGURE_ARGS += --enable-optimizations
endif

CONFIGURE_ARGS += ac_cv_buggy_getaddrinfo=no
Expand Down Expand Up @@ -83,21 +83,11 @@ POST_PATCH_TARGET = python311_post_patch
PRE_CONFIGURE_TARGET = python311_pre_configure
COMPILE_TARGET = python311_compile
INSTALL_TARGET = python311_install
POST_INSTALL_TARGET = python311_post_install

include ../../mk/spksrc.cross-cc.mk

HOST_ARCH = $(shell uname -m)
BUILD_ARCH = $(shell expr "$(TC_TARGET)" : '\([^-]*\)' )
PYTHON_NATIVE = $(WORK_DIR)/../../../native/$(PKG_NAME)/work-native/install/usr/local/bin/python3
PIP_NATIVE = $(WORK_DIR)/../../../native/$(PKG_NAME)/work-native/install/usr/local/bin/pip
HOSTPYTHON = $(WORK_DIR)/$(PKG_DIR)/hostpython
HOSTPYTHON_LIB_NATIVE = $(WORK_DIR)/../../../native/$(PKG_NAME)/work-native/$(PKG_DIR)/build/lib.linux-$(HOST_ARCH)-$(PKG_VERS_MAJOR_MINOR)
PYTHON_LIB_NATIVE = $(WORK_DIR)/$(PKG_DIR)/build/lib.linux-$(HOST_ARCH)-$(PKG_VERS_MAJOR_MINOR)
PYTHON_SITE_PACKAGES_NATIVE = $(WORK_DIR)/../../../native/$(PKG_NAME)/work-native/install/usr/local/lib/python$(PKG_VERS_MAJOR_MINOR)/site-packages
PYTHON_LIB_CROSS = $(WORK_DIR)/$(PKG_DIR)/build/lib.linux-$(BUILD_ARCH)-$(PKG_VERS_MAJOR_MINOR)
PYTHON_LIB_DIR = lib/python$(PKG_VERS_MAJOR_MINOR)
PYTHON_INC_DIR = include/python$(PKG_VERS_MAJOR_MINOR)

# Required so that the python3 binaries and libraries generated by native compilation
# take precedence over current environment python3 when generating
Expand Down Expand Up @@ -131,61 +121,3 @@ python311_install:
@install -m 755 -d $(STAGING_INSTALL_PREFIX)/etc
@install -m 644 src/mime.types $(STAGING_INSTALL_PREFIX)/etc/
$(RUN) _PYTHON_HOST_PLATFORM=$(TC_TARGET) $(MAKE) install prefix=$(STAGING_INSTALL_PREFIX)

# default wheels to install in crossenv
CROSSENV_WHEELS = cffi==1.17.1
CROSSENV_WHEELS += cryptography==43.0.1
#
# Cython version >= 3.x breaks PyYAML wheel
# https://github.com/yaml/pyyaml/issues/601
#
# It also breaks numpy at crossenv creation time using github-action
# https://numpy.org/devdocs/reference/distutils_status_migration.html
# Python 3.12 considerations: scikit-build-core, meson-python
#CROSSENV_WHEELS += Cython==3.0.2
CROSSENV_WHEELS += Cython==0.29.37
CROSSENV_WHEELS += flit==3.9.0
CROSSENV_WHEELS += maturin==1.7.4
CROSSENV_WHEELS += poetry==1.8.3
CROSSENV_WHEELS += scikit-build==0.18.1
CROSSENV_WHEELS += setuptools-rust==1.10.2
CROSSENV_WHEELS += setuptools-scm==8.1.0
# For future use when building numpy >= 1.26
#CROSSENV_WHEELS += meson-python==1.5.2
#CROSSENV_WHEELS += scikit-build-core==0.10.7
# For pydantic_core==2.23.0: (typing-extensions >=4.6.0,!=4.7.0)
CROSSENV_WHEELS += typing_extensions==4.12.2


# Create the crossenv in preparation for
# cross-compiling all the necessary wheels
.PHONY: python311_post_install
python311_post_install: $(WORK_DIR)/python-cc.mk
mkdir -p $(PYTHON_LIB_CROSS)
cp -R $(HOSTPYTHON_LIB_NATIVE) $(PYTHON_LIB_CROSS)/../
@$(RUN) $(PYTHON_NATIVE) -m crossenv $(STAGING_INSTALL_PREFIX)/bin/python$(PKG_VERS_MAJOR_MINOR) --cc $(TC_PATH)$(TC_PREFIX)gcc --cxx $(TC_PATH)$(TC_PREFIX)c++ --ar $(TC_PATH)$(TC_PREFIX)ar --sysroot $(TC_SYSROOT) --env LIBRARY_PATH= --manylinux manylinux2014 $(WORK_DIR)/crossenv/
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) wget --no-verbose https://bootstrap.pypa.io/get-pip.py
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-python get-pip.py "pip==24.2" --no-setuptools --no-wheel --disable-pip-version-check
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) python get-pip.py "pip==24.2" --no-setuptools --no-wheel --disable-pip-version-check
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip --disable-pip-version-check install "setuptools==68.1.2" "wheel==0.44.0" "pip-tools==7.4.1"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) pip --disable-pip-version-check install "setuptools==68.1.2" "wheel==0.44.0" "pip-tools==7.4.1"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip --disable-pip-version-check install $(CROSSENV_WHEELS)
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) pip --disable-pip-version-check install $(CROSSENV_WHEELS)
ifneq ($(PYTHON_LIB_NATIVE),$(PYTHON_LIB_CROSS))
cp $(PYTHON_LIB_CROSS)/_sysconfigdata_*.py $(PYTHON_LIB_NATIVE)/_sysconfigdata.py
endif

$(WORK_DIR)/python-cc.mk:
@echo HOSTPYTHON=$(HOSTPYTHON) > $@
@echo CROSSENV=$(WORK_DIR)/crossenv/bin/activate >> $@
@echo HOSTPYTHON_LIB_NATIVE=$(HOSTPYTHON_LIB_NATIVE) >> $@
@echo PYTHON_LIB_NATIVE=$(PYTHON_LIB_NATIVE) >> $@
@echo PYTHON_SITE_PACKAGES_NATIVE=$(PYTHON_SITE_PACKAGES_NATIVE) >> $@
@echo PYTHON_INTERPRETER=$(INSTALL_PREFIX)/bin/python$(PKG_VERS_MAJOR_MINOR) >> $@
@echo PYTHON_VERSION=$(PKG_VERS_MAJOR_MINOR) >> $@
@echo PYTHON_LIB_CROSS=$(PYTHON_LIB_CROSS) >> $@
@echo PYTHON_LIB_DIR=$(PYTHON_LIB_DIR) >> $@
@echo PYTHON_INC_DIR=$(PYTHON_INC_DIR) >> $@
@echo PIP=$(PIP_NATIVE) >> $@
@echo CROSS_COMPILE_WHEELS=1 >> $@
@echo ADDITIONAL_WHEEL_BUILD_ARGS=--no-build-isolation >> $@
123 changes: 123 additions & 0 deletions cross/python313/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
PKG_NAME = python313
PKG_VERS = 3.13.0
PKG_VERS_MAJOR_MINOR = $(word 1,$(subst ., ,$(PKG_VERS))).$(word 2,$(subst ., ,$(PKG_VERS)))
PKG_EXT = tar.xz
PKG_DIST_NAME = Python-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://www.python.org/ftp/python/$(PKG_VERS)
PKG_DIR = Python-$(PKG_VERS)

# Platform "powerpc-none-linux-gnuspe" with compiler "gcc" is not supported by the
# CPython core team, see https://peps.python.org/pep-0011/ for more information.
# And compiler must support std=c++11 (OlD_PPC_ARCHS fail, but ARMv5_ARCHS have no issue).
UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS)

BUILD_DEPENDS = native/$(PKG_NAME)
th0ma7 marked this conversation as resolved.
Show resolved Hide resolved

DEPENDS = cross/zlib cross/sqlite cross/readline cross/ncursesw cross/bzip2 cross/xz
# required for Sleepycat^WOracle Berkeley DB interface
DEPENDS += cross/berkeleydb
# required for uuid module
DEPENDS += cross/libuuid

HOMEPAGE = https://www.python.org/
COMMENT = Python Programming Language
LICENSE = PSF

GNU_CONFIGURE = 1

CONFIGURE_ARGS = --enable-shared
CONFIGURE_ARGS += --without-static-libpython
CONFIGURE_ARGS += --enable-ipv6
# installed pip is not on PATH
CONFIGURE_ARGS += --without-ensurepip
CONFIGURE_ARGS += --enable-loadable-sqlite-extensions
CONFIGURE_ARGS += --with-computed-gotos=yes
CONFIGURE_ARGS += --with-build-python
CONFIGURE_ARGS += --with-readline=readline
CONFIGURE_ARGS += --disable-test-modules

include ../../mk/spksrc.archs.mk

# optionally generate optimized code
ifeq ($(strip $(PYTHON_OPTIMIZE)),1)
#
# Enable Link-Time Optimization
CONFIGURE_ARGS += --with-lto
#
# pgo optimization can only be run native platform and now
# exit on errors which had no impact (and effects) previously.
# https://github.com/python/cpython/pull/111950
#CONFIGURE_ARGS += --enable-optimizations
endif

CONFIGURE_ARGS += ac_cv_buggy_getaddrinfo=no
CONFIGURE_ARGS += ac_cv_file__dev_ptmx=no
CONFIGURE_ARGS += ac_cv_file__dev_ptc=no
CONFIGURE_ARGS += ac_cv_have_long_long_format=yes

DEPENDS += cross/openssl3
CONFIGURE_ARGS += --with-ssl-default-suites=openssl

DEPENDS += cross/gdbm
CONFIGURE_ARGS += --with-dbmliborder=gdbm:ndbm:bdb

DEPENDS += cross/libexpat
CONFIGURE_ARGS += --with-system-expat

# libffi is no longer bundled with python
DEPENDS += cross/libffi

# Mandatory PYO3_* variables for rust cross-compiling
ENV += PYO3_CROSS_LIB_DIR=$(STAGING_INSTALL_PREFIX)/lib/
ENV += PYO3_CROSS_INCLUDE_DIR=$(STAGING_INSTALL_PREFIX)/include/
# Mandatory of using OPENSSL_*_DIR starting with
# cryptography version >= 40
# https://docs.rs/openssl/latest/openssl/#automatic
ENV += OPENSSL_LIB_DIR=$(STAGING_INSTALL_PREFIX)/lib/
ENV += OPENSSL_INCLUDE_DIR=$(STAGING_INSTALL_PREFIX)/include/


ADDITIONAL_CFLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -L $(STAGING_INSTALL_PREFIX)/lib -I $(STAGING_INSTALL_PREFIX)/include

POST_PATCH_TARGET = python313_post_patch
PRE_CONFIGURE_TARGET = python313_pre_configure
COMPILE_TARGET = python313_compile
INSTALL_TARGET = python313_install

include ../../mk/spksrc.cross-cc.mk

PYTHON_NATIVE = $(WORK_DIR)/../../../native/$(PKG_NAME)/work-native/install/usr/local/bin/python3
HOSTPYTHON = $(WORK_DIR)/$(PKG_DIR)/hostpython

# Required so that the python3 binaries and libraries generated by native compilation
# take precedence over current environment python3 when generating
# target architecture resources
PATH := $(WORK_DIR)/../../../native/$(PKG_NAME)/work-native/install/usr/local/bin:$(PATH)
LD_LIBRARY_PATH := $(WORK_DIR)/../../../native/$(PKG_NAME)/work-native/install/usr/local/lib:$(LD_LIBRARY_PATH)
export PATH LD_LIBRARY_PATH

.PHONY: python313_post_patch
python313_post_patch:
$(RUN) sed -e 's#@INSTALL_PREFIX@#$(INSTALL_PREFIX)#' -i Lib/mimetypes.py

.PHONY: python313_pre_configure
python313_pre_configure:
cp $(PYTHON_NATIVE) $(HOSTPYTHON)
$(RUN) autoreconf -ivf -Werror
# create phantom header and library to succeed add_dir_to_list in setup.py
# so that future-promised libsqlite3.so and sqlite3.h will be used. Yep,
# it's a bit hokey, but avoids editing upstream pristine source
mkdir -p $(STAGING_INSTALL_PREFIX)/lib $(STAGING_INSTALL_PREFIX)/include
mkdir -p $(WORK_DIR)/Python-$(PKG_VERS)/Include $(WORK_DIR)/Python-$(PKG_VERS)/lib
test -h $(WORK_DIR)/Python-$(PKG_VERS)/Include/sqlite3.h || ln -fs $(STAGING_INSTALL_PREFIX)/include/sqlite3.h $(WORK_DIR)/Python-$(PKG_VERS)/Include/sqlite3.h
test -h $(WORK_DIR)/Python-$(PKG_VERS)/lib/libsqlite3.so || ln -fs $(STAGING_INSTALL_PREFIX)/lib/libsqlite3.so $(WORK_DIR)/Python-$(PKG_VERS)/lib/

.PHONY: python313_compile
python313_compile:
$(RUN) _PYTHON_HOST_PLATFORM=$(TC_TARGET) $(MAKE) -j $(NCPUS)

.PHONY: python313_install
python313_install:
@install -m 755 -d $(STAGING_INSTALL_PREFIX)/etc
@install -m 644 src/mime.types $(STAGING_INSTALL_PREFIX)/etc/
$(RUN) _PYTHON_HOST_PLATFORM=$(TC_TARGET) $(MAKE) install prefix=$(STAGING_INSTALL_PREFIX)
14 changes: 14 additions & 0 deletions cross/python313/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
lnk:bin/idle3
rsc:bin/idle3.13
lnk:bin/pydoc3
rsc:bin/pydoc3.13
lnk:bin/python3
bin:bin/python3.13
rsc:bin/python3.13-config
lnk:bin/python3-config
rsc:etc/mime.types
rsc:include/python3.13/pyconfig.h
lnk:lib/libpython3.13.so
lib:lib/libpython3.13.so.1.0
lib:lib/libpython3.so
rsc:lib/python3.13
3 changes: 3 additions & 0 deletions cross/python313/digests
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Python-3.13.0.tar.xz SHA1 0f71dce4a3251460985a944bbd1d1b7db1660a91
Python-3.13.0.tar.xz SHA256 086de5882e3cb310d4dca48457522e2e48018ecd43da9cdf827f6a0759efb07d
Python-3.13.0.tar.xz MD5 726e5b829fcf352326874c1ae599abaa
Loading
Loading