Skip to content

Commit

Permalink
python311: bring back builds for ARMv5_ARCHS and OLD_PPC_ARCHS
Browse files Browse the repository at this point in the history
- enable build of python311 for ARMv5 and OLD_PPC
- enable build of cross/cryptography for ARMv5
- bring back python311 customization for OLD_PPC_ARCHS
- adjust patches for python311 and older toolchains
  • Loading branch information
hgy59 committed Mar 2, 2024
1 parent 47aa408 commit fdbff29
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 38 deletions.
4 changes: 0 additions & 4 deletions cross/cryptography/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ HOMEPAGE = https://github.com/pyca/cryptography
COMMENT = Provide cryptographic recipes and primitives to Python developers
LICENSE = BSD/ASL2

# Unsupported due to lack of libatomic
# being mandatory with OpenSSL >= 3.x
UNSUPPORTED_ARCHS = $(ARMv5_ARCHS)

###
### This cross/cryptography is needed to generate python-limited abi3 wheels
### Ref: https://github.com/pyca/cryptography/issues/7671
Expand Down
20 changes: 10 additions & 10 deletions cross/python311/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ 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.
UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS)
# Missing libatomic for proper openssl >= 3.x support
# Ref: https://github.com/SynoCommunity/spksrc/issues/5841
# https://github.com/SynoCommunity/spksrc/pull/5820#issuecomment-1678221438
UNSUPPORTED_ARCHS += $(ARMv5_ARCHS)

BUILD_DEPENDS = native/$(PKG_NAME)

DEPENDS = cross/zlib cross/sqlite cross/readline cross/ncursesw cross/bzip2 cross/xz
Expand All @@ -39,16 +31,24 @@ CONFIGURE_ARGS += --with-build-python

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

# optionally generate optimized code
# optionally generate optimized code (optimizaton is always disabled for OLD_PPC_ARCHS)
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
endif

ifeq ($(findstring $(ARCH),$(OLD_PPC_ARCHS)),$(ARCH))
# older gcc does not know -Wno-unused-result
CONFIGURE_ARGS += ac_cv_disable_unused_result_warning=no
endif

CONFIGURE_ARGS += ac_cv_buggy_getaddrinfo=no
CONFIGURE_ARGS += ac_cv_file__dev_ptmx=no
CONFIGURE_ARGS += ac_cv_file__dev_ptc=no
Expand Down Expand Up @@ -166,7 +166,7 @@ endif
endif

# [maturin]
ifneq ($(findstring $(ARCH),$(ARMv5_ARCHS)),$(ARCH))
ifneq ($(findstring $(ARCH),$(ARMv5_ARCHS) $(OLD_PPC_ARCHS)),$(ARCH))
CROSSENV_WHEELS += maturin==1.2.3
endif

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# remove lto optimization flags unknown by ARMv5 gcc
# remove flags unknown by gcc 4.6.4 of ARMv5 toolchain
# - remove -ffat-lto-objects

# - replace -std=c11 by -std=c99
#
--- configure.ac.orig 2022-06-06 11:53:30.000000000 +0000
+++ configure.ac 2022-06-19 15:36:23.019811638 +0000
@@ -1872,7 +1872,7 @@ if test "$Py_LTO" = 'true' ; then
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
--- Include/pymacro.h-orig 2023-06-06 22:00:27.000000000 +0000
+++ Include/pymacro.h 2023-07-03 19:36:57.974496974 +0000
@@ -3,23 +3,20 @@

// gh-91782: On FreeBSD 12, if the _POSIX_C_SOURCE and _XOPEN_SOURCE macros are
// defined, <sys/cdefs.h> disables C11 support and <assert.h> does not define
-// the static_assert() macro.
+// the static_assert() macro. Define the static_assert() macro in Python until
+// <sys/cdefs.h> suports C11:
// https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255290
-//
-// macOS <= 10.10 doesn't define static_assert in assert.h at all despite
-// having C11 compiler support.
-//
-// static_assert is defined in glibc from version 2.16. Compiler support for
-// the C11 _Static_assert keyword is in gcc >= 4.6.
-//
-// MSVC makes static_assert a keyword in C11-17, contrary to the standards.
-//
-// In C++11 and C2x, static_assert is a keyword, redefining is undefined
-// behaviour. So only define if building as C (if __STDC_VERSION__ is defined),
-// not C++, and only for C11-17.
-#if !defined(static_assert) && (defined(__GNUC__) || defined(__clang__)) \
- && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
- && __STDC_VERSION__ <= 201710L
+#if defined(__FreeBSD__) && !defined(static_assert)
+# define static_assert _Static_assert
+#endif
+
+// static_assert is defined in glibc from version 2.16. Before it requires
+// compiler support (gcc >= 4.6) and is called _Static_assert.
+// In C++ 11 static_assert is a keyword, redefining is undefined behaviour.
+#if (defined(__GLIBC__) \
+ && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 16)) \
+ && !(defined(__cplusplus) && __cplusplus >= 201103L) \
+ && !defined(static_assert))
# define static_assert _Static_assert
#endif

Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
# remove lto optimization flags unknown by older gcc
# - remove -fuse-linker-plugin
# remove flags unknown by gcc 4.3.2 (lto optimization is disabled at all for ppc853x arch)
# - remove -fprofile-correction

--- configure.ac.orig 2022-06-06 11:53:30.000000000 +0000
+++ configure.ac 2022-06-19 15:36:23.019811638 +0000
@@ -1427,7 +1427,7 @@
LTOCFLAGS="-flto"
;;
*)
- LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
+ LTOFLAGS="-flto -ffat-lto-objects -flto-partition=none"
;;
esac
;;
@@ -1506,7 +1506,7 @@
# - replace -std=c11 by -std=c99
#
--- configure.ac.orig 2023-08-24 12:09:18.000000000 +0000
+++ configure.ac 2024-03-02 20:17:15.812508858 +0000
@@ -1989,7 +1989,7 @@
;;
*)
PGO_PROF_GEN_FLAG="-fprofile-generate"
Expand All @@ -22,3 +13,12 @@
LLVM_PROF_MERGER="true"
LLVM_PROF_FILE=""
;;
@@ -2195,7 +2195,7 @@
# tweak BASECFLAGS based on compiler and platform
case $GCC in
yes)
- CFLAGS_NODIST="$CFLAGS_NODIST -std=c11"
+ CFLAGS_NODIST="$CFLAGS_NODIST -std=c99"

PY_CHECK_CC_WARNING([enable], [extra], [if we can add -Wextra])
AS_VAR_IF([ac_cv_enable_extra_warning], [yes],
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# remove lto optimization flags unknown by older gcc
# - remove -fuse-linker-plugin

#
--- configure.ac.orig 2022-06-06 11:53:30.000000000 +0000
+++ configure.ac 2022-06-19 15:36:23.019811638 +0000
@@ -1427,7 +1427,7 @@
Expand Down
6 changes: 0 additions & 6 deletions spk/python311/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ SPK_VERS_MAJOR_MINOR = $(word 1,$(subst ., ,$(SPK_VERS))).$(word 2,$(subst ., ,$
SPK_REV = 8
SPK_ICON = src/python3.png

UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS)
# Missing libatomic for proper openssl >= 3.x support
# Ref: https://github.com/SynoCommunity/spksrc/issues/5841
# https://github.com/SynoCommunity/spksrc/pull/5820#issuecomment-1678221438
UNSUPPORTED_ARCHS += $(ARMv5_ARCHS)

DEPENDS = cross/$(SPK_NAME)
DEPENDS += cross/pip

Expand Down

0 comments on commit fdbff29

Please sign in to comment.