Skip to content

Commit

Permalink
Merge branch 'SynoCommunity:master' into Sickchill-6-7
Browse files Browse the repository at this point in the history
  • Loading branch information
BKSteve authored Nov 3, 2021
2 parents 8ddde6b + 9e02f76 commit 47cb257
Show file tree
Hide file tree
Showing 23 changed files with 1,334 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cross/pillow/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKG_NAME = Pillow
PKG_VERS = 8.2.0
PKG_VERS = 8.4.0
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://files.pythonhosted.org/packages/source/P/$(PKG_NAME)
Expand Down
6 changes: 3 additions & 3 deletions cross/pillow/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Pillow-8.2.0.tar.gz SHA1 a9b32caf6ff1d5160ad41265c7ad3b090114eefc
Pillow-8.2.0.tar.gz SHA256 a787ab10d7bb5494e5f76536ac460741788f1fbce851068d73a87ca7c35fc3e1
Pillow-8.2.0.tar.gz MD5 21c03274a9f59b9c00419852a8faebe7
Pillow-8.4.0.tar.gz SHA1 ca8d057aec64ccd0804044bc71c17921afbe2e4e
Pillow-8.4.0.tar.gz SHA256 b8e2f83c56e141920c39464b852de3719dfbfb6e3c99a2d8da0edf4fb33176ed
Pillow-8.4.0.tar.gz MD5 7a1eb5a250c7ccbd549a89e16404f09f
143 changes: 143 additions & 0 deletions cross/python310/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
PKG_NAME = python310
PKG_VERS = 3.10.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)

BUILD_DEPENDS = native/$(PKG_NAME)

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 += --enable-ipv6
CONFIGURE_ARGS += --without-ensurepip
CONFIGURE_ARGS += --enable-loadable-sqlite-extensions
CONFIGURE_ARGS += --with-computed-gotos=yes
CONFIGURE_ARGS += --enable-optimizations

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/openssl
CONFIGURE_ARGS += --with-ssl-default-suites=openssl

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

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

# libffi is no longer bundled with python
DEPENDS += cross/libffi
CONFIGURE_ARGS += --with-system-ffi

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

# Enable Link-Time Optimization
ifneq ($(findstring $(ARCH),$(ARMv5_ARCHS)),$(ARCH))
CONFIGURE_ARGS += --with-lto
endif

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

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 takes 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

ENV += LIBFFI_INCLUDEDIR=$(STAGING_INSTALL_PREFIX)/include/

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

.PHONY: python310_pre_configure
python310_pre_configure:
cp $(PYTHON_NATIVE) $(HOSTPYTHON)
$(RUN) autoreconf
# 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: python310_compile
python310_compile:
$(RUN) _PYTHON_HOST_PLATFORM=$(TC_TARGET) $(MAKE) -j $(NCPUS)

.PHONY: python310_install
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)

.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) $(WORK_DIR)/crossenv/
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) wget https://bootstrap.pypa.io/get-pip.py
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-python get-pip.py "pip==21.3.1"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) python get-pip.py "pip==21.3.1"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip install "setuptools==58.3.0"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) pip install "setuptools==58.3.0"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip install "wheel==0.37.0"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) pip install "wheel==0.37.0"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip install "cffi==1.15.0"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) pip install "cffi==1.15.0"
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 >> $@
14 changes: 14 additions & 0 deletions cross/python310/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
lnk:bin/2to3
rsc:bin/2to3-3.10
lnk:bin/idle3
rsc:bin/idle3.10
lnk:bin/pydoc3
rsc:bin/pydoc3.10
lnk:bin/python3
bin:bin/python3.10
rsc:etc/mime.types
rsc:include/python3.10/pyconfig.h
lnk:lib/libpython3.10.so
lib:lib/libpython3.10.so.1.0
lib:lib/libpython3.so
rsc:lib/python3.10
3 changes: 3 additions & 0 deletions cross/python310/digests
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Python-3.10.0.tar.xz SHA1 c6114b411b7e6d26fc9887c11c0800d9625f1ade
Python-3.10.0.tar.xz SHA256 5a99f8e7a6a11a7b98b4e75e0d1303d3832cada5534068f69c7b6222a7b1b002
Python-3.10.0.tar.xz MD5 3e7035d272680f80e3ce4e8eb492d580
26 changes: 26 additions & 0 deletions cross/python310/patches/001-mimetypes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

DSM does not have the default mime-type files available,
need to bring our own for the module to work.

Equivalent of cross/python/patches/004-mimetypes.patch
Added by Diaoul 2013-03-24_23:25:49+0100

--- Lib/mimetypes.py.orig 2011-10-16 21:07:51.000000000 +0200
+++ Lib/mimetypes.py 2011-10-16 21:07:58.000000000 +0200
@@ -40,15 +40,7 @@
]

knownfiles = [
- "/etc/mime.types",
- "/etc/httpd/mime.types", # Mac OS X
- "/etc/httpd/conf/mime.types", # Apache
- "/etc/apache/mime.types", # Apache 1
- "/etc/apache2/mime.types", # Apache 2
- "/usr/local/etc/httpd/conf/mime.types",
- "/usr/local/lib/netscape/mime.types",
- "/usr/local/etc/httpd/conf/mime.types", # Apache 1.2
- "/usr/local/etc/mime.types", # Apache 1.3
+ "@INSTALL_PREFIX@/etc/mime.types",
]

inited = False
17 changes: 17 additions & 0 deletions cross/python310/patches/002-xcompile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

In Cross-compile, we need to regenerate -- if needed -- using a native-built
Python. This patch includes additional vebose output and fail-fast logic for
when the PGEN determination is incorrectly done to avoid the 55-minute build
that ultimately fails

--- configure.ac.orig 2016-06-25 23:38:39.000000000 +0200
+++ configure.ac 2016-12-05 22:06:40.183563868 +0100
@@ -74,6 +74,8 @@
fi
AC_MSG_RESULT($interp)
PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$interp
+ else
+ AC_MSG_RESULT($PYTHON_FOR_BUILD)
fi
elif test "$cross_compiling" = maybe; then
AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
45 changes: 45 additions & 0 deletions cross/python310/patches/003-rpath.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

Synology library path is a formulaic but atypical. Register an RPATH to avoid
requiring an additional LD_LIBRARY_PATH everywhere it's used. Editing both the
build configure plus the upstream .ac in case it's regenerated

diff -cr Python-3.5.5/configure x/configure
*** configure 2018-06-16 07:30:43.000454610 +0000
--- configure 2018-06-16 08:34:50.801838237 +0000
***************
*** 5971,5977 ****
;;
Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
LDLIBRARY='libpython$(LDVERSION).so'
! BLDLIBRARY='-L. -lpython$(LDVERSION)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
INSTSONAME="$LDLIBRARY".$SOVERSION
if test "$with_pydebug" != yes
--- 5971,5977 ----
;;
Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
LDLIBRARY='libpython$(LDVERSION).so'
! BLDLIBRARY='-Wl,-rpath,$(LIBDIR) -L. -lpython$(LDVERSION)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
INSTSONAME="$LDLIBRARY".$SOVERSION
if test "$with_pydebug" != yes
diff -cr /home/bob/src/spksrc-allanc/spk/homeassistant/work/Python-3.5.5/configure.ac x/configure.ac
*** configure.ac 2018-06-16 07:30:38.048438143 +0000
--- configure.ac 2018-06-16 08:35:34.921999207 +0000
***************
*** 1127,1133 ****
;;
Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
LDLIBRARY='libpython$(LDVERSION).so'
! BLDLIBRARY='-L. -lpython$(LDVERSION)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
INSTSONAME="$LDLIBRARY".$SOVERSION
if test "$with_pydebug" != yes
--- 1127,1133 ----
;;
Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
LDLIBRARY='libpython$(LDVERSION).so'
! BLDLIBRARY='-Wl,-rpath,$(LIBDIR) -L. -lpython$(LDVERSION)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
INSTSONAME="$LDLIBRARY".$SOVERSION
if test "$with_pydebug" != yes
56 changes: 56 additions & 0 deletions cross/python310/patches/004-xcompile-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

When compiling x86/x64 toolchains the setup.py script will
automatically try to add library-dirs of the compile host.
This results in failures to compile modules on those platforms.
This first block is copied from
cross/python/patches/002-no-system-multiarch.patch

The second block allows custom -I and -L to survive into the cross environment.

*** setup.py 2018-02-04 15:40:56.000000000 -0800
--- setup.py 2018-06-24 00:01:06.695850717 -0700
***************
*** 651,663 ****
if not CROSS_COMPILING:
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
# only change this for cross builds for 3.3, issues on Mageia
if CROSS_COMPILING:
self.add_cross_compiling_paths()
- self.add_multiarch_paths()
self.add_ldflags_cppflags()

def init_inc_lib_dirs(self):
if (not CROSS_COMPILING and
os.path.normpath(sys.base_prefix) != '/usr' and
not sysconfig.get_config_var('PYTHONFRAMEWORK')):
--- 651,662 ----
***************
*** 697,709 ****
self.lib_dirs += ['/usr/ccs/lib']

# HP-UX11iv3 keeps files in lib/hpux folders.
if HOST_PLATFORM == 'hp-ux11':
self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']

! if MACOS:
# This should work on any unixy platform ;-)
# If the user has bothered specifying additional -I and -L flags
# in OPT and LDFLAGS we might as well use them here.
#
# NOTE: using shlex.split would technically be more correct, but
# also gives a bootstrap problem. Let's hope nobody uses
--- 696,708 ----
self.lib_dirs += ['/usr/ccs/lib']

# HP-UX11iv3 keeps files in lib/hpux folders.
if HOST_PLATFORM == 'hp-ux11':
self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']

! if MACOS or CROSS_COMPILING:
# This should work on any unixy platform ;-)
# If the user has bothered specifying additional -I and -L flags
# in OPT and LDFLAGS we might as well use them here.
#
# NOTE: using shlex.split would technically be more correct, but
# also gives a bootstrap problem. Let's hope nobody uses
37 changes: 37 additions & 0 deletions cross/python310/patches/005-configure.ac-libffi.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Ensures that the LIBFFI_INCLUDEDIR environment variable can be forced

*** configure.ac.orig 2020-04-13 14:50:17.476803111 +0000
--- configure.ac 2020-04-13 14:52:29.859184113 +0000
***************
*** 3011,3022 ****
with_system_ffi="yes"
fi

! if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
! LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
else
! LIBFFI_INCLUDEDIR=""
fi
- AC_SUBST(LIBFFI_INCLUDEDIR)

# Check for use of the system libmpdec library
AC_MSG_CHECKING(for --with-system-libmpdec)
--- 3011,3028 ----
with_system_ffi="yes"
fi

! if test -z "${LIBFFI_INCLUDEDIR+x}"
! then
! if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
! LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
! else
! LIBFFI_INCLUDEDIR=""
! fi
! AC_SUBST(LIBFFI_INCLUDEDIR)
else
! AC_SUBST(LIBFFI_INCLUDEDIR, "${LIBFFI_INCLUDEDIR}")
! AC_MSG_NOTICE([Using LIBFFI_INCLUDEDIR=${LIBFFI_INCLUDEDIR}])
fi

# Check for use of the system libmpdec library
AC_MSG_CHECKING(for --with-system-libmpdec)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Fixes the mechanism used to detect if the no-unused-result flag is supported

--- configure.ac.orig
+++ configure.ac
@@ -1630,7 +1630,7 @@ yes)
*)
AC_MSG_CHECKING(if we can turn off $CC unused result warning)
ac_save_cc="$CC"
- CC="$CC -Wunused-result -Werror"
+ CC="$CC -Wno-unused-result -Werror"
save_CFLAGS="$CFLAGS"
AC_CACHE_VAL(ac_cv_disable_unused_result_warning,
AC_COMPILE_IFELSE(

Loading

0 comments on commit 47cb257

Please sign in to comment.