Skip to content

Commit

Permalink
OpenSSL 3 for armv5 (#6025)
Browse files Browse the repository at this point in the history
* openssl3: fix for ARMv5 and OLD_PPC_ARCHS
- enable openssl3 for toolchains lacking libatomic
- fixes build of openssl 3.x with threads enabled but without libatomic

* python311: bring back builds for ARMv5_ARCHS and OLD_PPC_ARCHS
- 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

* use different patch for ppc853x to avoid undefined static_assert

* cleanup:
- disable python311 for OLD_PPC_ARCHS
- avoid wget progress logging for pip download

* try to recreate packages for ARMv5
- beets
- borgbackup
- mercurial
- octoprint
- rdiff-backup

* fix kiwix: avoid the use of a specific mirror to download source of cross/libmicrohttpd
  • Loading branch information
hgy59 authored Mar 9, 2024
1 parent 0fda56d commit 8a45a25
Show file tree
Hide file tree
Showing 18 changed files with 111 additions and 54 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
2 changes: 1 addition & 1 deletion cross/libmicrohttpd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PKG_NAME = libmicrohttpd
PKG_VERS = 0.9.75
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://mirror.kumi.systems/gnu/libmicrohttpd
PKG_DIST_SITE = https://ftp.gnu.org/gnu/libmicrohttpd
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

DEPENDS =
Expand Down
13 changes: 8 additions & 5 deletions cross/openssl3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ endif
ifeq ($(findstring $(ARCH),$(ARMv5_ARCHS)),$(ARCH))
OPENSSL_PLATFORM = linux-armv4
CONFIGURE_ARGS += -march=armv5
# threads need libatomic that is missing in ARMv5 toolchain
CONFIGURE_ARGS += no-threads
endif
ifeq ($(findstring $(ARCH),$(ARMv7_ARCHS) $(ARMv7L_ARCHS)),$(ARCH))
OPENSSL_PLATFORM = linux-armv4
Expand All @@ -52,10 +50,15 @@ endif
ifeq ($(findstring $(ARCH),$(PPC_ARCHS)),$(ARCH))
OPENSSL_PLATFORM = linux-ppc
CONFIGURE_ARGS += no-asm
ifeq ($(findstring $(ARCH),$(OLD_PPC_ARCHS)),$(ARCH))
# threads need libatomic that is missing in OLD_PPC_ARCHS toolchains
CONFIGURE_ARGS += no-threads
endif

ifeq ($(findstring $(ARCH),$(OLD_PPC_ARCHS) $(ARMv5_ARCHS)),$(ARCH))
# threads need libatomic that is missing in ARMv5_ARCHS and OLD_PPC_ARCHS toolchains
#CONFIGURE_ARGS += no-threads
# BUT the following packages require OpenSSL with threads support (OPENSSL_THREADS)
# - python311 #error "OPENSSL_THREADS is not defined, Python requires thread-safe OpenSSL"
# - stunnel #error OpenSSL library compiled without thread support
# A first approach is to avoid the need of libatomic (see patches/*/001-avoid-the-use-of-libatomic.patch)
endif

ifeq ($(strip $(OPENSSL_PLATFORM)),)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# avoid linking with libatomic for ARMv5_ARCHS and OLD_PPC_ARCHS
#
--- Configurations/10-main.conf.orig 2024-01-30 13:22:11.000000000 +0000
+++ Configurations/10-main.conf 2024-03-02 14:04:09.586401205 +0000
@@ -712,7 +712,7 @@
},

"linux-ppc" => {
- inherit_from => [ "linux-latomic" ],
+ inherit_from => [ "linux-generic32" ],
asm_arch => 'ppc32',
perlasm_scheme => "linux32",
lib_cppflags => add("-DB_ENDIAN"),
@@ -767,7 +767,7 @@
#
# ./Configure linux-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8
#
- inherit_from => [ "linux-latomic" ],
+ inherit_from => [ "linux-generic32" ],
asm_arch => 'armv4',
perlasm_scheme => "linux32",
},
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# avoid linking with libatomic for ARMv5_ARCHS and OLD_PPC_ARCHS
#
--- Configurations/10-main.conf.orig 2024-01-30 13:22:11.000000000 +0000
+++ Configurations/10-main.conf 2024-03-02 14:04:09.586401205 +0000
@@ -712,7 +712,7 @@
},

"linux-ppc" => {
- inherit_from => [ "linux-latomic" ],
+ inherit_from => [ "linux-generic32" ],
asm_arch => 'ppc32',
perlasm_scheme => "linux32",
lib_cppflags => add("-DB_ENDIAN"),
@@ -767,7 +767,7 @@
#
# ./Configure linux-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8
#
- inherit_from => [ "linux-latomic" ],
+ inherit_from => [ "linux-generic32" ],
asm_arch => 'armv4',
perlasm_scheme => "linux32",
},
2 changes: 1 addition & 1 deletion cross/python310/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ 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 https://bootstrap.pypa.io/get-pip.py
. $(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==23.2.1" --no-setuptools --no-wheel --disable-pip-version-check
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) python get-pip.py "pip==23.2.1" --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.41.2"
Expand Down
16 changes: 7 additions & 9 deletions cross/python311/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ 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)
# 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)

Expand All @@ -32,7 +29,7 @@ CONFIGURE_ARGS = --enable-shared
CONFIGURE_ARGS += --without-static-libpython
CONFIGURE_ARGS += --enable-ipv6
# installed pip is not on PATH
CONFIGURE_ARGS += --with-ensurepip=no
CONFIGURE_ARGS += --without-ensurepip
CONFIGURE_ARGS += --enable-loadable-sqlite-extensions
CONFIGURE_ARGS += --with-computed-gotos=yes
CONFIGURE_ARGS += --with-build-python
Expand All @@ -42,6 +39,9 @@ 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
Expand Down Expand Up @@ -149,7 +149,7 @@ CROSSENV_WHEELS += poetry==1.6.1
CROSSENV_WHEELS += scikit-build==0.17.6
CROSSENV_WHEELS += setuptools-rust==1.7.0
CROSSENV_WHEELS += setuptools-scm==7.1.0
# For future usages when building numpy >= 1.26
# For future use when building numpy >= 1.26
#CROSSENV_WHEELS += meson-python==0.13.2
#CROSSENV_WHEELS += scikit-build-core==0.5.0

Expand All @@ -166,9 +166,7 @@ endif
endif

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

# Create the crossenv in preparation for
# cross-compiling all the necessary wheels
Expand All @@ -177,7 +175,7 @@ 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 https://bootstrap.pypa.io/get-pip.py
. $(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==23.2.1" --no-setuptools --no-wheel --disable-pip-version-check
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) python get-pip.py "pip==23.2.1" --no-setuptools --no-wheel --disable-pip-version-check
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip --disable-pip-version-check install "setuptools==63.4.3" "wheel==0.41.2"
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,16 @@
# gcc 4.3.2 is lacking static_assert for c code (available for c++ code only).
#
# Since static_assert acts at compile time only, it does not affect the runtime
# behaviour when omitting the implementation.
#
--- Include/pymacro.h.orig 2023-08-24 12:09:18.000000000 +0000
+++ Include/pymacro.h 2024-03-02 18:15:00.033365138 +0000
@@ -21,6 +21,8 @@
&& defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
&& __STDC_VERSION__ <= 201710L
# define static_assert _Static_assert
+#else
+# define static_assert
#endif

/* Minimum value between x and y */
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
2 changes: 1 addition & 1 deletion native/python310/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ PIP_NATIVE = $(WORK_DIR)/../../../native/$(PKG_NAME)/work-native/install/usr/loc
.PHONY: python310_native_post_install
python310_native_post_install: $(WORK_DIR)/python-native.mk
@$(MSG) Installing pip
@$(RUN) wget https://bootstrap.pypa.io/get-pip.py
@$(RUN) wget --no-verbose https://bootstrap.pypa.io/get-pip.py
@$(RUN) $(PYTHON) get-pip.py "pip==23.2.1" --no-setuptools --no-wheel --disable-pip-version-check
@$(MSG) Installing setuptools, wheel, cffi and cross env
@$(PIP) --disable-pip-version-check install "setuptools==68.1.2" "setuptools-rust==1.7.0" "maturin==1.2.3" "wheel==0.41.2" "cffi==1.15.1" "crossenv==1.4.0"
Expand Down
4 changes: 2 additions & 2 deletions spk/beets/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SPK_ICON = src/beets.png

PYTHON_PACKAGE = python311
SPK_DEPENDS = "python311>=3.11.5-8"
UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS) $(ARMv5_ARCHS)
UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS)

WHEELS = src/requirements-crossenv.txt src/requirements-pure.txt

Expand All @@ -29,7 +29,7 @@ MAINTAINER = ymartin59
DESCRIPTION = "Beets is the media library management system for obsessive-compulsive music geeks. The purpose of beets is to get your music collection right once and for all. It catalogs your collection, automatically improving its metadata as it goes. It then provides a bouquet of tools for manipulating and accessing your music. Plugins not available due to lacking dependencies: AcousticBrainz Submit, Gmusic, ReplayGain."
DISPLAY_NAME = beets

CHANGELOG = "1. Migrate to python 3.11<br/>2. Update to all wheels<br/>3. Mark ARMv5 as unsupported"
CHANGELOG = "1. Migrate to python 3.11.<br/>2. Update to all wheels."

HOMEPAGE = http://beets.io/
LICENSE = GPL
Expand Down
6 changes: 3 additions & 3 deletions spk/borgbackup/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
SPK_NAME = borgbackup
SPK_VERS = 1.2.6
SPK_REV = 14
SPK_ICON = src/$(SPK_NAME).png
SPK_ICON = src/borgbackup.png

PYTHON_PACKAGE = python311
SPK_DEPENDS = "python311>=3.11.5-8"
UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS) $(ARMv5_ARCHS)
UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS)

DEPENDS = cross/attr cross/acl cross/openssl3 cross/lz4 cross/zstd cross/libb2 cross/fuse

Expand All @@ -30,7 +30,7 @@ DESCRIPTION = Deduplicating backup program with compression and authenticated en

DISPLAY_NAME = Borg
STARTABLE = no
CHANGELOG = "1. Update borg to v1.2.6<br/>2. Update borgmatic to v1.8.2.<br/>3. Update emborg to v1.37.<br/>4. Migrate to python 3.11<br/>5. Mark ARMv5 as unsupported"
CHANGELOG = "1. Update borg to v1.2.6.<br/>2. Update borgmatic to v1.8.2.<br/>3. Update emborg to v1.37.<br/>4. Migrate to python 3.11."

HOMEPAGE = https://borgbackup.readthedocs.io
LICENSE = 3-Clause BSD
Expand Down
4 changes: 2 additions & 2 deletions spk/mercurial/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ SPK_ICON = src/mercurial.png

PYTHON_PACKAGE = python311
SPK_DEPENDS = "python311>=3.11.5-8"
UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS) $(ARMv5_ARCHS)
UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS)

WHEELS = src/requirements-crossenv.txt src/requirements-pure.txt

MAINTAINER = SynoCommunity
DESCRIPTION = Mercurial is a free, distributed source control management tool
STARTABLE = no
DISPLAY_NAME = Mercurial
CHANGELOG = "1. Update mercurial to 6.5<br/>2. Update to Python 3.11<br/>3. Mark ARMv5 as unsupported"
CHANGELOG = "1. Update mercurial to 6.5.<br/>2. Update to Python 3.11."

HOMEPAGE = https://www.mercurial-scm.org/
LICENSE = MPL1.1
Expand Down
4 changes: 2 additions & 2 deletions spk/octoprint/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DSM_UI_DIR = app

PYTHON_PACKAGE = python311
SPK_DEPENDS = "python311>=3.11.5-8"
UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS) $(ARMv5_ARCHS)
UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS)

WHEELS = src/requirements-crossenv.txt src/requirements-pure.txt

Expand All @@ -21,7 +21,7 @@ ADMIN_PORT = $(SERVICE_PORT)
DISPLAY_NAME = OctoPrint
HOMEPAGE = https://octoprint.org/
LICENSE = AGPLv3
CHANGELOG = "1. Update OctoPrint to v1.9.2<br/>2. Python dependency to 3.11<br/>3. Mark ARMv5 as unsupported"
CHANGELOG = "1. Update OctoPrint to v1.9.2.<br/>2. Python dependency to 3.11."

# SERVICE_COMMAND is in src/service-setup.sh
STARTABLE = yes
Expand Down
7 changes: 3 additions & 4 deletions spk/python311/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ SPK_VERS_MAJOR_MINOR = $(word 1,$(subst ., ,$(SPK_VERS))).$(word 2,$(subst ., ,$
SPK_REV = 8
SPK_ICON = src/python3.png

# 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)
# 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
4 changes: 2 additions & 2 deletions spk/rdiff-backup/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SPK_ICON = src/rdiff-backup.png

PYTHON_PACKAGE = python311
SPK_DEPENDS = "python311>=3.11.5-8"
UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS) $(ARMv5_ARCHS)
UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS)

WHEELS = src/requirements-crossenv.txt src/requirements-pure.txt

Expand All @@ -18,7 +18,7 @@ MAINTAINER = SynoCommunity
DESCRIPTION = Reverse differential backup tool, over a network or locally.
STARTABLE = no
DISPLAY_NAME = rdiff-backup
CHANGELOG = "1. Update to v2.2.5<br/>2. Migrate to Python 3.11<br/>3. Mark ARMv5 as unsupported"
CHANGELOG = "1. Update to v2.2.5.<br/>2. Migrate to Python 3.11."

HOMEPAGE = https://rdiff-backup.net/
LICENSE = GPLv2
Expand Down

0 comments on commit 8a45a25

Please sign in to comment.