diff --git a/make/bootstrap.mk b/make/bootstrap.mk index cf7ce94a..4410e0ba 100644 --- a/make/bootstrap.mk +++ b/make/bootstrap.mk @@ -63,7 +63,7 @@ endif mkdir -p $(TARGET_DIR)/srv mkdir -p $(TARGET_DIR)/sys mkdir -p $(TARGET_DIR)/tmp - mkdir -p $(PKG_CONFIG_PATH) + $(foreach dir,$(subst :, ,$(PKG_CONFIG_PATH)),$(shell mkdir -p $(dir))) make skeleton ifeq ($(PERSISTENT_VAR_PARTITION),yes) ifeq ($(IMAGE_NEW),yes) diff --git a/make/crosstool.mk b/make/crosstool.mk index 4f04197c..527728af 100644 --- a/make/crosstool.mk +++ b/make/crosstool.mk @@ -13,7 +13,7 @@ crosstools: # ----------------------------------------------------------------------------- -CROSSTOOL_BACKUP = $(DL_DIR)/crosstool-ng-$(BOXARCH)-linux-$(KERNEL_VER)-backup.tar.gz +CROSSTOOL_BACKUP = $(DL_DIR)/crosstool-ng-$(TARGET_ARCH)-linux-$(KERNEL_VER)-backup.tar.gz $(CROSSTOOL_BACKUP): $(call draw_line); diff --git a/make/environment-box.mk b/make/environment-box.mk index 1f251cbc..17568883 100644 --- a/make/environment-box.mk +++ b/make/environment-box.mk @@ -203,13 +203,10 @@ endif ifeq ($(BOXTYPE),coolstream) BOXTYPE_SC = cst - BOXARCH = arm else ifeq ($(BOXTYPE),armbox) BOXTYPE_SC = arm - BOXARCH = arm else ifeq ($(BOXTYPE),mipsbox) BOXTYPE_SC = mips - BOXARCH = mips endif # ----------------------------------------------------------------------------- @@ -260,9 +257,6 @@ endif ifndef BOXTYPE_SC $(error BOXTYPE_SC not set) endif -ifndef BOXARCH - $(error BOXARCH not set) -endif ifndef BOXSERIES $(error BOXSERIES not set) endif diff --git a/make/environment-build.mk b/make/environment-build.mk index 49ea1630..93553d94 100644 --- a/make/environment-build.mk +++ b/make/environment-build.mk @@ -27,6 +27,71 @@ MAKEFLAGS += --no-print-directory # ----------------------------------------------------------------------------- +ifeq ($(BOXSERIES),hd1) + DRIVERS-BIN_DIR = $(BOXTYPE)/$(BOXFAMILY) + CORTEX-STRINGS_LDFLAG = + TARGET = arm-cx2450x-linux-gnueabi + TARGET_OPTIMIZATION = -Os + TARGET_DEBUGGING = -g + TARGET_ARCH = arm + TARGET_CPU = armv6 + TARGET_ABI = -march=$(TARGET_CPU) -mfloat-abi=soft -mlittle-endian + TARGET_ENDIAN = little + TARGET_EXTRA_CFLAGS = -fdata-sections -ffunction-sections + TARGET_EXTRA_LDFLAGS = -Wl,--gc-sections + CXX11_ABI = + +else ifeq ($(BOXSERIES),hd2) + DRIVERS-BIN_DIR = $(BOXTYPE)/$(BOXFAMILY) + CORTEX-STRINGS_LDFLAG = -lcortex-strings + TARGET = arm-cortex-linux-uclibcgnueabi + TARGET_OPTIMIZATION = -O2 + TARGET_DEBUGGING = -g + TARGET_ARCH = arm + TARGET_CPU = armv7-a + TARGET_ABI = -march=$(TARGET_CPU) -mtune=cortex-a9 -mfpu=vfpv3-d16 -mfloat-abi=hard -mlittle-endian + TARGET_ENDIAN = little + TARGET_EXTRA_CFLAGS = + TARGET_EXTRA_LDFLAGS = + ifeq ($(BOXMODEL),kronos_v2) + TARGET_OPTIMIZATION = -Os + TARGET_EXTRA_CFLAGS = -fdata-sections -ffunction-sections + TARGET_EXTRA_LDFLAGS = -Wl,--gc-sections + endif + CXX11_ABI = -D_GLIBCXX_USE_CXX11_ABI=0 + +else ifeq ($(BOXSERIES),$(filter $(BOXSERIES),hd5x hd6x vusolo4k vuduo4k vuduo4kse vuultimo4k vuzero4k vuuno4k vuuno4kse)) + DRIVERS-BIN_DIR = $(BOXTYPE)/$(BOXMODEL) + CORTEX-STRINGS_LDFLAG = -lcortex-strings + TARGET = arm-cortex-linux-gnueabihf + TARGET_OPTIMIZATION = -O2 + TARGET_DEBUGGING = -g + TARGET_ARCH = arm + TARGET_CPU = armv7ve + TARGET_ABI = -march=$(TARGET_CPU) -mtune=cortex-a15 -mfpu=neon-vfpv4 -mfloat-abi=hard + TARGET_ENDIAN = little + TARGET_EXTRA_CFLAGS = + TARGET_EXTRA_LDFLAGS = + CXX11_ABI = + +else ifeq ($(BOXSERIES),$(filter $(BOXSERIES),vuduo)) + DRIVERS-BIN_DIR = $(BOXTYPE)/$(BOXMODEL) + CORTEX-STRINGS_LDFLAG = + TARGET = mipsel-unknown-linux-gnu + TARGET_OPTIMIZATION = -O2 + TARGET_DEBUGGING = -g + TARGET_ARCH = mips + TARGET_CPU = mips32 + TARGET_ABI = -march=$(TARGET_CPU) -mtune=mips32 + TARGET_ENDIAN = little + TARGET_EXTRA_CFLAGS = + TARGET_EXTRA_LDFLAGS = + CXX11_ABI = + +endif + +# ----------------------------------------------------------------------------- + BASE_DIR := $(shell pwd) MAINTAINER ?= unknown WHOAMI := $(shell id -un) @@ -46,9 +111,9 @@ IMAGE_DIR = $(STAGING_DIR)/images UPDATE_DIR = $(STAGING_DIR)/updates HELPERS_DIR = $(BASE_DIR)/helpers CROSS_BASE = $(BASE_DIR)/cross -CROSS_DIR ?= $(CROSS_BASE)/$(BOXARCH)-linux-$(KERNEL_VER) +CROSS_DIR ?= $(CROSS_BASE)/$(TARGET_ARCH)-linux-$(KERNEL_VER) STATIC_BASE = $(BASE_DIR)/static -STATIC_DIR = $(STATIC_BASE)/$(BOXARCH)-linux-$(KERNEL_VER) +STATIC_DIR = $(STATIC_BASE)/$(TARGET_ARCH)-linux-$(KERNEL_VER) CONFIGS = $(BASE_DIR)/configs PATCHES = $(BASE_DIR)/patches SKEL-ROOT = $(BASE_DIR)/skel-root/$(BOXSERIES) @@ -62,8 +127,7 @@ BUILD ?= $(shell /usr/share/libtool/config.guess 2>/dev/null || /usr/shar # ----------------------------------------------------------------------------- -HOST_DIR = $(BASE_DIR)/host -HOST_DEPS_DIR = $(HOST_DIR)/deps +include make/environment-host.mk # ----------------------------------------------------------------------------- @@ -81,7 +145,7 @@ PKG_PATCHES_DIR = $(PATCHES)/$(subst host-,,$(PKG_NAME)) # ----------------------------------------------------------------------------- CCACHE = /usr/bin/ccache -CCACHE_DIR = $(HOME)/.ccache-ni-buildsystem-$(BOXARCH)-linux-$(KERNEL_VER) +CCACHE_DIR = $(HOME)/.ccache-ni-buildsystem-$(TARGET_ARCH)-linux-$(KERNEL_VER) export CCACHE_DIR # ----------------------------------------------------------------------------- @@ -91,69 +155,19 @@ DEBUG ?= no # ----------------------------------------------------------------------------- -ifeq ($(BOXSERIES),hd1) - DRIVERS-BIN_DIR = $(BOXTYPE)/$(BOXFAMILY) - CORTEX-STRINGS_LDFLAG = - TARGET = arm-cx2450x-linux-gnueabi - TARGET_OPTIMIZATION = -Os - TARGET_DEBUGGING = -g - TARGET_ARCH = armv6 - TARGET_ABI = -march=$(TARGET_ARCH) -mfloat-abi=soft -mlittle-endian - TARGET_EXTRA_CFLAGS = -fdata-sections -ffunction-sections - TARGET_EXTRA_LDFLAGS = -Wl,--gc-sections - CXX11_ABI = - -else ifeq ($(BOXSERIES),hd2) - DRIVERS-BIN_DIR = $(BOXTYPE)/$(BOXFAMILY) - CORTEX-STRINGS_LDFLAG = -lcortex-strings - TARGET = arm-cortex-linux-uclibcgnueabi - TARGET_OPTIMIZATION = -O2 - TARGET_DEBUGGING = -g - TARGET_ARCH = armv7-a - TARGET_ABI = -march=$(TARGET_ARCH) -mtune=cortex-a9 -mfpu=vfpv3-d16 -mfloat-abi=hard -mlittle-endian - TARGET_EXTRA_CFLAGS = - TARGET_EXTRA_LDFLAGS = - ifeq ($(BOXMODEL),kronos_v2) - TARGET_OPTIMIZATION = -Os - TARGET_EXTRA_CFLAGS = -fdata-sections -ffunction-sections - TARGET_EXTRA_LDFLAGS = -Wl,--gc-sections - endif - CXX11_ABI = -D_GLIBCXX_USE_CXX11_ABI=0 - -else ifeq ($(BOXSERIES),$(filter $(BOXSERIES),hd5x hd6x vusolo4k vuduo4k vuduo4kse vuultimo4k vuzero4k vuuno4k vuuno4kse)) - DRIVERS-BIN_DIR = $(BOXTYPE)/$(BOXMODEL) - CORTEX-STRINGS_LDFLAG = -lcortex-strings - TARGET = arm-cortex-linux-gnueabihf - TARGET_OPTIMIZATION = -O2 - TARGET_DEBUGGING = -g - TARGET_ARCH = armv7ve - TARGET_ABI = -march=$(TARGET_ARCH) -mtune=cortex-a15 -mfpu=neon-vfpv4 -mfloat-abi=hard - TARGET_EXTRA_CFLAGS = - TARGET_EXTRA_LDFLAGS = - CXX11_ABI = - -else ifeq ($(BOXSERIES),$(filter $(BOXSERIES),vuduo)) - DRIVERS-BIN_DIR = $(BOXTYPE)/$(BOXMODEL) - CORTEX-STRINGS_LDFLAG = - TARGET = mipsel-unknown-linux-gnu - TARGET_OPTIMIZATION = -O2 - TARGET_DEBUGGING = -g - TARGET_ARCH = mips32 - TARGET_ABI = -march=$(TARGET_ARCH) -mtune=mips32 - TARGET_EXTRA_CFLAGS = - TARGET_EXTRA_LDFLAGS = - CXX11_ABI = - -endif - include make/environment-target.mk +# ----------------------------------------------------------------------------- + STATIC_libdir = $(STATIC_DIR)/$(prefix)/lib TARGET_CFLAGS = -pipe $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_ABI) $(TARGET_EXTRA_CFLAGS) $(CXX11_ABI) -I$(TARGET_includedir) TARGET_CPPFLAGS = $(TARGET_CFLAGS) TARGET_CXXFLAGS = $(TARGET_CFLAGS) -TARGET_LDFLAGS = $(CORTEX-STRINGS_LDFLAG) -Wl,-O1 -Wl,-rpath,$(TARGET_libdir) -Wl,-rpath-link,$(TARGET_libdir) -L$(TARGET_libdir) $(TARGET_EXTRA_LDFLAGS) +TARGET_LDFLAGS = $(CORTEX-STRINGS_LDFLAG) $(TARGET_EXTRA_LDFLAGS) +TARGET_LDFLAGS += -L$(TARGET_base_libdir) -L$(TARGET_libdir) +TARGET_LDFLAGS += -Wl,-rpath,$(TARGET_libdir) -Wl,-rpath-link,$(TARGET_libdir) +TARGET_LDFLAGS += -Wl,-O1 TARGET_CROSS = $(TARGET)- @@ -191,8 +205,8 @@ PATH := $(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(CROSS_DIR)/bin:$(PATH) # ----------------------------------------------------------------------------- PKG_CONFIG = $(HOST_DIR)/bin/$(TARGET)-pkg-config -PKG_CONFIG_LIBDIR = $(TARGET_libdir) -PKG_CONFIG_PATH = $(PKG_CONFIG_LIBDIR)/pkgconfig +PKG_CONFIG_LIBDIR = $(TARGET_base_libdir):$(TARGET_libdir) +PKG_CONFIG_PATH = $(TARGET_base_libdir)/pkgconfig:$(TARGET_libdir)/pkgconfig PKG_CONFIG_SYSROOT_DIR=$(TARGET_DIR) # ----------------------------------------------------------------------------- @@ -253,7 +267,7 @@ MAKE_OPTS = \ RANLIB="$(TARGET_RANLIB)" \ READELF="$(TARGET_READELF)" \ STRIP="$(TARGET_STRIP)" \ - ARCH=$(BOXARCH) + ARCH=$(TARGET_ARCH) MAKE_ENV = \ $(MAKE_OPTS) \ @@ -278,6 +292,58 @@ CONFIGURE = \ $(MAKE_ENV) \ ./configure $(CONFIGURE_OPTS) +define meson-cross-config # (dest dir) + mkdir -p $(1) + ( \ + echo "# Note: Buildsystems's and Meson's terminologies differ about the meaning"; \ + echo "# of 'build', 'host' and 'target':"; \ + echo "# - Buildsystems's 'host' is Meson's 'build'"; \ + echo "# - Buildsystems's 'target' is Meson's 'host'"; \ + echo ""; \ + echo "[binaries]"; \ + echo "c = '$(TARGET_CC)'"; \ + echo "cpp = '$(TARGET_CXX)'"; \ + echo "ar = '$(TARGET_AR)'"; \ + echo "strip = '$(TARGET_STRIP)'"; \ + echo "pkgconfig = '$(PKG_CONFIG)'"; \ + echo ""; \ + echo "[built-in options]"; \ + echo "c_args = '$(TARGET_CFLAGS)'"; \ + echo "c_link_args = '$(TARGET_LDFLAGS)'"; \ + echo "cpp_args = '$(TARGET_CXXFLAGS)'"; \ + echo "cpp_link_args = '$(TARGET_LDFLAGS)'"; \ + echo ""; \ + echo "[properties]"; \ + echo "needs_exe_wrapper = true"; \ + echo "sys_root = '$(TARGET_DIR)'"; \ + echo "pkg_config_libdir = '$(PKG_CONFIG_LIBDIR)'"; \ + echo ""; \ + echo "[host_machine]"; \ + echo "system = 'linux'"; \ + echo "cpu_family = '$(TARGET_ARCH)'"; \ + echo "cpu = '$(TARGET_CPU)'"; \ + echo "endian = '$(TARGET_ENDIAN)'" \ + ) > $(1)/meson-cross.config +endef + +# ----------------------------------------------------------------------------- + +MESON_CONFIGURE = \ + $(call meson-cross-config,$(PKG_BUILD_DIR)/build); \ + unset CC CXX CPP LD AR NM STRIP; \ + PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" \ + $(HOST_MESON) \ + --buildtype=release \ + --cross-file $(PKG_BUILD_DIR)/build/meson-cross.config \ + -Dstrip=false \ + $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/build + +NINJA = \ + $(HOST_NINJA) -C $(PKG_BUILD_DIR)/build + +NINJA_INSTALL = DESTDIR=$(TARGET_DIR) \ + $(HOST_NINJA) -C $(PKG_BUILD_DIR)/build install + # ----------------------------------------------------------------------------- CMAKE_OPTS = \ @@ -285,7 +351,7 @@ CMAKE_OPTS = \ -DENABLE_STATIC=OFF \ -DCMAKE_BUILD_TYPE="None" \ -DCMAKE_SYSTEM_NAME="Linux" \ - -DCMAKE_SYSTEM_PROCESSOR="$(BOXARCH)" \ + -DCMAKE_SYSTEM_PROCESSOR="$(TARGET_ARCH)" \ -DCMAKE_INSTALL_PREFIX="$(prefix)" \ -DCMAKE_INSTALL_DOCDIR="$(REMOVE_docdir)" \ -DCMAKE_INSTALL_MANDIR="$(REMOVE_mandir)" \ diff --git a/make/environment-host.mk b/make/environment-host.mk new file mode 100644 index 00000000..e60472dc --- /dev/null +++ b/make/environment-host.mk @@ -0,0 +1,73 @@ +# +# set up host environment for other makefiles +# +# ----------------------------------------------------------------------------- + +HOST_DIR = $(BASE_DIR)/host +HOST_DEPS_DIR = $(HOST_DIR)/deps + +# ----------------------------------------------------------------------------- + +ifndef HOST_AR +HOST_AR := ar +endif +ifndef HOST_AS +HOST_AS := as +endif +ifndef HOST_CC +HOST_CC := gcc +HOST_CC := $(shell which $(HOST_CC) || type -p $(HOST_CC) || echo gcc) +endif +HOST_CC_NOCCACHE := $(HOST_CC) +ifndef HOST_CXX +HOST_CXX := g++ +HOST_CXX := $(shell which $(HOST_CXX) || type -p $(HOST_CXX) || echo g++) +endif +HOST_CXX_NOCCACHE := $(HOST_CXX) +ifndef HOST_CPP +HOST_CPP := cpp +endif +ifndef HOST_LD +HOST_LD := ld +endif +ifndef HOST_LN +HOST_LN := ln +endif +ifndef HOST_NM +HOST_NM := nm +endif +ifndef HOST_OBJCOPY +HOST_OBJCOPY := objcopy +endif +ifndef HOST_RANLIB +HOST_RANLIB := ranlib +endif +HOST_AR := $(shell which $(HOST_AR) || type -p $(HOST_AR) || echo ar) +HOST_AS := $(shell which $(HOST_AS) || type -p $(HOST_AS) || echo as) +HOST_CPP := $(shell which $(HOST_CPP) || type -p $(HOST_CPP) || echo cpp) +HOST_LD := $(shell which $(HOST_LD) || type -p $(HOST_LD) || echo ld) +HOST_LN := $(shell which $(HOST_LN) || type -p $(HOST_LN) || echo ln) +HOST_NM := $(shell which $(HOST_NM) || type -p $(HOST_NM) || echo nm) +HOST_OBJCOPY := $(shell which $(HOST_OBJCOPY) || type -p $(HOST_OBJCOPY) || echo objcopy) +HOST_RANLIB := $(shell which $(HOST_RANLIB) || type -p $(HOST_RANLIB) || echo ranlib) + +export HOST_AR HOST_AS HOST_CC HOST_CXX HOST_LD +export HOST_CC_NOCCACHE HOST_CXX_NOCCACHE + +# ----------------------------------------------------------------------------- + +HOST_PYTHON_BUILD = \ + CC="$(HOST_CC)" \ + CFLAGS="$(CFLAGS)" \ + LDFLAGS="$(LDFLAGS)" \ + LDSHARED="$(HOST_CC) -shared" \ + PYTHONPATH=$(HOST_DIR)/$(HOST_PYTHON3_BASE_DIR)/site-packages \ + $(HOST_DIR)/bin/python3 ./setup.py build --executable=/usr/python + +HOST_PYTHON_INSTALL = \ + CC="$(HOST_CC)" \ + CFLAGS="$(CFLAGS)" \ + LDFLAGS="$(LDFLAGS)" \ + LDSHARED="$(HOST_CC) -shared" \ + PYTHONPATH=$(HOST_DIR)/$(HOST_PYTHON3_BASE_DIR)/site-packages \ + $(HOST_DIR)/bin/python3 ./setup.py install --root=$(HOST_DIR) --prefix= diff --git a/make/environment-linux.mk b/make/environment-linux.mk index b8be009f..94c59970 100644 --- a/make/environment-linux.mk +++ b/make/environment-linux.mk @@ -34,7 +34,7 @@ else ifeq ($(BOXMODEL),$(filter $(BOXMODEL),hd51 bre2ze4k h7)) KERNEL_SITE = http://downloads.mutant-digital.net KERNEL_BRANCH = $(EMPTY) - KERNEL_DTB = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(BOXARCH)/boot/dts/bcm7445-bcm97445svmb.dtb + KERNEL_DTB = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(TARGET_ARCH)/boot/dts/bcm7445-bcm97445svmb.dtb KERNEL_CONFIG = $(CONFIGS)/kernel-hd5x.config BOOT_PARTITION = 1 @@ -47,7 +47,7 @@ else ifeq ($(BOXMODEL),$(filter $(BOXMODEL),hd60)) KERNEL_SITE = http://source.mynonpublic.com/gfutures KERNEL_BRANCH = $(EMPTY) - KERNEL_DTB = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(BOXARCH)/boot/dts/hi3798mv200.dtb + KERNEL_DTB = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(TARGET_ARCH)/boot/dts/hi3798mv200.dtb KERNEL_CONFIG = $(CONFIGS)/kernel-hd6x.config BOOT_PARTITION = 4 @@ -60,7 +60,7 @@ else ifeq ($(BOXMODEL),$(filter $(BOXMODEL),hd61)) KERNEL_SITE = http://source.mynonpublic.com/gfutures KERNEL_BRANCH = $(EMPTY) - KERNEL_DTB = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(BOXARCH)/boot/dts/hi3798mv200.dtb + KERNEL_DTB = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(TARGET_ARCH)/boot/dts/hi3798mv200.dtb KERNEL_CONFIG = $(CONFIGS)/kernel-hd6x.config BOOT_PARTITION = 4 @@ -201,18 +201,18 @@ KERNEL_NAME = NI $(shell echo $(BOXFAMILY) | sed 's/.*/\u&/') Kernel KERNEL_modulesdir = $(BUILD_DIR)/$(KERNEL_MODULES)/lib/modules/$(KERNEL_VER) ifeq ($(BOXMODEL),nevis) - KERNEL_UIMAGE = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(BOXARCH)/boot/Image + KERNEL_UIMAGE = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(TARGET_ARCH)/boot/Image else - KERNEL_UIMAGE = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(BOXARCH)/boot/uImage + KERNEL_UIMAGE = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(TARGET_ARCH)/boot/uImage endif -KERNEL_ZIMAGE = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(BOXARCH)/boot/zImage -KERNEL_ZIMAGE_DTB = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(BOXARCH)/boot/zImage_dtb +KERNEL_ZIMAGE = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(TARGET_ARCH)/boot/zImage +KERNEL_ZIMAGE_DTB = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(TARGET_ARCH)/boot/zImage_dtb KERNEL_VMLINUX = $(BUILD_DIR)/$(KERNEL_OBJ)/vmlinux # ----------------------------------------------------------------------------- KERNEL_MAKEVARS = \ - ARCH=$(BOXARCH) \ + ARCH=$(TARGET_ARCH) \ CROSS_COMPILE=$(TARGET_CROSS) \ INSTALL_MOD_PATH=$(BUILD_DIR)/$(KERNEL_MODULES) \ LOCALVERSION= \ diff --git a/make/helpers.mk b/make/helpers.mk index 67364eac..55cdd4f2 100644 --- a/make/helpers.mk +++ b/make/helpers.mk @@ -65,7 +65,8 @@ define REWRITE_LIBTOOL # (libdir) endef # rewrite libtool libraries automatically -REWRITE_LIBTOOL_LA = $(call REWRITE_LIBTOOL,$(TARGET_libdir)) +REWRITE_LIBTOOL_LA = $(call REWRITE_LIBTOOL,$(TARGET_base_libdir)); \ + $(call REWRITE_LIBTOOL,$(TARGET_libdir)) # ----------------------------------------------------------------------------- diff --git a/make/host-tools.mk b/make/host-tools.mk index 11539b40..b6858795 100644 --- a/make/host-tools.mk +++ b/make/host-tools.mk @@ -20,6 +20,7 @@ host-tools: $(HOST_DIR) \ host-dosfstools \ host-mtools \ host-e2fsprocs \ + host-meson \ host-lua \ host-luarocks \ host-ccache @@ -53,7 +54,7 @@ host-pkgconf: $(DL_DIR)/$(HOST_PKGCONF_SOURCE) | $(HOST_DIR) pkg-config-preqs $(APPLY_PATCHES); \ ./configure \ --prefix=$(HOST_DIR) \ - ; \ + ; \ $(MAKE); \ $(MAKE) install $(INSTALL_EXEC) $(PKG_FILES_DIR)/pkg-config.in $(HOST_PKG-CONFIG) @@ -91,7 +92,7 @@ host-mtd-utils: $(DL_DIR)/$(HOST_MTD-UTILS_SOURCE) | $(HOST_DIR) --without-ubifs \ --without-xattr \ --disable-tests \ - ; \ + ; \ $(MAKE); \ $(MAKE) install DESTDIR=$(HOST_DIR) $(REMOVE)/$(HOST_MTD-UTILS_DIR) @@ -138,8 +139,8 @@ HOST_TZDATA_SITE = ftp://ftp.iana.org/tz/releases HOST_ZIC = $(HOST_DIR)/sbin/zic -host-zic: $(HOST_DIR)/sbin/zic -$(HOST_DIR)/sbin/zic: $(DL_DIR)/$(HOST_TZDATA_SOURCE) $(DL_DIR)/$(HOST_TZCODE_SOURCE) | $(HOST_DIR) +host-zic: $(HOST_ZIC) +$(HOST_ZIC): $(DL_DIR)/$(HOST_TZDATA_SOURCE) $(DL_DIR)/$(HOST_TZCODE_SOURCE) | $(HOST_DIR) $(REMOVE)/$(HOST_TZCODE_DIR) $(MKDIR)/$(HOST_TZCODE_DIR) $(CHDIR)/$(HOST_TZCODE_DIR); \ @@ -174,7 +175,7 @@ host-parted: $(DL_DIR)/$(HOST_PARTED_SOURCE) | $(HOST_DIR) --disable-shared \ --disable-device-mapper \ --without-readline \ - ; \ + ; \ $(MAKE); \ $(MAKE) install DESTDIR=$(HOST_DIR) $(REMOVE)/$(HOST_PARTED_DIR) @@ -197,7 +198,7 @@ host-dosfstools: $(DL_DIR)/$(HOST_DOSFSTOOLS_SOURCE) | $(HOST_DIR) ./configure \ --prefix= \ --without-udev \ - ; \ + ; \ $(MAKE); \ $(MAKE) install DESTDIR=$(HOST_DIR) ln -sf mkfs.fat $(HOST_DIR)/sbin/mkfs.vfat @@ -222,7 +223,7 @@ host-mtools: $(DL_DIR)/$(HOST_MTOOLS_SOURCE) | $(HOST_DIR) $(CHDIR)/$(HOST_MTOOLS_DIR); \ ./configure \ --prefix= \ - ; \ + ; \ $(MAKE1); \ $(MAKE1) install DESTDIR=$(HOST_DIR) $(REMOVE)/$(HOST_MTOOLS_DIR) @@ -252,33 +253,165 @@ host-e2fsprocs: $(DL_DIR)/$(HOST_E2FSPROGS_SOURCE) | $(HOST_DIR) # ----------------------------------------------------------------------------- +HOST_MESON_VER = 0.56.0 +HOST_MESON_DIR = meson-$(HOST_MESON_VER) +HOST_MESON_SOURCE = meson-$(HOST_MESON_VER).tar.gz +HOST_MESON_SITE = https://github.com/mesonbuild/meson/releases/download/$(HOST_MESON_VER) + +$(DL_DIR)/$(HOST_MESON_SOURCE): + $(DOWNLOAD) $(HOST_MESON_SITE)/$(HOST_MESON_SOURCE) + +HOST_MESON_DEPS = host-ninja host-python3 host-python3-setuptools + +HOST_MESON = $(HOST_DIR)/bin/meson + +host-meson: $(HOST_MESON_DEPS) $(DL_DIR)/$(HOST_MESON_SOURCE) | $(HOST_DIR) + $(REMOVE)/$(HOST_MESON_DIR) + $(UNTAR)/$(HOST_MESON_SOURCE) + $(CHDIR)/$(HOST_MESON_DIR); \ + $(APPLY_PATCHES); \ + $(HOST_PYTHON_BUILD); \ + $(HOST_PYTHON_INSTALL) + $(REMOVE)/$(HOST_MESON_DIR) + $(TOUCH) + +# ----------------------------------------------------------------------------- + HOST_NINJA_VER = 1.10.0 HOST_NINJA_DIR = ninja-$(HOST_NINJA_VER) HOST_NINJA_SOURCE = ninja-$(HOST_NINJA_VER).tar.gz HOST_NINJA_SITE = $(call github,ninja-build,ninja,v$(HOST_NINJA_VER)) -HOST_NINJA_PATCH = ninja/0001-set-minimum-cmake-version-to-3.10.patch -HOST_NINJA_PATCH += ninja/0002-remove-fdiagnostics-color-from-make-command.patch -HOST_NINJA_PATCH += ninja/0003-CMake-fix-object-library-usage.patch - $(DL_DIR)/$(HOST_NINJA_SOURCE): $(DOWNLOAD) $(HOST_NINJA_SITE)/$(HOST_NINJA_SOURCE) +HOST_NINJA = $(HOST_DIR)/bin/ninja + host-ninja: $(DL_DIR)/$(HOST_NINJA_SOURCE) | $(HOST_DIR) $(REMOVE)/$(HOST_NINJA_DIR) $(UNTAR)/$(HOST_NINJA_SOURCE) $(CHDIR)/$(HOST_NINJA_DIR); \ - $(call apply_patches,$(HOST_NINJA_PATCH)); \ + $(APPLY_PATCHES); \ cmake . \ -DCMAKE_INSTALL_PREFIX="" \ ; \ $(MAKE) - $(INSTALL_EXEC) -D $(BUILD_DIR)/$(HOST_NINJA_DIR)/ninja $(HOST_DIR)/bin/ninja + $(INSTALL_EXEC) -D $(BUILD_DIR)/$(HOST_NINJA_DIR)/ninja $(HOST_NINJA) $(REMOVE)/$(HOST_NINJA_DIR) $(TOUCH) # ----------------------------------------------------------------------------- +HOST_EXPAT_VER = $(EXPAT_VER) +HOST_EXPAT_DIR = expat-$(EXPAT_VER) +HOST_EXPAT_SOURCE = expat-$(EXPAT_VER).tar.bz2 +HOST_EXPAT_SITE = https://sourceforge.net/projects/expat/files/expat/$(EXPAT_VER) + +#$(DL_DIR)/$(HOST_EXPAT_SOURCE): +# $(DOWNLOAD) $(HOST_EXPAT_SITE)/$(EXPAT_SOURCE) + +host-expat: $(DL_DIR)/$(HOST_EXPAT_SOURCE) | $(HOST_DIR) + $(REMOVE)/$(HOST_EXPAT_DIR) + $(UNTAR)/$(HOST_EXPAT_SOURCE) + $(CHDIR)/$(HOST_EXPAT_DIR); \ + ./configure \ + --prefix= \ + --without-docbook \ + ; \ + $(MAKE); \ + $(MAKE) install DESTDIR=$(HOST_DIR) + $(REMOVE)/$(HOST_EXPAT_DIR) + $(TOUCH) + +# ----------------------------------------------------------------------------- + +HOST_PYTHON3_VER = 3.9.0 +HOST_PYTHON3_DIR = Python-$(HOST_PYTHON3_VER) +HOST_PYTHON3_SOURCE = Python-$(HOST_PYTHON3_VER).tar.xz +HOST_PYTHON3_SITE = https://www.python.org/ftp/python/$(HOST_PYTHON3_VER) + +HOST_PYTHON3_BASE_DIR = lib/python$(basename $(HOST_PYTHON3_VER)) +HOST_PYTHON3_INCLUDE_DIR = include/python$(basename $(HOST_PYTHON3_VER)) + +$(DL_DIR)/$(HOST_PYTHON3_SOURCE): + $(DOWNLOAD) $(HOST_PYTHON3_SITE)/$(HOST_PYTHON3_SOURCE) + +HOST_PYTHON3_DEPS = host-expat + +host-python3: $(HOST_PYTHON3_DEPS) $(DL_DIR)/$(HOST_PYTHON3_SOURCE) | $(HOST_DIR) + $(REMOVE)/$(HOST_PYTHON3_DIR) + $(UNTAR)/$(HOST_PYTHON3_SOURCE) + $(CHDIR)/$(HOST_PYTHON3_DIR); \ + #$(APPLY_PATCHES); \ + autoconf; \ + CONFIG_SITE= \ + OPT="$(HOST_CFLAGS)" \ + ./configure \ + --prefix=$(HOST_DIR) \ + --without-ensurepip \ + --without-cxx-main \ + --disable-sqlite3 \ + --disable-tk \ + --with-expat=system \ + --disable-curses \ + --disable-codecs-cjk \ + --disable-nis \ + --enable-unicodedata \ + --disable-test-modules \ + --disable-idle3 \ + --disable-ossaudiodev \ + ; \ + $(MAKE); \ + $(MAKE) install + $(REMOVE)/$(HOST_PYTHON3_DIR) + $(TOUCH) + +# ----------------------------------------------------------------------------- + +HOST_PYTHON3-SETUPTOOLS_VER = 44.0.0 +HOST_PYTHON3-SETUPTOOLS_DIR = setuptools-$(HOST_PYTHON3-SETUPTOOLS_VER) +HOST_PYTHON3-SETUPTOOLS_SOURCE = setuptools-$(HOST_PYTHON3-SETUPTOOLS_VER).zip +HOST_PYTHON3-SETUPTOOLS_SITE = https://files.pythonhosted.org/packages/b0/f3/44da7482ac6da3f36f68e253cb04de37365b3dba9036a3c70773b778b485 + +$(DL_DIR)/$(HOST_PYTHON3-SETUPTOOLS_SOURCE): + $(DOWNLOAD) $(HOST_PYTHON3-SETUPTOOLS_SITE)/$(HOST_PYTHON3-SETUPTOOLS_SOURCE) + +HOST_PYTHON3-SETUPTOOLS_DEPS = host-python3 + +host-python3-setuptools: $(HOST_PYTHON3-SETUPTOOLS_DEPS) $(DL_DIR)/$(HOST_PYTHON3-SETUPTOOLS_SOURCE) | $(HOST_DIR) + $(REMOVE)/$(HOST_PYTHON3-SETUPTOOLS_DIR) + $(UNZIP)/$(HOST_PYTHON3-SETUPTOOLS_SOURCE) + $(CHDIR)/$(HOST_PYTHON3-SETUPTOOLS_DIR); \ + $(APPLY_PATCHES); \ + $(HOST_PYTHON_BUILD); \ + $(HOST_PYTHON_INSTALL) + $(REMOVE)/$(HOST_PYTHON3-SETUPTOOLS_DIR) + $(TOUCH) + +# ----------------------------------------------------------------------------- + +HOST_LIBFFI_VER = $(LIBFFI_VER) +HOST_LIBFFI_DIR = libffi-$(HOST_LIBFFI_VER) +HOST_LIBFFI_SOURCE = libffi-$(HOST_LIBFFI_VER).tar.gz +HOST_LIBFFI_SITE = $(call github,libffi,libffi,v$(HOST_LIBFFI_VER)) + +#$(DL_DIR)/$(HOST_LIBFFI_SOURCE): +# $(DOWNLOAD) $(HOST_LIBFFI_SITE)/$(HOST_LIBFFI_SOURCE) + +host-libffi: $(DL_DIR)/$(HOST_LIBFFI_SOURCE) | $(TARGET_DIR) + $(REMOVE)/$(HOST_LIBFFI_DIR) + $(UNTAR)/$(HOST_LIBFFI_SOURCE) + $(CHDIR)/$(HOST_LIBFFI_DIR); \ + ./configure \ + --prefix= \ + ; \ + $(MAKE); \ + $(MAKE) install DESTDIR=$(HOST_DIR) + $(REMOVE)/$(HOST_LIBFFI_DIR) + $(TOUCH) + +# ----------------------------------------------------------------------------- + HOST_LUA_VER = $(LUA_VER) HOST_LUA_DIR = lua-$(HOST_LUA_VER) HOST_LUA_SOURCE = lua-$(HOST_LUA_VER).tar.gz diff --git a/make/linux-kernel.mk b/make/linux-kernel.mk index 602ed492..b05f0d0f 100644 --- a/make/linux-kernel.mk +++ b/make/linux-kernel.mk @@ -250,12 +250,12 @@ kernel-coolstream: kernel-coolstream-$(BOXSERIES) $(TOUCH) kernel-coolstream-hd1: kernel.do_compile | $(IMAGE_DIR) - mkimage -A $(BOXARCH) -O linux -T kernel -C none -a 0x48000 -e 0x48000 -n "$(KERNEL_NAME)" -d $(KERNEL_UIMAGE) $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-uImage.img - mkimage -A $(BOXARCH) -O linux -T kernel -C none -a 0x48000 -e 0x48000 -n "$(KERNEL_NAME)" -d $(KERNEL_ZIMAGE) $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-zImage.img + mkimage -A $(TARGET_ARCH) -O linux -T kernel -C none -a 0x48000 -e 0x48000 -n "$(KERNEL_NAME)" -d $(KERNEL_UIMAGE) $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-uImage.img + mkimage -A $(TARGET_ARCH) -O linux -T kernel -C none -a 0x48000 -e 0x48000 -n "$(KERNEL_NAME)" -d $(KERNEL_ZIMAGE) $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-zImage.img $(TOUCH) kernel-coolstream-hd2: kernel.do_compile | $(IMAGE_DIR) - mkimage -A $(BOXARCH) -O linux -T kernel -C none -a 0x8000 -e 0x8000 -n "$(KERNEL_NAME)" -d $(KERNEL_ZIMAGE_DTB) $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-vmlinux.ub.gz + mkimage -A $(TARGET_ARCH) -O linux -T kernel -C none -a 0x8000 -e 0x8000 -n "$(KERNEL_NAME)" -d $(KERNEL_ZIMAGE_DTB) $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-vmlinux.ub.gz ifeq ($(BOXMODEL),$(filter $(BOXMODEL),apollo shiner)) ifeq ($(BOXMODEL),apollo) # create also shiner-kernel when building apollo diff --git a/make/neutrino.mk b/make/neutrino.mk index a5677ee7..c1d8f07d 100644 --- a/make/neutrino.mk +++ b/make/neutrino.mk @@ -49,12 +49,15 @@ NEUTRINO_CFLAGS += -Wno-psabi # ----------------------------------------------------------------------------- -NEUTRINO_LDFLAGS = -lcrypto -ldl -lz $(CORTEX-STRINGS_LDFLAG) -L$(TARGET_libdir) +NEUTRINO_LDFLAGS = $(CORTEX-STRINGS_LDFLAG) +NEUTRINO_LDFLAGS += -L$(TARGET_base_libdir) -L$(TARGET_libdir) +NEUTRINO_LDFLAGS += -Wl,-rpath,$(TARGET_libdir) -Wl,-rpath-link,$(TARGET_libdir) ifeq ($(DEBUG),yes) - NEUTRINO_LDFLAGS += -Wl,-rpath-link,$(TARGET_libdir) + NEUTRINO_LDFLAGS += -Wl,-O0 else - NEUTRINO_LDFLAGS += -Wl,-O1 -Wl,-rpath-link,$(TARGET_libdir) $(TARGET_EXTRA_LDFLAGS) + NEUTRINO_LDFLAGS += -Wl,-O1 $(TARGET_EXTRA_LDFLAGS) endif +NEUTRINO_LDFLAGS += -lcrypto -ldl -lz # ----------------------------------------------------------------------------- diff --git a/make/target-development.mk b/make/target-development.mk index eb851794..306ea65d 100644 --- a/make/target-development.mk +++ b/make/target-development.mk @@ -18,7 +18,7 @@ VALGRIND_SITE = ftp://sourceware.org/pub/valgrind $(DL_DIR)/$(VALGRIND_SOURCE): $(DOWNLOAD) $(VALGRIND_SITE)/$(VALGRIND_SOURCE) -VALGRIND_PATCH = valgrind-fix-build-$(TARGET_ARCH).patch +VALGRIND_PATCH = valgrind-fix-build-$(TARGET_CPU).patch valgrind3: $(DL_DIR)/$(VALGRIND_SOURCE) | $(TARGET_DIR) $(REMOVE)/$(VALGRIND_DIR) diff --git a/make/target-ffmpeg-coolstream.mk b/make/target-ffmpeg-coolstream.mk index 79a78989..30834a44 100644 --- a/make/target-ffmpeg-coolstream.mk +++ b/make/target-ffmpeg-coolstream.mk @@ -147,7 +147,7 @@ FFMPEG_CONFIGURE_GENERIC = \ --enable-shared \ \ --target-os=linux \ - --arch=$(BOXARCH) \ + --arch=$(TARGET_ARCH) \ --extra-ldflags="$(TARGET_LDFLAGS)" # ----------------------------------------------------------------------------- diff --git a/make/target-ffmpeg.mk b/make/target-ffmpeg.mk index ebee242f..3f947d48 100644 --- a/make/target-ffmpeg.mk +++ b/make/target-ffmpeg.mk @@ -324,17 +324,17 @@ FFMPEG_CONFIGURE_GENERIC = \ --enable-hardcoded-tables \ \ --target-os=linux \ - --arch=$(BOXARCH) \ + --arch=$(TARGET_ARCH) \ --extra-ldflags="$(TARGET_LDFLAGS)" # ----------------------------------------------------------------------------- -ifeq ($(BOXARCH),arm) +ifeq ($(TARGET_ARCH),arm) FFMPEG_CONFIGURE_PLATFORM = \ --cpu=cortex-a15 \ --extra-cflags="-Wno-deprecated-declarations -I$(TARGET_includedir) -mfpu=neon-vfpv4 -mfloat-abi=hard" -else ifeq ($(BOXARCH),mips) +else ifeq ($(TARGET_ARCH),mips) FFMPEG_CONFIGURE_PLATFORM = \ --cpu=generic \ --extra-cflags="-Wno-deprecated-declarations -I$(TARGET_includedir)" diff --git a/make/target-libs.mk b/make/target-libs.mk index 733827d3..be9cadda 100644 --- a/make/target-libs.mk +++ b/make/target-libs.mk @@ -312,9 +312,9 @@ $(DL_DIR)/$(OPENSSL_SOURCE): OPENSSL_PATCH = 0000-Configure-align-O-flag.patch -ifeq ($(BOXARCH),arm) +ifeq ($(TARGET_ARCH),arm) OPENSSL_ARCH = linux-armv4 -else ifeq ($(BOXARCH),mips) +else ifeq ($(TARGET_ARCH),mips) OPENSSL_ARCH = linux-generic32 endif @@ -402,7 +402,7 @@ ncurses: $(DL_DIR)/$(NCURSES_SOURCE) | $(TARGET_DIR) $(MAKE) libs; \ $(MAKE) install.libs DESTDIR=$(TARGET_DIR) rm -f $(addprefix $(TARGET_libdir)/,libform* libmenu* libpanel*) - rm -f $(addprefix $(PKG_CONFIG_PATH)/,form.pc menu.pc panel.pc) + rm -f $(addprefix $(TARGET_libdir)/pkgconfig/,form.pc menu.pc panel.pc) rm -f $(HOST_DIR)/bin/ncurses* mv $(TARGET_bindir)/ncurses6-config $(HOST_DIR)/bin $(REWRITE_CONFIG) $(HOST_DIR)/bin/ncurses6-config @@ -1094,7 +1094,7 @@ libvorbisidec: $(LIBVORBISIDEC_DEPS) $(DL_DIR)/$(LIBVORBISIDEC_SOURCE) | $(TARGE --prefix=$(prefix) \ ; \ $(MAKE); \ - $(MAKE) install DESTDIR=$(TARGET_DIR); \ + $(MAKE) install DESTDIR=$(TARGET_DIR) $(REWRITE_LIBTOOL_LA) $(REMOVE)/$(LIBVORBISIDEC_DIR) $(TOUCH) diff --git a/make/target-lua.mk b/make/target-lua.mk index 5c084528..a135a878 100644 --- a/make/target-lua.mk +++ b/make/target-lua.mk @@ -32,7 +32,7 @@ lua: $(LUA_DEPS) $(DL_DIR)/$(LUA_SOURCE) | $(TARGET_DIR) LDFLAGS="$(TARGET_LDFLAGS)" \ ; \ $(MAKE) install INSTALL_TOP=$(TARGET_prefix) INSTALL_MAN=$(TARGET_DIR)$(REMOVE_man1dir); \ - $(MAKE) pc INSTALL_TOP=$(TARGET_prefix) > $(PKG_CONFIG_PATH)/lua.pc + $(MAKE) pc INSTALL_TOP=$(TARGET_prefix) > $(TARGET_libdir)/pkgconfig/lua.pc rm -rf $(TARGET_bindir)/luac $(REMOVE)/$(LUA_DIR) $(TOUCH) diff --git a/make/target-rootfs.mk b/make/target-rootfs.mk index b4c7dc3c..f063d409 100644 --- a/make/target-rootfs.mk +++ b/make/target-rootfs.mk @@ -105,6 +105,7 @@ $(ROOTFS): | $(TARGET_DIR) rootfs-cleanup: $(ROOTFS) rm -rf $(ROOTFS)$(REMOVE_DIR) rm -rf $(ROOTFS)$(base_includedir) + rm -rf $(ROOTFS)$(base_libdir)/pkgconfig rm -rf $(ROOTFS)$(includedir) rm -rf $(ROOTFS)$(libdir)/pkgconfig rm -rf $(ROOTFS)$(libdir)/sigc++* diff --git a/patches/meson/0001-Prefer-ext-static-libs-when-default-library-static.patch b/patches/meson/0001-Prefer-ext-static-libs-when-default-library-static.patch new file mode 100644 index 00000000..26399158 --- /dev/null +++ b/patches/meson/0001-Prefer-ext-static-libs-when-default-library-static.patch @@ -0,0 +1,45 @@ +From ea85465e608178080c3b4d51af9765a8c7c0dae3 Mon Sep 17 00:00:00 2001 +From: Matt Weber +Date: Sat, 26 Oct 2019 09:17:29 -0500 +Subject: [PATCH] Prefer ext static libs when --default-library=static + +This patch adds a case in the library pattern logic to prefer static +libraries when the Meson Core option for "default_library" is set to +solely static. + +The existing library search order makes sense for cases of shared and +shared / static mixed. However if using a prebuilt cross-toolchain, +they usually provide both a static and shared version of sysroot +libraries. This presents a problem in a complete static build where +there won't be shared libraries at runtime and during build time there +are failures like "ld: attempted static link of dynamic object". + +Bug: +https://github.com/mesonbuild/meson/issues/6108 + +Fixes: +http://autobuild.buildroot.net/results/db1740b4777f436324218c52bc7b08e5c21b667d/ +http://autobuild.buildroot.net/results/c17/c17bbb12d9deadd64a441b36e324cfbbe8aba5be/ + +Signed-off-by: Matthew Weber +--- + mesonbuild/compilers/mixins/clike.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py +index 47e97d261..729c98acc 100644 +--- a/mesonbuild/compilers/mixins/clike.py ++++ b/mesonbuild/compilers/mixins/clike.py +@@ -940,6 +940,9 @@ class CLikeCompiler: + elif env.machines[self.for_machine].is_cygwin(): + shlibext = ['dll', 'dll.a'] + prefixes = ['cyg'] + prefixes ++ elif env.coredata.get_builtin_option('default_library') == 'static': ++ # Linux/BSDs ++ shlibext = ['a'] + else: + # Linux/BSDs + shlibext = ['so'] +-- +2.25.1 + diff --git a/patches/meson/0002-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch b/patches/meson/0002-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch new file mode 100644 index 00000000..eda17cad --- /dev/null +++ b/patches/meson/0002-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch @@ -0,0 +1,41 @@ +From 8622d37587169c1e4a4206a9462868ede057f0e8 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Sat, 15 Feb 2020 15:13:59 +0100 +Subject: [PATCH] mesonbuild/dependencies/base.py: add pkg_config_static + +Allow the user to always call pkg-config with --static thanks to a +pkg_config_static property. This will allow to fix static build failures +with libglib2: + +FAILED: gio/gio +/home/naourr/work/instance-0/output-1/host/bin/arm-linux-gcc -o gio/gio 'gio/6ae6c9e@@gio@exe/gio-tool.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-cat.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-copy.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-info.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-list.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-mime.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-mkdir.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-monitor.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-mount.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-move.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-open.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-rename.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-remove.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-save.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-set.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-trash.c.o' 'gio/6ae6c9e@@gio@exe/gio-tool-tree.c.o' -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -static -Wl,--start-group gio/libgio-2.0.a glib/libglib-2.0.a gobject/libgobject-2.0.a gmodule/libgmodule-2.0.a -pthread /home/naourr/work/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libz.a /home/naourr/work/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libmount.a /home/naourr/work/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libpcre.a -lm /home/naourr/work/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libffi.a -Wl,--end-group '-Wl,-rpath,$ORIGIN/:$ORIGIN/../glib:$ORIGIN/../gobject:$ORIGIN/../gmodule' -Wl,-rpath-link,/home/naourr/work/instance-0/output-1/build/libglib2-2.62.4/build/gio -Wl,-rpath-link,/home/naourr/work/instance-0/output-1/build/libglib2-2.62.4/build/glib -Wl,-rpath-link,/home/naourr/work/instance-0/output-1/build/libglib2-2.62.4/build/gobject -Wl,-rpath-link,/home/naourr/work/instance-0/output-1/build/libglib2-2.62.4/build/gmodule +/home/naourr/work/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/naourr/work/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libmount.a(la-fs.o): in function `__mnt_fs_set_source_ptr': +fs.c:(.text+0x5ec): undefined reference to `blkid_parse_tag_string' + +Fixes: + - http://autobuild.buildroot.org/results/0d36952def63cb69628697fa6408aeb6ce10cb5b + +Signed-off-by: Fabrice Fontaine +[Romain: Fix if condition, pkg_config_static is a string not a boolean] +Signed-off-by: Romain Naour +--- + mesonbuild/dependencies/base.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py +index 23701da95..83e51626d 100644 +--- a/mesonbuild/dependencies/base.py ++++ b/mesonbuild/dependencies/base.py +@@ -849,7 +849,8 @@ class PkgConfigDependency(ExternalDependency): + def _set_libs(self): + env = None + libcmd = [self.name, '--libs'] +- if self.static: ++ if self.static or \ ++ (self.env.properties[self.for_machine].get('pkg_config_static', None) == 'true'): + libcmd.append('--static') + # Force pkg-config to output -L fields even if they are system + # paths so we can do manual searching with cc.find_library() later. +-- +2.25.1 + diff --git a/patches/ninja/0001-set-minimum-cmake-version-to-3.10.patch b/patches/ninja/0001-set-minimum-cmake-version-to-3.10.patch new file mode 100644 index 00000000..d75b78fd --- /dev/null +++ b/patches/ninja/0001-set-minimum-cmake-version-to-3.10.patch @@ -0,0 +1,30 @@ +From 4645f74eb668cc1cf876d1e9bef933591da7575c Mon Sep 17 00:00:00 2001 +From: Adam Duskett +Date: Mon, 3 Feb 2020 06:21:57 -0800 +Subject: [PATCH] set minimum cmake version to 3.10 + +The CMakeLists.txt file uses the CMP0091 which is an MSVC runtime library flag +abstraction macro. + +Because we are not building ninja for Microsoft, it is safe to remove this +macro and set the minimum version to 3.10. + +Signed-off-by: Adam Duskett +--- + CMakeLists.txt | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 60fd8a1..a040e0b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,4 @@ +-cmake_minimum_required(VERSION 3.15) +-cmake_policy(SET CMP0091 NEW) ++cmake_minimum_required(VERSION 3.10) + project(ninja) + + if(CMAKE_BUILD_TYPE MATCHES "Release") +-- +2.24.1 + diff --git a/patches/ninja/0002-remove-fdiagnostics-color-from-make-command.patch b/patches/ninja/0002-remove-fdiagnostics-color-from-make-command.patch new file mode 100644 index 00000000..d419ab48 --- /dev/null +++ b/patches/ninja/0002-remove-fdiagnostics-color-from-make-command.patch @@ -0,0 +1,29 @@ +From 87caa8c4bc536f745aceed757ce8a492fbdba84f Mon Sep 17 00:00:00 2001 +From: Adam Duskett +Date: Mon, 3 Feb 2020 07:36:58 -0800 +Subject: [PATCH] remove fdiagnostics-color from make command + +-fdiagnostics-color was introduced in gcc 4.9 and the minimum supported version +that Buildroot supports is 4.8. + +Signed-off-by: Adam Duskett +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a040e0b..af8010f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -18,7 +18,7 @@ if(MSVC) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /GR- /Zc:__cplusplus") + else() +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -fdiagnostics-color") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated") + endif() + + find_program(RE2C re2c) +-- +2.24.1 + diff --git a/patches/ninja/0003-CMake-fix-object-library-usage.patch b/patches/ninja/0003-CMake-fix-object-library-usage.patch new file mode 100644 index 00000000..8f8fac99 --- /dev/null +++ b/patches/ninja/0003-CMake-fix-object-library-usage.patch @@ -0,0 +1,56 @@ +From 7982ecebe1c1c41e82779a65fa2d93f19ffd755f Mon Sep 17 00:00:00 2001 +From: Yegor Yefremov +Date: Wed, 5 Feb 2020 12:28:44 +0100 +Subject: [PATCH] CMake: fix object library usage + +Object libraries cannot be use in target_link_libraries() command +as they are no normal binary files like *.a or *.so but a collection +of object files. + +See add_library() definition for details. + +Signed-off-by: Yegor Yefremov +--- + CMakeLists.txt | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index af8010f..028a7bb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -83,8 +83,7 @@ target_compile_definitions(libninja PRIVATE _WIN32_WINNT=0x0601 __USE_MINGW_ANSI + endif() + + # Main executable is library plus main() function. +-add_executable(ninja src/ninja.cc) +-target_link_libraries(ninja PRIVATE libninja libninja-re2c) ++add_executable(ninja src/ninja.cc $ $) + + # Tests all build into ninja_test executable. + add_executable(ninja_test +@@ -106,11 +105,12 @@ add_executable(ninja_test + src/subprocess_test.cc + src/test.cc + src/util_test.cc ++ $ ++ $ + ) + if(WIN32) + target_sources(ninja_test PRIVATE src/includes_normalize_test.cc src/msvc_helper_test.cc) + endif() +-target_link_libraries(ninja_test PRIVATE libninja libninja-re2c) + + foreach(perftest + build_log_perftest +@@ -120,8 +120,7 @@ foreach(perftest + hash_collision_bench + manifest_parser_perftest + ) +- add_executable(${perftest} src/${perftest}.cc) +- target_link_libraries(${perftest} PRIVATE libninja libninja-re2c) ++ add_executable(${perftest} src/${perftest}.cc $ $) + endforeach() + + enable_testing() +-- +2.17.0 diff --git a/patches/python3-setuptools/0001-add-executable.patch b/patches/python3-setuptools/0001-add-executable.patch new file mode 100644 index 00000000..1de66c2c --- /dev/null +++ b/patches/python3-setuptools/0001-add-executable.patch @@ -0,0 +1,47 @@ +Add a new --executable option to distribute so that we can +force the shebang line in installed python scripts. + +--- a/setuptools/command/install.py ++++ b/setuptools/command/install.py +@@ -16,6 +16,7 @@ class install(orig.install): + """Use easy_install to install the package, w/dependencies""" + + user_options = orig.install.user_options + [ ++ ('executable=', 'e', "specify final destination interpreter path"), + ('old-and-unmanageable', None, "Try not to use this!"), + ('single-version-externally-managed', None, + "used by system package builders to create 'flat' eggs"), +@@ -31,6 +32,7 @@ class install(orig.install): + + def initialize_options(self): + orig.install.initialize_options(self) ++ self.executable = None + self.old_and_unmanageable = None + self.single_version_externally_managed = None + +--- a/setuptools/command/install_scripts.py ++++ b/setuptools/command/install_scripts.py +@@ -12,6 +12,13 @@ + def initialize_options(self): + orig.install_scripts.initialize_options(self) + self.no_ep = False ++ self.executable = None ++ ++ def finalize_options(self): ++ orig.install_scripts.finalize_options(self) ++ self.set_undefined_options('install', ++ ('executable','executable') ++ ) + + def run(self): + import setuptools.command.easy_install as ei +@@ -32,6 +39,8 @@ + ) + bs_cmd = self.get_finalized_command('build_scripts') + exec_param = getattr(bs_cmd, 'executable', None) ++ if self.executable is not None: ++ exec_param = self.executable + bw_cmd = self.get_finalized_command("bdist_wininst") + is_wininst = getattr(bw_cmd, '_is_running', False) + writer = ei.ScriptWriter + diff --git a/patches/python3-setuptools/0002-change-shebang-to-python3.patch b/patches/python3-setuptools/0002-change-shebang-to-python3.patch new file mode 100644 index 00000000..6dcf5277 --- /dev/null +++ b/patches/python3-setuptools/0002-change-shebang-to-python3.patch @@ -0,0 +1,25 @@ +From c39d0896930e25c224cc897660fc8511ccae30c8 Mon Sep 17 00:00:00 2001 +From: Changqing Li +Date: Thu, 23 Apr 2020 10:01:12 +0000 +Subject: [PATCH] change shebang to python3 + +Upstream-Status: Pending + +Signed-off-by: Changqing Li +--- + pkg_resources/_vendor/appdirs.py | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/pkg_resources/_vendor/appdirs.py b/pkg_resources/_vendor/appdirs.py +index ae67001..933e398 100644 +--- a/pkg_resources/_vendor/appdirs.py ++++ b/pkg_resources/_vendor/appdirs.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # -*- coding: utf-8 -*- + # Copyright (c) 2005-2010 ActiveState Software Inc. + # Copyright (c) 2013 Eddy Petrișor +-- +2.24.1 + diff --git a/patches/python3/0001-Make-the-build-of-pyc-files-conditional.patch b/patches/python3/0001-Make-the-build-of-pyc-files-conditional.patch new file mode 100644 index 00000000..5eb296c6 --- /dev/null +++ b/patches/python3/0001-Make-the-build-of-pyc-files-conditional.patch @@ -0,0 +1,56 @@ +From 322724e166d7ec0393aec577c12fdf6ef2b61e1d Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 16:21:31 -0800 +Subject: [PATCH] Make the build of pyc files conditional + +This commit adds a new configure option --disable-pyc-build to disable +the compilation of pyc. + +Signed-off-by: Thomas Petazzoni +[ Andrey Smrinov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 2 ++ + configure.ac | 6 ++++++ + 2 files changed, 8 insertions(+) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 77f91e72b1..0c809f3d8a 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1528,6 +1528,7 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c + $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ + $(DESTDIR)$(LIBDEST)/distutils/tests ; \ + fi ++ifeq (@PYC_BUILD@,yes) + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ + -j0 -d $(LIBDEST) -f \ +@@ -1555,6 +1556,7 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c + $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \ + -j0 -d $(LIBDEST)/site-packages -f \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages ++endif + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +diff --git a/configure.ac b/configure.ac +index d60f05251a..1ee5a09588 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1112,6 +1112,12 @@ fi + + AC_MSG_CHECKING(LDLIBRARY) + ++AC_SUBST(PYC_BUILD) ++ ++AC_ARG_ENABLE(pyc-build, ++ AS_HELP_STRING([--disable-pyc-build], [disable build of pyc files]), ++ [ PYC_BUILD="${enableval}" ], [ PYC_BUILD=yes ]) ++ + # MacOSX framework builds need more magic. LDLIBRARY is the dynamic + # library that we build, but we do not want to link against it (we + # will find it with a -framework option). For this reason there is an +-- +2.25.1 + diff --git a/patches/python3/0002-Disable-buggy_getaddrinfo-configure-test-when-cross-.patch b/patches/python3/0002-Disable-buggy_getaddrinfo-configure-test-when-cross-.patch new file mode 100644 index 00000000..c291d144 --- /dev/null +++ b/patches/python3/0002-Disable-buggy_getaddrinfo-configure-test-when-cross-.patch @@ -0,0 +1,27 @@ +From 72e20220f3a592b3ab9f440fbe74efa9f9e82d49 Mon Sep 17 00:00:00 2001 +From: Vanya Sergeev +Date: Wed, 23 Dec 2015 11:30:33 +0100 +Subject: [PATCH] Disable buggy_getaddrinfo configure test when cross-compiling + with IPv6 support + +Signed-off-by: Vanya Sergeev +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 1ee5a09588..c2445edc88 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -4175,7 +4175,7 @@ fi + + AC_MSG_RESULT($ac_cv_buggy_getaddrinfo) + +-if test $have_getaddrinfo = no || test "$ac_cv_buggy_getaddrinfo" = yes ++if test $have_getaddrinfo = no || test "$cross_compiling" != "yes" -a "$ac_cv_buggy_getaddrinfo" = yes + then + if test $ipv6 = yes + then +-- +2.25.1 + diff --git a/patches/python3/0003-Add-infrastructure-to-disable-the-build-of-certain-e.patch b/patches/python3/0003-Add-infrastructure-to-disable-the-build-of-certain-e.patch new file mode 100644 index 00000000..b0dcce7d --- /dev/null +++ b/patches/python3/0003-Add-infrastructure-to-disable-the-build-of-certain-e.patch @@ -0,0 +1,108 @@ +From df7c95b4ceecf390b961d843a556c470ac9080b2 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 16:33:22 -0800 +Subject: [PATCH] Add infrastructure to disable the build of certain extensions + +Some of the extensions part of the Python core have dependencies on +external libraries (sqlite, tk, etc.) or are relatively big and not +necessarly always useful (CJK codecs for example). By extensions, we +mean part of Python modules that are written in C and therefore +compiled to binary code. + +Therefore, we introduce a small infrastructure that allows to disable +some of those extensions. This can be done inside the configure.ac by +adding values to the DISABLED_EXTENSIONS variable (which is a +word-separated list of extensions). + +The implementation works as follow : + + * configure.ac defines a DISABLED_EXTENSIONS variable, which is + substituted (so that when Makefile.pre is generated from + Makefile.pre.in, the value of the variable is substituted). For + now, this DISABLED_EXTENSIONS variable is empty, later patches will + use it. + + * Makefile.pre.in passes the DISABLED_EXTENSIONS value down to the + variables passed in the environment when calling the setup.py + script that actually builds and installs those extensions. + + * setup.py is modified so that the existing "disabled_module_list" is + filled with those pre-disabled extensions listed in + DISABLED_EXTENSIONS. + +Patch ported to python2.7 by Maxime Ripard , and +then extended by Thomas Petazzoni +. + +Signed-off-by: Thomas Petazzoni +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 6 +++++- + configure.ac | 2 ++ + setup.py | 5 ++++- + 3 files changed, 11 insertions(+), 2 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 0c809f3d8a..7c3dde8dd4 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -213,6 +213,8 @@ FILEMODE= 644 + # configure script arguments + CONFIG_ARGS= @CONFIG_ARGS@ + ++# disabled extensions ++DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@ + + # Subdirectories with code + SRCDIRS= @SRCDIRS@ +@@ -629,6 +631,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o + esac; \ + echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ ++ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ + $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ +@@ -1674,7 +1677,8 @@ libainstall: @DEF_MAKE_RULE@ python-config + # Install the dynamically loadable modules + # This goes into $(exec_prefix) + sharedinstall: sharedmods +- $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ ++ $(RUNSHARED) DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \ ++ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ + --prefix=$(prefix) \ + --install-scripts=$(BINDIR) \ + --install-platlib=$(DESTSHARED) \ +diff --git a/configure.ac b/configure.ac +index c2445edc88..73d66167de 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3052,6 +3052,8 @@ LIBS="$withval $LIBS" + + PKG_PROG_PKG_CONFIG + ++AC_SUBST(DISABLED_EXTENSIONS) ++ + # Check for use of the system expat library + AC_MSG_CHECKING(for --with-system-expat) + AC_ARG_WITH(system_expat, +diff --git a/setup.py b/setup.py +index 770866bca7..b6c829b3a5 100644 +--- a/setup.py ++++ b/setup.py +@@ -43,7 +43,10 @@ from distutils.spawn import find_executable + TEST_EXTENSIONS = True + + # This global variable is used to hold the list of modules to be disabled. +-DISABLED_MODULE_LIST = [] ++try: ++ DISABLED_MODULE_LIST = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ") ++except KeyError: ++ DISABLED_MODULE_LIST = list() + + + def get_platform(): +-- +2.25.1 + diff --git a/patches/python3/0004-Adjust-library-header-paths-for-cross-compilation.patch b/patches/python3/0004-Adjust-library-header-paths-for-cross-compilation.patch new file mode 100644 index 00000000..24f369f8 --- /dev/null +++ b/patches/python3/0004-Adjust-library-header-paths-for-cross-compilation.patch @@ -0,0 +1,67 @@ +From 61af65485f1dade4aa08d0cf2b24082aeda24c51 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:33:14 +0100 +Subject: [PATCH] Adjust library/header paths for cross-compilation + +When cross-compiling third-party extensions, the get_python_inc() or +get_python_lib() can be called, to return the path to headers or +libraries. However, they use the sys.prefix of the host Python, which +returns incorrect paths when cross-compiling (paths pointing to host +headers and libraries). + +In order to fix this, we introduce the _python_sysroot, _python_prefix +and _python_exec_prefix variables, that allow to override these +values, and get correct header/library paths when cross-compiling +third-party Python modules. + +Signed-off-by: Thomas Petazzoni +--- + Lib/distutils/command/build_ext.py | 5 ++++- + Lib/distutils/sysconfig.py | 15 +++++++++++---- + 2 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py +index 1a9bd1200f..3cf7d6746e 100644 +--- a/Lib/distutils/command/build_ext.py ++++ b/Lib/distutils/command/build_ext.py +@@ -234,7 +234,10 @@ class build_ext(Command): + if (sysconfig.get_config_var('Py_ENABLE_SHARED')): + if not sysconfig.python_build: + # building third party extensions +- self.library_dirs.append(sysconfig.get_config_var('LIBDIR')) ++ libdir = sysconfig.get_config_var('LIBDIR') ++ if "_python_sysroot" in os.environ: ++ libdir = os.environ.get("_python_sysroot") + libdir ++ self.library_dirs.append(libdir) + else: + # building python standard extensions + self.library_dirs.append('.') +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index 37feae5df7..e9c3a27856 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -17,10 +17,17 @@ import sys + from .errors import DistutilsPlatformError + + # These are needed in a couple of spots, so just compute them once. +-PREFIX = os.path.normpath(sys.prefix) +-EXEC_PREFIX = os.path.normpath(sys.exec_prefix) +-BASE_PREFIX = os.path.normpath(sys.base_prefix) +-BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) ++if "_python_sysroot" in os.environ: ++ _sysroot=os.environ.get('_python_sysroot') ++ PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_prefix')) ++ EXEC_PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_exec_prefix')) ++ BASE_PREFIX = PREFIX ++ BASE_EXEC_PREFIX = EXEC_PREFIX ++else: ++ PREFIX = os.path.normpath(sys.prefix) ++ EXEC_PREFIX = os.path.normpath(sys.exec_prefix) ++ BASE_PREFIX = os.path.normpath(sys.base_prefix) ++ BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) + + # Path to the base directory of the project. On Windows the binary may + # live in project/PCbuild/win32 or project/PCbuild/amd64. +-- +2.25.1 + diff --git a/patches/python3/0005-Don-t-look-in-usr-lib-termcap-for-libraries.patch b/patches/python3/0005-Don-t-look-in-usr-lib-termcap-for-libraries.patch new file mode 100644 index 00000000..83c88ff3 --- /dev/null +++ b/patches/python3/0005-Don-t-look-in-usr-lib-termcap-for-libraries.patch @@ -0,0 +1,31 @@ +From 60d71e37d167ea89445250be436170a6cfee84e7 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:36:00 +0100 +Subject: [PATCH] Don't look in /usr/lib/termcap for libraries + +Signed-off-by: Thomas Petazzoni +--- + setup.py | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/setup.py b/setup.py +index b6c829b3a5..ec3ba60607 100644 +--- a/setup.py ++++ b/setup.py +@@ -1056,12 +1056,9 @@ class PyBuildExt(build_ext): + pass # Issue 7384: Already linked against curses or tinfo. + elif curses_library: + readline_libs.append(curses_library) +- elif self.compiler.find_library_file(self.lib_dirs + +- ['/usr/lib/termcap'], +- 'termcap'): ++ elif self.compiler.find_library_file(self.lib_dirs, 'termcap'): + readline_libs.append('termcap') + self.add(Extension('readline', ['readline.c'], +- library_dirs=['/usr/lib/termcap'], + extra_link_args=readline_extra_link_args, + libraries=readline_libs)) + else: +-- +2.25.1 + diff --git a/patches/python3/0006-Don-t-add-multiarch-paths.patch b/patches/python3/0006-Don-t-add-multiarch-paths.patch new file mode 100644 index 00000000..f55238d0 --- /dev/null +++ b/patches/python3/0006-Don-t-add-multiarch-paths.patch @@ -0,0 +1,37 @@ +From f5933b8f973cd11698b52d535a10d0474e49f5a5 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:36:27 +0100 +Subject: [PATCH] Don't add multiarch paths + +The add_multiarch_paths() function leads, in certain build +environments, to the addition of host header paths to the CFLAGS, +which is not appropriate for cross-compilation. This patch fixes that +by simply removing the call to add_multiarch_paths() when we're +cross-compiling. + +Investigation done by David . + +Signed-off-by: Thomas Petazzoni +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index ec3ba60607..e27620035c 100644 +--- a/setup.py ++++ b/setup.py +@@ -749,10 +749,10 @@ class PyBuildExt(build_ext): + 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') ++ self.add_multiarch_paths() + # 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): +-- +2.25.1 + diff --git a/patches/python3/0007-Abort-on-failed-module-build.patch b/patches/python3/0007-Abort-on-failed-module-build.patch new file mode 100644 index 00000000..0e96e752 --- /dev/null +++ b/patches/python3/0007-Abort-on-failed-module-build.patch @@ -0,0 +1,30 @@ +From 188c0ebfdb71f5252fa7701013b8d1209f28aef7 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:43:24 +0100 +Subject: [PATCH] Abort on failed module build + +When building a Python module fails, the setup.py script currently +doesn't exit with an error, and simply continues. This is not a really +nice behavior, so this patch changes setup.py to abort with an error, +so that the build issue is clearly noticeable. + +Signed-off-by: Thomas Petazzoni +--- + setup.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/setup.py b/setup.py +index e27620035c..d3f0e663f2 100644 +--- a/setup.py ++++ b/setup.py +@@ -539,6 +539,7 @@ class PyBuildExt(build_ext): + print("Failed to build these modules:") + print_three_column(failed) + print() ++ sys.exit(1) + + if self.failed_on_import: + failed = self.failed_on_import[:] +-- +2.25.1 + diff --git a/patches/python3/0008-Serial-ioctl-workaround.patch b/patches/python3/0008-Serial-ioctl-workaround.patch new file mode 100644 index 00000000..df31cd62 --- /dev/null +++ b/patches/python3/0008-Serial-ioctl-workaround.patch @@ -0,0 +1,33 @@ +From 9e6211b0d6d4610e5fb7d2c7e1152eb7c64d968b Mon Sep 17 00:00:00 2001 +From: Baruch Siach +Date: Wed, 23 Dec 2015 11:44:02 +0100 +Subject: [PATCH] Serial ioctl() workaround + +The ioctls.h of some architectures (notably xtensa) references structs from +linux/serial.h. Make sure to include this header as well. + +Also, undef TIOCTTYGSTRUCT that require reference to internal kernel tty_struct, +but isn't actually referenced in modern kernels. + +Signed-off-by: Baruch Siach +--- + Modules/termios.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Modules/termios.c b/Modules/termios.c +index 75e5e52320..eefbddfe69 100644 +--- a/Modules/termios.c ++++ b/Modules/termios.c +@@ -15,7 +15,9 @@ + #endif + + #include ++#include + #include ++#undef TIOCTTYGSTRUCT + + /* HP-UX requires that this be included to pick up MDCD, MCTS, MDSR, + * MDTR, MRI, and MRTS (apparently used internally by some things +-- +2.25.1 + diff --git a/patches/python3/0009-Do-not-adjust-the-shebang-of-Python-scripts-for-cros.patch b/patches/python3/0009-Do-not-adjust-the-shebang-of-Python-scripts-for-cros.patch new file mode 100644 index 00000000..8a77fe37 --- /dev/null +++ b/patches/python3/0009-Do-not-adjust-the-shebang-of-Python-scripts-for-cros.patch @@ -0,0 +1,35 @@ +From cb595a591c71e0bf7c63a3706b0be45ac6a642e3 Mon Sep 17 00:00:00 2001 +From: Christophe Vu-Brugier +Date: Wed, 23 Dec 2015 11:44:30 +0100 +Subject: [PATCH] Do not adjust the shebang of Python scripts for + cross-compilation + +The copy_scripts() method in distutils copies the scripts listed in +the setup file and adjusts the first line to refer to the current +Python interpreter. When cross-compiling, this means that the adjusted +shebang refers to the host Python interpreter. + +This patch modifies copy_scripts() to preserve the shebang when +cross-compilation is detected. + +Signed-off-by: Christophe Vu-Brugier +--- + Lib/distutils/command/build_scripts.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py +index ccc70e6465..d6d54195c1 100644 +--- a/Lib/distutils/command/build_scripts.py ++++ b/Lib/distutils/command/build_scripts.py +@@ -91,7 +91,7 @@ class build_scripts(Command): + adjust = True + post_interp = match.group(1) or b'' + +- if adjust: ++ if adjust and not '_python_sysroot' in os.environ: + log.info("copying and adjusting %s -> %s", script, + self.build_dir) + updated_files.append(outfile) +-- +2.25.1 + diff --git a/patches/python3/0010-Misc-python-config.sh.in-ensure-sed-invocations-only.patch b/patches/python3/0010-Misc-python-config.sh.in-ensure-sed-invocations-only.patch new file mode 100644 index 00000000..a1f9ab6c --- /dev/null +++ b/patches/python3/0010-Misc-python-config.sh.in-ensure-sed-invocations-only.patch @@ -0,0 +1,67 @@ +From eb51497e4b5799f8ab0277426d3e54414acb9d4b Mon Sep 17 00:00:00 2001 +From: Peter Korsgaard +Date: Thu, 20 Nov 2014 13:24:59 +0100 +Subject: [PATCH] Misc/python-config.sh.in: ensure sed invocations only match + beginning of strings + +The build/real prefix handling using sed breaks if build != real and the +standard include / lib directories are used ($prefix/include and $prefix/lib). + +E.G. + +prefix_build="/usr", libdir="$prefix/lib", includedir="$prefix/include". + +If this gets installed with make DESTDIR="/foo" install, then we end up with +prefix_real = prefix = "/foo/usr" as expected, but +includedir="/foo/foo/usr/include" and libdir="/foo/foo/usr/lib" because of +the double sed invocation (prefix is already expanded). Work around it by +ensuring we only match the beginning of the string. + +Submitted upstream: http://bugs.python.org/issue22907 + +Signed-off-by: Peter Korsgaard +--- + Misc/python-config.sh.in | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in +index 2602fe24c0..a1bc3cd5f7 100644 +--- a/Misc/python-config.sh.in ++++ b/Misc/python-config.sh.in +@@ -24,18 +24,19 @@ installed_prefix () + echo $RESULT + } + ++prefix_build="@prefix@" + prefix_real=$(installed_prefix "$0") + + # Use sed to fix paths from their built-to locations to their installed-to + # locations. Keep prefix & exec_prefix using their original values in case + # they are referenced in other configure variables, to prevent double + # substitution, issue #22140. +-prefix="@prefix@" +-exec_prefix="@exec_prefix@" ++prefix=$(echo "$prefix_build" | sed "s#^$prefix_build#$prefix_real#") ++exec_prefix=$(echo "$exec_prefix_build" | sed "s#^$exec_prefix_build#$prefix_real#") + exec_prefix_real=${prefix_real} +-includedir=$(echo "@includedir@" | sed "s#$prefix#$prefix_real#") +-libdir=$(echo "@libdir@" | sed "s#$prefix#$prefix_real#") +-CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix#$prefix_real#") ++includedir=$(echo "@includedir@" | sed "s#^$prefix_build#$prefix_real#") ++libdir=$(echo "@libdir@" | sed "s#^$prefix_build#$prefix_real#") ++CFLAGS=$(echo "@CFLAGS@" | sed "s#^$prefix_build#$prefix_real#") + VERSION="@VERSION@" + LIBM="@LIBM@" + LIBC="@LIBC@" +@@ -49,7 +50,7 @@ OPT="@OPT@" + PY_ENABLE_SHARED="@PY_ENABLE_SHARED@" + LDVERSION="@LDVERSION@" + LIBDEST=${prefix_real}/lib/python${VERSION} +-LIBPL=$(echo "@LIBPL@" | sed "s#$prefix#$prefix_real#") ++LIBPL=$(echo "@LIBPL@" | sed "s#^$prefix_build#$prefix_real#") + SO="@EXT_SUFFIX@" + PYTHONFRAMEWORK="@PYTHONFRAMEWORK@" + INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}" +-- +2.25.1 + diff --git a/patches/python3/0011-Override-system-locale-and-set-to-default-when-addin.patch b/patches/python3/0011-Override-system-locale-and-set-to-default-when-addin.patch new file mode 100644 index 00000000..57f1bb5a --- /dev/null +++ b/patches/python3/0011-Override-system-locale-and-set-to-default-when-addin.patch @@ -0,0 +1,39 @@ +From e4ae670e3489544a49dabd1618c32fe73504a7ba Mon Sep 17 00:00:00 2001 +From: Samuel Cabrero +Date: Wed, 23 Dec 2015 11:45:48 +0100 +Subject: [PATCH] Override system locale and set to default when adding gcc + paths + +Forces the use of the default locale in the function +add_gcc_paths, which is called when cross compiling to add the +include and library paths. This is necessary because otherwise +the gcc output is localized and the output parsing fails, which +results in no paths added and detect_modules not able to find +any system library (eg. libz, libssl, etc.) + +[Thomas: patch taken from https://bugs.python.org/issue23767.] + +Signed-off-by: Samuel Cabrero +Signed-off-by: Thomas Petazzoni +[james.hilliard1@gmail.com: adapt to python 3.9] +Signed-off-by: James Hilliard +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index d3f0e663f2..926c16f58f 100644 +--- a/setup.py ++++ b/setup.py +@@ -695,7 +695,7 @@ class PyBuildExt(build_ext): + tmpfile = os.path.join(self.build_temp, 'ccpaths') + if not os.path.exists(self.build_temp): + os.makedirs(self.build_temp) +- ret = run_command('%s -E -v - %s 1>/dev/null' % (cc, tmpfile)) ++ ret = run_command('LC_ALL=C %s -E -v - %s 1>/dev/null' % (cc, tmpfile)) + is_gcc = False + is_clang = False + in_incdirs = False +-- +2.25.1 + diff --git a/patches/python3/0012-Add-importlib-fix-for-PEP-3147-issue.patch b/patches/python3/0012-Add-importlib-fix-for-PEP-3147-issue.patch new file mode 100644 index 00000000..42dfa0d6 --- /dev/null +++ b/patches/python3/0012-Add-importlib-fix-for-PEP-3147-issue.patch @@ -0,0 +1,105 @@ +From e2ea659eac1849db471d3c01a0d0af9d6fca2e9a Mon Sep 17 00:00:00 2001 +From: Christophe Vu-Brugier +Date: Wed, 22 Feb 2017 16:48:49 -0800 +Subject: [PATCH] Add importlib fix for PEP 3147 issue + +Python 3 has a new standard for installing .pyc file, called PEP +3147. Unfortunately, this standard requires both the .py and .pyc +files to be installed for a Python module to be found. This is quite +annoying on space-constrained embedded systems, since the .py file is +technically not required for execution. + +This patch changes cache_from_source() and source_from_cache() in +importlib to get rid of the "__pycache__" directory. +This effectively disables PEP 3147 for: + +* The python standard library +* Packages built with distutils or setuptools +* Packages built with automake that use the `py-compile` helper + +Signed-off-by: Christophe Vu-Brugier +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Lib/importlib/_bootstrap_external.py | 44 ++++------------------------ + 1 file changed, 5 insertions(+), 39 deletions(-) + +diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py +index 25a3f8c0e0..2cb9a9aa52 100644 +--- a/Lib/importlib/_bootstrap_external.py ++++ b/Lib/importlib/_bootstrap_external.py +@@ -313,8 +313,6 @@ def cache_from_source(path, debug_override=None, *, optimization=None): + a True value is the same as setting 'optimization' to the empty string + while a False value is equivalent to setting 'optimization' to '1'. + +- If sys.implementation.cache_tag is None then NotImplementedError is raised. +- + """ + if debug_override is not None: + _warnings.warn('the debug_override parameter is deprecated; use ' +@@ -326,10 +324,7 @@ def cache_from_source(path, debug_override=None, *, optimization=None): + path = _os.fspath(path) + head, tail = _path_split(path) + base, sep, rest = tail.rpartition('.') +- tag = sys.implementation.cache_tag +- if tag is None: +- raise NotImplementedError('sys.implementation.cache_tag is None') +- almost_filename = ''.join([(base if base else rest), sep, tag]) ++ almost_filename = ''.join([(base if base else rest)]) + if optimization is None: + if sys.flags.optimize == 0: + optimization = '' +@@ -366,46 +361,17 @@ def cache_from_source(path, debug_override=None, *, optimization=None): + head.lstrip(path_separators), + filename, + ) +- return _path_join(head, _PYCACHE, filename) ++ return _path_join(head, filename) + + + def source_from_cache(path): + """Given the path to a .pyc. file, return the path to its .py file. + + The .pyc file does not need to exist; this simply returns the path to +- the .py file calculated to correspond to the .pyc file. If path does +- not conform to PEP 3147/488 format, ValueError will be raised. If +- sys.implementation.cache_tag is None then NotImplementedError is raised. +- ++ the .py file calculated to correspond to the .pyc file. + """ +- if sys.implementation.cache_tag is None: +- raise NotImplementedError('sys.implementation.cache_tag is None') +- path = _os.fspath(path) +- head, pycache_filename = _path_split(path) +- found_in_pycache_prefix = False +- if sys.pycache_prefix is not None: +- stripped_path = sys.pycache_prefix.rstrip(path_separators) +- if head.startswith(stripped_path + path_sep): +- head = head[len(stripped_path):] +- found_in_pycache_prefix = True +- if not found_in_pycache_prefix: +- head, pycache = _path_split(head) +- if pycache != _PYCACHE: +- raise ValueError(f'{_PYCACHE} not bottom-level directory in ' +- f'{path!r}') +- dot_count = pycache_filename.count('.') +- if dot_count not in {2, 3}: +- raise ValueError(f'expected only 2 or 3 dots in {pycache_filename!r}') +- elif dot_count == 3: +- optimization = pycache_filename.rsplit('.', 2)[-2] +- if not optimization.startswith(_OPT): +- raise ValueError("optimization portion of filename does not start " +- f"with {_OPT!r}") +- opt_level = optimization[len(_OPT):] +- if not opt_level.isalnum(): +- raise ValueError(f"optimization level {optimization!r} is not an " +- "alphanumeric value") +- base_filename = pycache_filename.partition('.')[0] ++ head, filename = _path_split(path) ++ base_filename = filename.partition('.')[0] + return _path_join(head, base_filename + SOURCE_SUFFIXES[0]) + + +-- +2.25.1 + diff --git a/patches/python3/0013-Add-an-option-to-disable-installation-of-test-module.patch b/patches/python3/0013-Add-an-option-to-disable-installation-of-test-module.patch new file mode 100644 index 00000000..b3380fd5 --- /dev/null +++ b/patches/python3/0013-Add-an-option-to-disable-installation-of-test-module.patch @@ -0,0 +1,117 @@ +From 0337342d413d13f437fd089de91faee70a8bf3f9 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:01:18 -0800 +Subject: [PATCH] Add an option to disable installation of test modules + +The Python standard distribution comes with many test modules, that +are not necessarly useful on embedded targets. + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +[james.hilliard1@gmail.com: adapt to python 3.9] +Signed-off-by: James Hilliard +--- + Makefile.pre.in | 56 ++++++++++++++++++++++++++++++++----------------- + configure.ac | 5 +++++ + 2 files changed, 42 insertions(+), 19 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 7c3dde8dd4..204f293d53 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1385,8 +1385,29 @@ maninstall: altmaninstall + + # Install the library + XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax +-LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \ +- tkinter/test/test_ttk site-packages test \ ++ ++LIBSUBDIRS= tkinter site-packages \ ++ asyncio \ ++ collections concurrent concurrent/futures encodings \ ++ email email/mime \ ++ ensurepip ensurepip/_bundled \ ++ html json http dbm xmlrpc \ ++ sqlite3 \ ++ logging csv wsgiref urllib \ ++ lib2to3 lib2to3/fixes lib2to3/pgen2 \ ++ ctypes ctypes/macholib \ ++ idlelib idlelib/Icons \ ++ distutils distutils/command $(XMLLIBSUBDIRS) \ ++ importlib \ ++ turtledemo \ ++ multiprocessing multiprocessing/dummy \ ++ unittest \ ++ venv venv/scripts venv/scripts/common venv/scripts/posix \ ++ curses pydoc_data \ ++ zoneinfo ++ ++TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \ ++ tkinter/test/test_ttk test \ + test/audiodata \ + test/capath test/data \ + test/cjkencodings test/decimaltestdata \ +@@ -1446,28 +1467,25 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \ + test/test_importlib/zipdata02 \ + test/test_zoneinfo test/test_zoneinfo/data \ + test/ziptestdata \ +- asyncio \ + test/test_asyncio \ +- collections concurrent concurrent/futures encodings \ +- email email/mime test/test_email test/test_email/data \ +- ensurepip ensurepip/_bundled \ +- html json test/test_json http dbm xmlrpc \ +- sqlite3 sqlite3/test \ +- logging csv wsgiref urllib \ +- lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \ ++ test/test_email test/test_email/data \ ++ test/test_json \ ++ sqlite3/test \ ++ lib2to3/tests \ + lib2to3/tests/data lib2to3/tests/data/fixers \ + lib2to3/tests/data/fixers/myfixes \ +- ctypes ctypes/test ctypes/macholib \ +- idlelib idlelib/Icons idlelib/idle_test \ +- distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \ ++ ctypes/test \ ++ idlelib/idle_test \ ++ distutils/tests \ + test/test_peg_generator \ ++ test/test_importlib test/test_importlib/builtin \ + test/test_tools test/test_warnings test/test_warnings/data \ +- turtledemo \ +- multiprocessing multiprocessing/dummy \ +- unittest unittest/test unittest/test/testmock \ +- venv venv/scripts venv/scripts/common venv/scripts/posix \ +- curses pydoc_data \ +- zoneinfo ++ unittest/test unittest/test/testmock ++ ++ifeq (@TEST_MODULES@,yes) ++LIBSUBDIRS += $(TESTSUBDIRS) ++endif ++ + libinstall: build_all $(srcdir)/Modules/xxmodule.c + @for i in $(SCRIPTDIR) $(LIBDEST); \ + do \ +diff --git a/configure.ac b/configure.ac +index 73d66167de..92e28d02ee 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3329,6 +3329,11 @@ if test "$posix_threads" = "yes"; then + AC_CHECK_FUNCS(pthread_getcpuclockid) + fi + ++AC_SUBST(TEST_MODULES) ++ ++AC_ARG_ENABLE(test-modules, ++ AS_HELP_STRING([--disable-test-modules], [disable test modules]), ++ [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ]) + + # Check for enable-ipv6 + AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) +-- +2.25.1 + diff --git a/patches/python3/0014-Add-an-option-to-disable-pydoc.patch b/patches/python3/0014-Add-an-option-to-disable-pydoc.patch new file mode 100644 index 00000000..abb86ea0 --- /dev/null +++ b/patches/python3/0014-Add-an-option-to-disable-pydoc.patch @@ -0,0 +1,99 @@ +From a65e5d3caf8e076d531191164c23c6240461f675 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:07:56 -0800 +Subject: [PATCH] Add an option to disable pydoc + +It removes 0.5 MB of data from the target plus the pydoc script +itself. + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 8 +++++++- + configure.ac | 6 ++++++ + setup.py | 9 +++++++-- + 3 files changed, 20 insertions(+), 3 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 204f293d53..63e3df0470 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1357,7 +1357,9 @@ bininstall: altbininstall + -rm -f $(DESTDIR)$(BINDIR)/idle3 + (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3) + -rm -f $(DESTDIR)$(BINDIR)/pydoc3 ++ifeq (@PYDOC@,yes) + (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) ++endif + -rm -f $(DESTDIR)$(BINDIR)/2to3 + (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3) + if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \ +@@ -1403,7 +1405,7 @@ LIBSUBDIRS= tkinter site-packages \ + multiprocessing multiprocessing/dummy \ + unittest \ + venv venv/scripts venv/scripts/common venv/scripts/posix \ +- curses pydoc_data \ ++ curses \ + zoneinfo + + TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \ +@@ -1486,6 +1488,10 @@ ifeq (@TEST_MODULES@,yes) + LIBSUBDIRS += $(TESTSUBDIRS) + endif + ++ifeq (@PYDOC@,yes) ++LIBSUBDIRS += pydoc_data ++endif ++ + libinstall: build_all $(srcdir)/Modules/xxmodule.c + @for i in $(SCRIPTDIR) $(LIBDEST); \ + do \ +diff --git a/configure.ac b/configure.ac +index 92e28d02ee..174ed85a7c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3329,6 +3329,12 @@ if test "$posix_threads" = "yes"; then + AC_CHECK_FUNCS(pthread_getcpuclockid) + fi + ++AC_SUBST(PYDOC) ++ ++AC_ARG_ENABLE(pydoc, ++ AS_HELP_STRING([--disable-pydoc], [disable pydoc]), ++ [ PYDOC="${enableval}" ], [ PYDOC=yes ]) ++ + AC_SUBST(TEST_MODULES) + + AC_ARG_ENABLE(test-modules, +diff --git a/setup.py b/setup.py +index 926c16f58f..1fc5fac90c 100644 +--- a/setup.py ++++ b/setup.py +@@ -2586,6 +2586,12 @@ def main(): + # turn off warnings when deprecated modules are imported + import warnings + warnings.filterwarnings("ignore",category=DeprecationWarning) ++ ++ scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3', ++ 'Lib/smtpd.py'] ++ if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"): ++ scripts += [ 'Tools/scripts/pydoc3' ] ++ + setup(# PyPI Metadata (PEP 301) + name = "Python", + version = sys.version.split()[0], +@@ -2610,8 +2616,7 @@ def main(): + # If you change the scripts installed here, you also need to + # check the PyBuildScripts command above, and change the links + # created by the bininstall target in Makefile.pre.in +- scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3", +- "Tools/scripts/2to3"] ++ scripts = scripts + ) + + # --install-platlib +-- +2.25.1 + diff --git a/patches/python3/0015-Add-an-option-to-disable-lib2to3.patch b/patches/python3/0015-Add-an-option-to-disable-lib2to3.patch new file mode 100644 index 00000000..5cec11a0 --- /dev/null +++ b/patches/python3/0015-Add-an-option-to-disable-lib2to3.patch @@ -0,0 +1,116 @@ +From f034b1b0f33a7bd4dde23f0bc1fa8e00e3518c9d Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:15:31 -0800 +Subject: [PATCH] Add an option to disable lib2to3 + +lib2to3 is a library to convert Python 2.x code to Python 3.x. As +such, it is probably not very useful on embedded system targets. + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 16 ++++++++++++---- + configure.ac | 6 ++++++ + setup.py | 5 +++-- + 3 files changed, 21 insertions(+), 6 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 63e3df0470..8b7de12999 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1361,7 +1361,9 @@ ifeq (@PYDOC@,yes) + (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) + endif + -rm -f $(DESTDIR)$(BINDIR)/2to3 ++ifeq (@LIB2TO3@,yes) + (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3) ++endif + if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \ + rm -f $(DESTDIR)$(BINDIR)/python3-32$(EXE); \ + (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-32$(EXE) python3-32$(EXE)) \ +@@ -1396,7 +1398,6 @@ LIBSUBDIRS= tkinter site-packages \ + html json http dbm xmlrpc \ + sqlite3 \ + logging csv wsgiref urllib \ +- lib2to3 lib2to3/fixes lib2to3/pgen2 \ + ctypes ctypes/macholib \ + idlelib idlelib/Icons \ + distutils distutils/command $(XMLLIBSUBDIRS) \ +@@ -1473,9 +1474,6 @@ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \ + test/test_email test/test_email/data \ + test/test_json \ + sqlite3/test \ +- lib2to3/tests \ +- lib2to3/tests/data lib2to3/tests/data/fixers \ +- lib2to3/tests/data/fixers/myfixes \ + ctypes/test \ + idlelib/idle_test \ + distutils/tests \ +@@ -1484,6 +1482,14 @@ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \ + test/test_tools test/test_warnings test/test_warnings/data \ + unittest/test unittest/test/testmock + ++ifeq (@LIB2TO3@,yes) ++LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2 ++TESTSUBDIRS += lib2to3/tests \ ++ lib2to3/tests/data \ ++ lib2to3/tests/data/fixers \ ++ lib2to3/tests/data/fixers/myfixes ++endif ++ + ifeq (@TEST_MODULES@,yes) + LIBSUBDIRS += $(TESTSUBDIRS) + endif +@@ -1584,10 +1590,12 @@ ifeq (@PYC_BUILD@,yes) + -j0 -d $(LIBDEST)/site-packages -f \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages + endif ++ifeq (@LIB2TO3@,yes) + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt ++endif + + # bpo-21536: Misc/python-config.sh is generated in the build directory + # from $(srcdir)Misc/python-config.sh.in. +diff --git a/configure.ac b/configure.ac +index 174ed85a7c..f1f5e9a7b0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3341,6 +3341,12 @@ AC_ARG_ENABLE(test-modules, + AS_HELP_STRING([--disable-test-modules], [disable test modules]), + [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ]) + ++AC_SUBST(LIB2TO3) ++ ++AC_ARG_ENABLE(lib2to3, ++ AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]), ++ [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ]) ++ + # Check for enable-ipv6 + AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) + AC_MSG_CHECKING([if --enable-ipv6 is specified]) +diff --git a/setup.py b/setup.py +index 1fc5fac90c..4063d7ffa5 100644 +--- a/setup.py ++++ b/setup.py +@@ -2587,10 +2587,11 @@ def main(): + import warnings + warnings.filterwarnings("ignore",category=DeprecationWarning) + +- scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3', +- 'Lib/smtpd.py'] ++ scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py'] + if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"): + scripts += [ 'Tools/scripts/pydoc3' ] ++ if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"): ++ scripts += [ 'Tools/scripts/2to3' ] + + setup(# PyPI Metadata (PEP 301) + name = "Python", +-- +2.25.1 + diff --git a/patches/python3/0016-Add-option-to-disable-the-sqlite3-module.patch b/patches/python3/0016-Add-option-to-disable-the-sqlite3-module.patch new file mode 100644 index 00000000..47ee112e --- /dev/null +++ b/patches/python3/0016-Add-option-to-disable-the-sqlite3-module.patch @@ -0,0 +1,69 @@ +From dd2722dec08eb9c72c36313e93661eeca3ad64d8 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:20:45 -0800 +Subject: [PATCH] Add option to disable the sqlite3 module + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 7 +++++-- + configure.ac | 9 +++++++++ + 2 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 8b7de12999..d826d8ac4b 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1396,7 +1396,6 @@ LIBSUBDIRS= tkinter site-packages \ + email email/mime \ + ensurepip ensurepip/_bundled \ + html json http dbm xmlrpc \ +- sqlite3 \ + logging csv wsgiref urllib \ + ctypes ctypes/macholib \ + idlelib idlelib/Icons \ +@@ -1473,7 +1472,6 @@ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \ + test/test_asyncio \ + test/test_email test/test_email/data \ + test/test_json \ +- sqlite3/test \ + ctypes/test \ + idlelib/idle_test \ + distutils/tests \ +@@ -1490,6 +1488,11 @@ TESTSUBDIRS += lib2to3/tests \ + lib2to3/tests/data/fixers/myfixes + endif + ++ifeq (@SQLITE3@,yes) ++LIBSUBDIRS += sqlite3 ++TESTSUBDIRS += sqlite3/test ++endif ++ + ifeq (@TEST_MODULES@,yes) + LIBSUBDIRS += $(TESTSUBDIRS) + endif +diff --git a/configure.ac b/configure.ac +index f1f5e9a7b0..8b5c65974c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3329,6 +3329,15 @@ if test "$posix_threads" = "yes"; then + AC_CHECK_FUNCS(pthread_getcpuclockid) + fi + ++AC_SUBST(SQLITE3) ++AC_ARG_ENABLE(sqlite3, ++ AS_HELP_STRING([--disable-sqlite3], [disable sqlite3]), ++ [ SQLITE3="${enableval}" ], [ SQLITE3=yes ]) ++ ++if test "$SQLITE3" = "no" ; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3" ++fi ++ + AC_SUBST(PYDOC) + + AC_ARG_ENABLE(pydoc, +-- +2.25.1 + diff --git a/patches/python3/0017-Add-an-option-to-disable-the-tk-module.patch b/patches/python3/0017-Add-an-option-to-disable-the-tk-module.patch new file mode 100644 index 00000000..132fd173 --- /dev/null +++ b/patches/python3/0017-Add-an-option-to-disable-the-tk-module.patch @@ -0,0 +1,73 @@ +From ad6b66b34f71ff6b60b3be5f6fd3e781cdeecd59 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:23:42 -0800 +Subject: [PATCH] Add an option to disable the tk module + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 11 ++++++++--- + configure.ac | 9 +++++++++ + 2 files changed, 17 insertions(+), 3 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index d826d8ac4b..dc84384680 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1390,7 +1390,7 @@ maninstall: altmaninstall + # Install the library + XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax + +-LIBSUBDIRS= tkinter site-packages \ ++LIBSUBDIRS= site-packages \ + asyncio \ + collections concurrent concurrent/futures encodings \ + email email/mime \ +@@ -1408,8 +1408,7 @@ LIBSUBDIRS= tkinter site-packages \ + curses \ + zoneinfo + +-TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \ +- tkinter/test/test_ttk test \ ++TESTSUBDIRS= test \ + test/audiodata \ + test/capath test/data \ + test/cjkencodings test/decimaltestdata \ +@@ -1480,6 +1479,12 @@ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \ + test/test_tools test/test_warnings test/test_warnings/data \ + unittest/test unittest/test/testmock + ++ifeq (@TK@,yes) ++LIBSUBDIRS += tkinter ++TESTSUBDIRS += tkinter/test tkinter/test/test_tkinter \ ++ tkinter/test/test_ttk ++endif ++ + ifeq (@LIB2TO3@,yes) + LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2 + TESTSUBDIRS += lib2to3/tests \ +diff --git a/configure.ac b/configure.ac +index 8b5c65974c..4c72dae960 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3338,6 +3338,15 @@ if test "$SQLITE3" = "no" ; then + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3" + fi + ++AC_SUBST(TK) ++AC_ARG_ENABLE(tk, ++ AS_HELP_STRING([--disable-tk], [disable tk]), ++ [ TK="${enableval}" ], [ TK=yes ]) ++ ++if test "$TK" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter" ++fi ++ + AC_SUBST(PYDOC) + + AC_ARG_ENABLE(pydoc, +-- +2.25.1 + diff --git a/patches/python3/0018-Add-an-option-to-disable-the-curses-module.patch b/patches/python3/0018-Add-an-option-to-disable-the-curses-module.patch new file mode 100644 index 00000000..d51267bb --- /dev/null +++ b/patches/python3/0018-Add-an-option-to-disable-the-curses-module.patch @@ -0,0 +1,60 @@ +From 962deb43f5f340a8472d432ae8e6d61186f9040e Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:31:51 -0800 +Subject: [PATCH] Add an option to disable the curses module + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 5 ++++- + configure.ac | 9 +++++++++ + 2 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index dc84384680..2a82f3308f 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1405,7 +1405,6 @@ LIBSUBDIRS= site-packages \ + multiprocessing multiprocessing/dummy \ + unittest \ + venv venv/scripts venv/scripts/common venv/scripts/posix \ +- curses \ + zoneinfo + + TESTSUBDIRS= test \ +@@ -1485,6 +1484,10 @@ TESTSUBDIRS += tkinter/test tkinter/test/test_tkinter \ + tkinter/test/test_ttk + endif + ++ifeq (@CURSES@,yes) ++LIBSUBDIRS += curses ++endif ++ + ifeq (@LIB2TO3@,yes) + LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2 + TESTSUBDIRS += lib2to3/tests \ +diff --git a/configure.ac b/configure.ac +index 4c72dae960..acd98381a3 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3347,6 +3347,15 @@ if test "$TK" = "no"; then + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter" + fi + ++AC_SUBST(CURSES) ++AC_ARG_ENABLE(curses, ++ AS_HELP_STRING([--disable-curses], [disable curses]), ++ [ CURSES="${enableval}" ], [ CURSES=yes ]) ++ ++if test "$CURSES" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _curses _curses_panel" ++fi ++ + AC_SUBST(PYDOC) + + AC_ARG_ENABLE(pydoc, +-- +2.25.1 + diff --git a/patches/python3/0019-Add-an-option-to-disable-expat.patch b/patches/python3/0019-Add-an-option-to-disable-expat.patch new file mode 100644 index 00000000..af6e1ebc --- /dev/null +++ b/patches/python3/0019-Add-an-option-to-disable-expat.patch @@ -0,0 +1,92 @@ +From 7e0e7dc25f50acd6922493ae620ee5cbf107a79a Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:40:45 -0800 +Subject: [PATCH] Add an option to disable expat + +This patch replaces the existing --with-system-expat option with a +--with-expat={system,builtin,none} option, which allows to tell Python +whether we want to use the system expat (already installed), the expat +builtin the Python sources, or no expat at all (which disables the +installation of XML modules). + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 6 +++++- + configure.ac | 18 +++++++++++++----- + setup.py | 2 +- + 3 files changed, 19 insertions(+), 7 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 2a82f3308f..e678c8817e 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1399,7 +1399,7 @@ LIBSUBDIRS= site-packages \ + logging csv wsgiref urllib \ + ctypes ctypes/macholib \ + idlelib idlelib/Icons \ +- distutils distutils/command $(XMLLIBSUBDIRS) \ ++ distutils distutils/command \ + importlib \ + turtledemo \ + multiprocessing multiprocessing/dummy \ +@@ -1488,6 +1488,10 @@ ifeq (@CURSES@,yes) + LIBSUBDIRS += curses + endif + ++ifeq (@EXPAT@,yes) ++LIBSUBDIRS += $(XMLLIBSUBDIRS) ++endif ++ + ifeq (@LIB2TO3@,yes) + LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2 + TESTSUBDIRS += lib2to3/tests \ +diff --git a/configure.ac b/configure.ac +index acd98381a3..9ef0ecd42f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3055,13 +3055,21 @@ PKG_PROG_PKG_CONFIG + AC_SUBST(DISABLED_EXTENSIONS) + + # Check for use of the system expat library +-AC_MSG_CHECKING(for --with-system-expat) +-AC_ARG_WITH(system_expat, +- AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library, see Doc/library/pyexpat.rst (default is no)]), ++AC_MSG_CHECKING(for --with-expat) ++AC_ARG_WITH(expat, ++ AS_HELP_STRING([--with-expat], [select which expat version to use: system, builtin, none]), + [], +- [with_system_expat="no"]) ++ [with_expat="builtin"]) + +-AC_MSG_RESULT($with_system_expat) ++AC_MSG_RESULT($with_expat) ++ ++if test "$with_expat" != "none"; then ++ EXPAT=yes ++else ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} pyexpat" ++ EXPAT=no ++fi ++AC_SUBST(EXPAT) + + # Check for use of the system libffi library + AC_MSG_CHECKING(for --with-system-ffi) +diff --git a/setup.py b/setup.py +index 4063d7ffa5..211a160f29 100644 +--- a/setup.py ++++ b/setup.py +@@ -1681,7 +1681,7 @@ class PyBuildExt(build_ext): + # + # More information on Expat can be found at www.libexpat.org. + # +- if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"): ++ if '--with-expat=system' in sysconfig.get_config_var("CONFIG_ARGS"): + expat_inc = [] + define_macros = [] + extra_compile_args = [] +-- +2.25.1 + diff --git a/patches/python3/0020-Add-an-option-to-disable-CJK-codecs.patch b/patches/python3/0020-Add-an-option-to-disable-CJK-codecs.patch new file mode 100644 index 00000000..ede78c9b --- /dev/null +++ b/patches/python3/0020-Add-an-option-to-disable-CJK-codecs.patch @@ -0,0 +1,30 @@ +From 2c0d31bb91fc7f94283c3ab632925fbbe24e94d6 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:49:55 +0100 +Subject: [PATCH] Add an option to disable CJK codecs + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 9ef0ecd42f..18e6fd70a0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3346,6 +3346,12 @@ if test "$SQLITE3" = "no" ; then + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3" + fi + ++AC_ARG_ENABLE(codecs-cjk, ++ AS_HELP_STRING([--disable-codecs-cjk], [disable CJK codecs]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk _codecs_iso2022" ++ fi]) ++ + AC_SUBST(TK) + AC_ARG_ENABLE(tk, + AS_HELP_STRING([--disable-tk], [disable tk]), +-- +2.25.1 + diff --git a/patches/python3/0021-Add-an-option-to-disable-NIS.patch b/patches/python3/0021-Add-an-option-to-disable-NIS.patch new file mode 100644 index 00000000..b2668c6e --- /dev/null +++ b/patches/python3/0021-Add-an-option-to-disable-NIS.patch @@ -0,0 +1,33 @@ +From 2041d0c8dba87991edaf088b16e37b5189a3466d Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:50:11 +0100 +Subject: [PATCH] Add an option to disable NIS + +NIS is not necessarily available in uClibc, so we need an option to +not compile support for it. + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 18e6fd70a0..46d2a8131e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3352,6 +3352,12 @@ AC_ARG_ENABLE(codecs-cjk, + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk _codecs_iso2022" + fi]) + ++AC_ARG_ENABLE(nis, ++ AS_HELP_STRING([--disable-nis], [disable NIS]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis" ++ fi]) ++ + AC_SUBST(TK) + AC_ARG_ENABLE(tk, + AS_HELP_STRING([--disable-tk], [disable tk]), +-- +2.25.1 + diff --git a/patches/python3/0022-Add-an-option-to-disable-unicodedata.patch b/patches/python3/0022-Add-an-option-to-disable-unicodedata.patch new file mode 100644 index 00000000..7a0157fd --- /dev/null +++ b/patches/python3/0022-Add-an-option-to-disable-unicodedata.patch @@ -0,0 +1,30 @@ +From dd82a401ff6ba4ba116bf4d520e981a1808ed443 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:50:27 +0100 +Subject: [PATCH] Add an option to disable unicodedata + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 46d2a8131e..5844e3b73f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3358,6 +3358,12 @@ AC_ARG_ENABLE(nis, + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis" + fi]) + ++AC_ARG_ENABLE(unicodedata, ++ AS_HELP_STRING([--disable-unicodedata], [disable unicodedata]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} unicodedata" ++ fi]) ++ + AC_SUBST(TK) + AC_ARG_ENABLE(tk, + AS_HELP_STRING([--disable-tk], [disable tk]), +-- +2.25.1 + diff --git a/patches/python3/0023-Add-an-option-to-disable-IDLE.patch b/patches/python3/0023-Add-an-option-to-disable-IDLE.patch new file mode 100644 index 00000000..0611e3a3 --- /dev/null +++ b/patches/python3/0023-Add-an-option-to-disable-IDLE.patch @@ -0,0 +1,89 @@ +From f1b15834045d0641c43014b970721df066fa71f7 Mon Sep 17 00:00:00 2001 +From: Maxime Ripard +Date: Wed, 22 Feb 2017 17:45:14 -0800 +Subject: [PATCH] Add an option to disable IDLE + +IDLE is an IDE embedded into python, written using Tk, so it doesn't make +much sense to have it into our build. + +Signed-off-by: Maxime Ripard +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 7 ++++++- + configure.ac | 6 ++++++ + setup.py | 4 +++- + 3 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index e678c8817e..1148bd8708 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1355,7 +1355,9 @@ bininstall: altbininstall + -rm -f $(DESTDIR)$(LIBPC)/python3-embed.pc + (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python3-embed.pc) + -rm -f $(DESTDIR)$(BINDIR)/idle3 ++ifeq (@IDLE@,yes) + (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3) ++endif + -rm -f $(DESTDIR)$(BINDIR)/pydoc3 + ifeq (@PYDOC@,yes) + (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) +@@ -1398,7 +1400,6 @@ LIBSUBDIRS= site-packages \ + html json http dbm xmlrpc \ + logging csv wsgiref urllib \ + ctypes ctypes/macholib \ +- idlelib idlelib/Icons \ + distutils distutils/command \ + importlib \ + turtledemo \ +@@ -1492,6 +1493,10 @@ ifeq (@EXPAT@,yes) + LIBSUBDIRS += $(XMLLIBSUBDIRS) + endif + ++ifeq (@IDLE@,yes) ++LIBSUBDIRS += idlelib idlelib/Icons ++endif ++ + ifeq (@LIB2TO3@,yes) + LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2 + TESTSUBDIRS += lib2to3/tests \ +diff --git a/configure.ac b/configure.ac +index 5844e3b73f..7bd4623ccd 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3400,6 +3400,12 @@ AC_ARG_ENABLE(lib2to3, + AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]), + [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ]) + ++AC_SUBST(IDLE) ++ ++AC_ARG_ENABLE(idle3, ++ AS_HELP_STRING([--disable-idle3], [disable idle3 IDE]), ++ [ IDLE="${enableval}" ], [ IDLE=yes ]) ++ + # Check for enable-ipv6 + AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) + AC_MSG_CHECKING([if --enable-ipv6 is specified]) +diff --git a/setup.py b/setup.py +index 211a160f29..c4ee989ba3 100644 +--- a/setup.py ++++ b/setup.py +@@ -2587,11 +2587,13 @@ def main(): + import warnings + warnings.filterwarnings("ignore",category=DeprecationWarning) + +- scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py'] ++ scripts = [ 'Lib/smtpd.py'] + if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"): + scripts += [ 'Tools/scripts/pydoc3' ] + if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"): + scripts += [ 'Tools/scripts/2to3' ] ++ if not '--disable-idle3' in sysconfig.get_config_var("CONFIG_ARGS"): ++ scripts += [ 'Tools/scripts/idle3' ] + + setup(# PyPI Metadata (PEP 301) + name = "Python", +-- +2.25.1 + diff --git a/patches/python3/0024-Add-an-option-to-disable-decimal.patch b/patches/python3/0024-Add-an-option-to-disable-decimal.patch new file mode 100644 index 00000000..438b76b9 --- /dev/null +++ b/patches/python3/0024-Add-an-option-to-disable-decimal.patch @@ -0,0 +1,66 @@ +From d5fe81cbd51da2a84ed89d1e4c80d921d4efce26 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:51:31 +0100 +Subject: [PATCH] Add an option to disable decimal + +This patch replaces the existing --with-system-libmpdec option with a +--with-libmpdec={system,builtin,none} option, which allows to tell +Python whether we want to use the system libmpdec (already installed), +the libmpdec builtin the Python sources, or no libmpdec at all. + +Signed-off-by: Thomas Petazzoni +[aduskett@gmail.com: Update for python 3.7.0] +Signed-off-by: Adam Duskett +[james.hilliard1@gmail.com: adapt to python 3.9] +Signed-off-by: James Hilliard +--- + configure.ac | 17 ++++++++++++----- + setup.py | 2 +- + 2 files changed, 13 insertions(+), 6 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 7bd4623ccd..e513ef6a20 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3106,13 +3106,20 @@ fi + AC_SUBST(LIBFFI_INCLUDEDIR) + + # Check for use of the system libmpdec library +-AC_MSG_CHECKING(for --with-system-libmpdec) +-AC_ARG_WITH(system_libmpdec, +- AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library, see Doc/library/decimal.rst (default is no)]), ++AC_MSG_CHECKING(for --with-libmpdec) ++AC_ARG_WITH(libmpdec, ++ AS_HELP_STRING([--with-libmpdec], [select which libmpdec version to use: system, builtin, none]), + [], +- [with_system_libmpdec="no"]) ++ [with_libmpdec="builtin"]) + +-AC_MSG_RESULT($with_system_libmpdec) ++AC_MSG_RESULT($with_libmpdec) ++if test "$with_libmpdec" != "none"; then ++ MPDEC=yes ++else ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _decimal" ++ MPDEC=no ++fi ++AC_SUBST(MPDEC) + + # Check whether _decimal should use a coroutine-local or thread-local context + AC_MSG_CHECKING(for --with-decimal-contextvar) +diff --git a/setup.py b/setup.py +index c4ee989ba3..3d0c74bb7f 100644 +--- a/setup.py ++++ b/setup.py +@@ -2221,7 +2221,7 @@ class PyBuildExt(build_ext): + # Stefan Krah's _decimal module + extra_compile_args = [] + undef_macros = [] +- if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"): ++ if '--with-libmpdec=system' in sysconfig.get_config_var("CONFIG_ARGS"): + include_dirs = [] + libraries = [':libmpdec.so.2'] + sources = ['_decimal/_decimal.c'] +-- +2.25.1 + diff --git a/patches/python3/0025-Add-an-option-to-disable-the-ossaudiodev-module.patch b/patches/python3/0025-Add-an-option-to-disable-the-ossaudiodev-module.patch new file mode 100644 index 00000000..8a792c1f --- /dev/null +++ b/patches/python3/0025-Add-an-option-to-disable-the-ossaudiodev-module.patch @@ -0,0 +1,30 @@ +From 9bedc56d2a4b8856162650a11c1fcb6ec38f160b Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:51:58 +0100 +Subject: [PATCH] Add an option to disable the ossaudiodev module + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/configure.ac b/configure.ac +index e513ef6a20..c07505e89e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3136,6 +3136,12 @@ fi + + AC_MSG_RESULT($with_decimal_contextvar) + ++AC_ARG_ENABLE(ossaudiodev, ++ AS_HELP_STRING([--disable-ossaudiodev], [disable OSSAUDIODEV]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ossaudiodev" ++ fi]) ++ + # Check for support for loadable sqlite extensions + AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions) + AC_ARG_ENABLE(loadable-sqlite-extensions, +-- +2.25.1 + diff --git a/patches/python3/0026-Add-an-option-to-disable-openssl-support.patch b/patches/python3/0026-Add-an-option-to-disable-openssl-support.patch new file mode 100644 index 00000000..d9e9d13f --- /dev/null +++ b/patches/python3/0026-Add-an-option-to-disable-openssl-support.patch @@ -0,0 +1,30 @@ +From 90ed5c692b8b5596ca0b3ae1436276c8181251d8 Mon Sep 17 00:00:00 2001 +From: Nicolas Cavallari +Date: Wed, 22 Feb 2017 17:55:59 -0800 +Subject: [PATCH] Add an option to disable openssl support. + +Signed-off-by: Nicolas Cavallari +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/configure.ac b/configure.ac +index c07505e89e..612e32faf5 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3377,6 +3377,12 @@ AC_ARG_ENABLE(unicodedata, + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} unicodedata" + fi]) + ++AC_ARG_ENABLE(openssl, ++ AS_HELP_STRING([--disable-openssl], [disable openssl support]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ssl _ssl _hashlib" ++ fi]) ++ + AC_SUBST(TK) + AC_ARG_ENABLE(tk, + AS_HELP_STRING([--disable-tk], [disable tk]), +-- +2.25.1 + diff --git a/patches/python3/0027-Add-an-option-to-disable-the-readline-module.patch b/patches/python3/0027-Add-an-option-to-disable-the-readline-module.patch new file mode 100644 index 00000000..2324ffdc --- /dev/null +++ b/patches/python3/0027-Add-an-option-to-disable-the-readline-module.patch @@ -0,0 +1,30 @@ +From 049e7a51e1ffd0d28d6608c707ab4b54e816d338 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Tue, 7 Mar 2017 23:29:05 +0100 +Subject: [PATCH] Add an option to disable the readline module + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 612e32faf5..2a6aaeff60 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3383,6 +3383,12 @@ AC_ARG_ENABLE(openssl, + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ssl _ssl _hashlib" + fi]) + ++AC_ARG_ENABLE(readline, ++ AS_HELP_STRING([--disable-readline], [disable readline]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} readline" ++ fi]) ++ + AC_SUBST(TK) + AC_ARG_ENABLE(tk, + AS_HELP_STRING([--disable-tk], [disable tk]), +-- +2.25.1 + diff --git a/patches/python3/0028-Add-options-to-disable-zlib-bzip2-and-xz-modules.patch b/patches/python3/0028-Add-options-to-disable-zlib-bzip2-and-xz-modules.patch new file mode 100644 index 00000000..04d0ab31 --- /dev/null +++ b/patches/python3/0028-Add-options-to-disable-zlib-bzip2-and-xz-modules.patch @@ -0,0 +1,42 @@ +From 146730a04dfe98e3d7971ebf5410801ceae88e11 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Tue, 7 Mar 2017 23:31:11 +0100 +Subject: [PATCH] Add options to disable zlib, bzip2 and xz modules + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 2a6aaeff60..21479bbd7d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3389,6 +3389,24 @@ AC_ARG_ENABLE(readline, + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} readline" + fi]) + ++AC_ARG_ENABLE(bzip2, ++ AS_HELP_STRING([--disable-bzip2], [disable bzip2]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _bz2" ++ fi]) ++ ++AC_ARG_ENABLE(zlib, ++ AS_HELP_STRING([--disable-zlib], [disable zlib]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} zlib" ++ fi]) ++ ++AC_ARG_ENABLE(xz, ++ AS_HELP_STRING([--disable-xz], [disable xz]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _lzma" ++ fi]) ++ + AC_SUBST(TK) + AC_ARG_ENABLE(tk, + AS_HELP_STRING([--disable-tk], [disable tk]), +-- +2.25.1 + diff --git a/patches/python3/0029-python-config.sh-don-t-reassign-prefix.patch b/patches/python3/0029-python-config.sh-don-t-reassign-prefix.patch new file mode 100644 index 00000000..4478b401 --- /dev/null +++ b/patches/python3/0029-python-config.sh-don-t-reassign-prefix.patch @@ -0,0 +1,53 @@ +From 106d9378c61e7fa9cad0a63ba068668d54cd11b8 Mon Sep 17 00:00:00 2001 +From: Matt Weber +Date: Fri, 6 Oct 2017 09:54:15 -0500 +Subject: [PATCH] python-config.sh: don't reassign ${prefix} + +When prefix is set to a path like /usr during crossbuild +the sed operations end up executing twice, once for the prefix +reassignment and another for includedir if it is set as a string +including the ${prefix} variable. This results in an issue +when the build directory is under /usr. + +This patch updates the remaining location which uses the prefix +variable to also sed and update to use the real path. + +Upstream bug report: +https://bugs.python.org/issue31713 + +Buildroot bug: +https://bugs.busybox.net/show_bug.cgi?id=10361 + +Fixes failures like the following: +dbus-python-1.2.4 | NOK | http://autobuild.buildroot.net/results/758858efa97b6273c1b470513f5492258a6d8853 + +Signed-off-by: Matthew Weber +--- + Misc/python-config.sh.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in +index a1bc3cd5f7..164d2d3603 100644 +--- a/Misc/python-config.sh.in ++++ b/Misc/python-config.sh.in +@@ -31,7 +31,7 @@ prefix_real=$(installed_prefix "$0") + # locations. Keep prefix & exec_prefix using their original values in case + # they are referenced in other configure variables, to prevent double + # substitution, issue #22140. +-prefix=$(echo "$prefix_build" | sed "s#^$prefix_build#$prefix_real#") ++prefix=$prefix_build + exec_prefix=$(echo "$exec_prefix_build" | sed "s#^$exec_prefix_build#$prefix_real#") + exec_prefix_real=${prefix_real} + includedir=$(echo "@includedir@" | sed "s#^$prefix_build#$prefix_real#") +@@ -49,7 +49,7 @@ LDLIBRARY="@LDLIBRARY@" + OPT="@OPT@" + PY_ENABLE_SHARED="@PY_ENABLE_SHARED@" + LDVERSION="@LDVERSION@" +-LIBDEST=${prefix_real}/lib/python${VERSION} ++LIBDEST=$( echo "${prefix}/lib/python${VERSION}" | sed "s#^$prefix_build#$prefix_real#") + LIBPL=$(echo "@LIBPL@" | sed "s#^$prefix_build#$prefix_real#") + SO="@EXT_SUFFIX@" + PYTHONFRAMEWORK="@PYTHONFRAMEWORK@" +-- +2.25.1 + diff --git a/patches/python3/0030-Fix-cross-compiling-the-uuid-module.patch b/patches/python3/0030-Fix-cross-compiling-the-uuid-module.patch new file mode 100644 index 00000000..806801b2 --- /dev/null +++ b/patches/python3/0030-Fix-cross-compiling-the-uuid-module.patch @@ -0,0 +1,38 @@ +From d7b90b157eddefbd0ed59e35c90b083c0c03b644 Mon Sep 17 00:00:00 2001 +From: Adam Duskett +Date: Fri, 20 Jul 2018 10:17:39 -0400 +Subject: [PATCH] Fix cross compiling the uuid module + +Python 3.7 has a new _uuid module, however, the include directory +search path for uuid.h is hardcoded to /usr/include/uuid, which should +not be used when cross-compiling. + +To fix this, use the same solution as the one used by the NIS +detection: append "uuid" to each of the include directories in +"inc_dirs", instead of hardcoding /usr/include/uuid. + +Signed-off-by: Adam Duskett +[Thomas: drop STAGING_DIR based solution, use a solution similar to +the one used for the NIS detection.] +Signed-off-by: Thomas Petazzoni +--- + setup.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 3d0c74bb7f..c7be85f352 100644 +--- a/setup.py ++++ b/setup.py +@@ -1779,7 +1779,8 @@ class PyBuildExt(build_ext): + + def detect_uuid(self): + # Build the _uuid module if possible +- uuid_incs = find_file("uuid.h", self.inc_dirs, ["/usr/include/uuid"]) ++ uuid_incs = find_file("uuid.h", self.inc_dirs, ++ [os.path.join(inc_dir, 'uuid') for inc_dir in self.inc_dirs]) + if uuid_incs is not None: + if self.compiler.find_library_file(self.lib_dirs, 'uuid'): + uuid_libs = ['uuid'] +-- +2.25.1 + diff --git a/patches/python3/0031-Add-an-option-to-disable-uuid-module.patch b/patches/python3/0031-Add-an-option-to-disable-uuid-module.patch new file mode 100644 index 00000000..6ea57d2c --- /dev/null +++ b/patches/python3/0031-Add-an-option-to-disable-uuid-module.patch @@ -0,0 +1,33 @@ +From 3bb693408eda77dda145ec5fecee56ea73031e9f Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sat, 18 Aug 2018 10:54:56 +0200 +Subject: [PATCH] Add an option to disable uuid module + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 21479bbd7d..615c16aced 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3425,6 +3425,15 @@ if test "$CURSES" = "no"; then + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _curses _curses_panel" + fi + ++AC_SUBST(UUID) ++AC_ARG_ENABLE(uuid, ++ AS_HELP_STRING([--disable-uuid], [disable uuid]), ++ [ UUID="${enableval}" ], [ UUID=yes ]) ++ ++if test "$UUID" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _uuid" ++fi ++ + AC_SUBST(PYDOC) + + AC_ARG_ENABLE(pydoc, +-- +2.25.1 + diff --git a/patches/python3/0032-fix-building-on-older-distributions.patch b/patches/python3/0032-fix-building-on-older-distributions.patch new file mode 100644 index 00000000..fb59e593 --- /dev/null +++ b/patches/python3/0032-fix-building-on-older-distributions.patch @@ -0,0 +1,38 @@ +From 94c62f96ca61f1a28124c837d7ec5ed0b9ae8786 Mon Sep 17 00:00:00 2001 +From: Adam Duskett +Date: Thu, 16 Aug 2018 14:52:37 -0700 +Subject: [PATCH] fix building on older distributions + +Python > 3.6.3 calls os.replace in the update_file.py script, during the +regen-importlib phase of the build process. + +According to Doc/whatsnew/3.3.rst line 1631, os.replace acts in the same +way as os.rename, however, it is now cross-platform compatible for Windows. + +Because BuildRoot is guaranteed only to be built in POSIX environment, it is +safe to change os.replace back to os.rename. + +This change fixes building on older systems such as CentOS7, that only come +with python 2. + +Signed-off-by: Adam Duskett +--- + Tools/scripts/update_file.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Tools/scripts/update_file.py b/Tools/scripts/update_file.py +index 224585c69b..ef458c0c63 100644 +--- a/Tools/scripts/update_file.py ++++ b/Tools/scripts/update_file.py +@@ -16,7 +16,7 @@ def main(old_path, new_path): + with open(new_path, 'rb') as f: + new_contents = f.read() + if old_contents != new_contents: +- os.replace(new_path, old_path) ++ os.rename(new_path, old_path) + else: + os.unlink(new_path) + +-- +2.25.1 + diff --git a/patches/python3/0033-configure.ac-fixup-CC-print-multiarch-output-for-mus.patch b/patches/python3/0033-configure.ac-fixup-CC-print-multiarch-output-for-mus.patch new file mode 100644 index 00000000..304a595f --- /dev/null +++ b/patches/python3/0033-configure.ac-fixup-CC-print-multiarch-output-for-mus.patch @@ -0,0 +1,48 @@ +From edc0757c56090364e0a95aabfa9f645a16a27569 Mon Sep 17 00:00:00 2001 +From: Peter Korsgaard +Date: Fri, 2 Aug 2019 15:53:16 +0200 +Subject: [PATCH] configure.ac: fixup $CC --print-multiarch output for + musl/uclibc GCC 8+ toolchains + +GCC commit 6834b83784dcf0364eb820e8 (multiarch support for non-glibc linux +systems), which is part of GCC 8+, changed the multiarch logic to use +$arch-linux-musl / $arch-linux-uclibc rather than $arch-linux-gnu. + +This then causes the python3 configure script to error out: + +checking for the platform triplet based on compiler characteristics... powerpc-linux-gnu +configure: error: internal configure error for the platform triplet, please file a bug report + +http://autobuild.buildroot.net/results/cb4/cb49c539501342e45cbe5ade82e588fcdf51f05b + +As it requires that the --print-multiarch output (if not empty) matches the +deduced triplet (which always uses -linux-gnu). + +It isn't quite clear why --print-multiarch returns something for a +non-multiarch toolchain on some architectures (E.G. PowerPC), but as a +workaround, rewrite the --print-multiarch output to match older GCC versions +to keep the configure script happy. + +Signed-off-by: Peter Korsgaard +--- + configure.ac | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 615c16aced..241298e6cf 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -718,7 +718,9 @@ then + fi + + +-MULTIARCH=$($CC --print-multiarch 2>/dev/null) ++# GCC 8+ returns $arch-linux-{musl,uclibc} for musl/uClibc based ++# toolchains confusing python. Fix that up ++MULTIARCH=$($CC --print-multiarch 2>/dev/null | sed -E 's/-linux-(musl|uclibc)*$/-linux-gnu/') + AC_SUBST(MULTIARCH) + + AC_MSG_CHECKING([for the platform triplet based on compiler characteristics]) +-- +2.25.1 + diff --git a/patches/python3/0034-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch b/patches/python3/0034-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch new file mode 100644 index 00000000..880277eb --- /dev/null +++ b/patches/python3/0034-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch @@ -0,0 +1,40 @@ +From 3c83eedcc2df3ecf6c4a17953ca24dff60c1378e Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Thu, 12 Nov 2020 00:16:18 +0100 +Subject: [PATCH] lib/crypt: uClibc-ng doesn't set errno when encryption method + is not available + +Since commit [1] in cpython, an exception is raised when an encryption method +is not available. This eception is handled only if errno is set to EINVAL by +crypt() but uClibc-ng doesn't set errno in crypt() [2]. + +Fixes: +https://gitlab.com/buildroot.org/buildroot/-/jobs/830981961 +https://gitlab.com/buildroot.org/buildroot/-/jobs/830981979 + +[1] https://github.com/python/cpython/commit/0d3fe8ae4961bf551e7d5e42559e2ede1a08fd7c +[2] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libcrypt/crypt.c?h=v1.0.36#n29 + +Signed-off-by: Romain Naour +--- + Lib/crypt.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/Lib/crypt.py b/Lib/crypt.py +index 33dbc46bb3..4692a5270c 100644 +--- a/Lib/crypt.py ++++ b/Lib/crypt.py +@@ -94,7 +94,9 @@ def _add_method(name, *args, rounds=None): + result = crypt('', salt) + except OSError as e: + # Not all libc libraries support all encryption methods. +- if e.errno == errno.EINVAL: ++ # Not all libc libraries set errno when encryption method is not ++ # available. ++ if e.errno == errno.EINVAL or e.errno == 0: + return False + raise + if result and len(result) == method.total_size: +-- +2.25.4 +