python: Remove package

This package will be added to the abandoned packages feed.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This commit is contained in:
Jeffery To 2020-04-03 03:26:40 +08:00
parent 803dd9c739
commit 2e48a26b17
48 changed files with 0 additions and 2020 deletions

View file

@ -1,95 +0,0 @@
#
# Copyright (C) 2015-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# Note: include this after `include $(TOPDIR)/rules.mk in your package Makefile
# if `python-package.mk` is included, this will already be included
ifneq ($(__python_host_mk_inc),1)
__python_host_mk_inc=1
# For PYTHON_VERSION
python_mk_path:=$(dir $(lastword $(MAKEFILE_LIST)))
include $(python_mk_path)python-version.mk
HOST_PYTHON_DIR:=$(STAGING_DIR_HOSTPKG)
HOST_PYTHON_INC_DIR:=$(HOST_PYTHON_DIR)/include/python$(PYTHON_VERSION)
HOST_PYTHON_LIB_DIR:=$(HOST_PYTHON_DIR)/lib/python$(PYTHON_VERSION)
HOST_PYTHON_PKG_DIR:=$(HOST_PYTHON_DIR)/lib/python$(PYTHON_VERSION)/site-packages
HOST_PYTHON_BIN:=$(HOST_PYTHON_DIR)/bin/python$(PYTHON_VERSION)
HOST_PYTHONPATH:=$(HOST_PYTHON_LIB_DIR):$(HOST_PYTHON_PKG_DIR)
define HostPython
if [ "$(strip $(3))" == "HOST" ]; then \
export PYTHONPATH="$(HOST_PYTHONPATH)"; \
export PYTHONDONTWRITEBYTECODE=0; \
else \
export PYTHONPATH="$(PYTHONPATH)"; \
export PYTHONDONTWRITEBYTECODE=1; \
export _python_sysroot="$(STAGING_DIR)"; \
export _python_prefix="/usr"; \
export _python_exec_prefix="/usr"; \
fi; \
export PYTHONOPTIMIZE=""; \
$(1) \
$(HOST_PYTHON_BIN) $(2);
endef
define host_python_settings
ARCH="$(HOST_ARCH)" \
CC="$(HOSTCC)" \
CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
CXX="$(HOSTCXX)" \
LD="$(HOSTCC)" \
LDSHARED="$(HOSTCC) -shared" \
CFLAGS="$(HOST_CFLAGS)" \
CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON_INC_DIR)" \
LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON_VERSION) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib" \
_PYTHON_HOST_PLATFORM=linux2
endef
# $(1) => commands to execute before running pythons script
# $(2) => python script and its arguments
# $(3) => additional variables
define Build/Compile/HostPyRunHost
$(call HostPython, \
$(if $(1),$(1);) \
$(call host_python_settings) \
$(3) \
, \
$(2) \
, \
HOST \
)
endef
# Note: I shamelessly copied this from Yousong's logic (from python-packages);
HOST_PYTHON_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON_VERSION)
# $(1) => packages to install
define Build/Compile/HostPyPipInstall
$(call host_python_settings) \
$(HOST_PYTHON_PIP) \
--disable-pip-version-check \
--cache-dir "$(DL_DIR)/pip-cache" \
install \
$(1)
endef
# $(1) => build subdir
# $(2) => additional arguments to setup.py
# $(3) => additional variables
define Build/Compile/HostPyMod
$(call Build/Compile/HostPyRunHost, \
cd $(HOST_BUILD_DIR)/$(strip $(1)), \
./setup.py $(2), \
$(3))
endef
endif # __python_host_mk_inc

View file

@ -1,153 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# Note: include this after `include $(TOPDIR)/rules.mk in your package Makefile
python_mk_path:=$(dir $(lastword $(MAKEFILE_LIST)))
include $(python_mk_path)python-host.mk
PYTHON_DIR:=$(STAGING_DIR)/usr
PYTHON_BIN_DIR:=$(PYTHON_DIR)/bin
PYTHON_INC_DIR:=$(PYTHON_DIR)/include/python$(PYTHON_VERSION)
PYTHON_LIB_DIR:=$(PYTHON_DIR)/lib/python$(PYTHON_VERSION)
PYTHON_PKG_DIR:=/usr/lib/python$(PYTHON_VERSION)/site-packages
PYTHON:=python$(PYTHON_VERSION)
PYTHONPATH:=$(PYTHON_LIB_DIR):$(STAGING_DIR)/$(PYTHON_PKG_DIR):$(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)
# These configure args are needed in detection of path to Python header files
# using autotools.
CONFIGURE_ARGS += \
_python_sysroot="$(STAGING_DIR)" \
_python_prefix="/usr" \
_python_exec_prefix="/usr"
PKG_USE_MIPS16:=0
# This is required in addition to PKG_USE_MIPS16:=0 because otherwise MIPS16
# flags are inherited from the Python base package (via sysconfig module)
ifdef CONFIG_USE_MIPS16
TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16
endif
define PyShebang
$(SED) "1"'!'"b;s,^#"'!'".*python.*,#"'!'"/usr/bin/python2," -i --follow-symlinks $(1)
endef
define PyPackage
define Package/$(1)-src
$(call Package/$(1))
DEPENDS:=
CONFLICTS:=
PROVIDES:=
EXTRA_DEPENDS:=
TITLE+= (sources)
USERID:=
MENU:=
endef
define Package/$(1)-src/description
$(call Package/$(1)/description).
(Contains the Python sources for this package).
endef
# Add default PyPackage filespec none defined
ifndef PyPackage/$(1)/filespec
define PyPackage/$(1)/filespec
+|$(PYTHON_PKG_DIR)
endef
endif
ifndef PyPackage/$(1)/install
define PyPackage/$(1)/install
if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then \
$(INSTALL_DIR) $$(1)/usr/bin ; \
$(CP) $(PKG_INSTALL_DIR)/usr/bin/* $$(1)/usr/bin/ ; \
fi
endef
endif
ifndef Package/$(1)/install
$(call shexport,PyPackage/$(1)/filespec)
define Package/$(1)/install
$$(call PyPackage/$(1)/install,$$(1))
$(SHELL) $(python_mk_path)python-package-install.sh "2" \
"$(PKG_INSTALL_DIR)" "$$(1)" \
"$(HOST_PYTHON_BIN)" "$$(2)" \
"$$$$$$$$$$(call shvar,PyPackage/$(1)/filespec)" && \
if [ -d "$$(1)/usr/bin" ]; then \
$(call PyShebang,$$(1)/usr/bin/*) ; \
fi
endef
define Package/$(1)-src/install
$$(call Package/$(1)/install,$$(1),sources)
endef
endif # Package/$(1)/install
endef
# $(1) => commands to execute before running pythons script
# $(2) => python script and its arguments
# $(3) => additional variables
define Build/Compile/HostPyRunTarget
$(call HostPython, \
$(if $(1),$(1);) \
CC="$(TARGET_CC)" \
CCSHARED="$(TARGET_CC) $(FPIC)" \
CXX="$(TARGET_CXX)" \
LD="$(TARGET_CC)" \
LDSHARED="$(TARGET_CC) -shared" \
CFLAGS="$(TARGET_CFLAGS)" \
CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON_INC_DIR)" \
LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON_VERSION)" \
_PYTHON_HOST_PLATFORM=linux2 \
__PYVENV_LAUNCHER__="/usr/bin/$(PYTHON)" \
$(3) \
, \
$(2) \
)
endef
# $(1) => build subdir
# $(2) => additional arguments to setup.py
# $(3) => additional variables
define Build/Compile/PyMod
$(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)
$(call Build/Compile/HostPyRunTarget, \
cd $(PKG_BUILD_DIR)/$(strip $(1)), \
./setup.py $(2), \
$(3))
endef
PYTHON_PKG_SETUP_DIR ?=
PYTHON_PKG_SETUP_GLOBAL_ARGS ?=
PYTHON_PKG_SETUP_ARGS ?= --single-version-externally-managed
PYTHON_PKG_SETUP_VARS ?=
define PyBuild/Compile/Default
$(if $(HOST_PYTHON_PACKAGE_BUILD_DEPENDS),
$(call Build/Compile/HostPyPipInstall,$(HOST_PYTHON_PACKAGE_BUILD_DEPENDS))
)
$(call Build/Compile/PyMod, \
$(PYTHON_PKG_SETUP_DIR), \
$(PYTHON_PKG_SETUP_GLOBAL_ARGS) \
install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
$(PYTHON_PKG_SETUP_ARGS), \
$(PYTHON_PKG_SETUP_VARS) \
)
endef
PyBuild/Compile=$(PyBuild/Compile/Default)
ifeq ($(BUILD_VARIANT),python)
define Build/Compile
$(call PyBuild/Compile)
endef
endif # python

View file

@ -1,15 +0,0 @@
#
# Copyright (C) 2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
PYTHON_VERSION:=2.7
PYTHON_VERSION_MICRO:=17
PYTHON_SETUPTOOLS_PKG_RELEASE:=1
PYTHON_PIP_PKG_RELEASE:=1
PYTHON_SETUPTOOLS_VERSION:=41.2.0
PYTHON_PIP_VERSION:=19.2.3

View file

@ -1,7 +0,0 @@
menu "Configuration"
config PYTHON_BLUETOOTH_SUPPORT
bool "Enable Bluetooth support"
default n
endmenu

View file

@ -1,380 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
# For PYTHON_VERSION
include ../python-version.mk
PKG_NAME:=python
PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
PKG_RELEASE:=2
PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
PKG_HASH:=4d43f033cdbd0aa7b7023c81b0e986fd11e653b5248dac9144d508f11812ba41
PKG_LICENSE:=Python/2.0
PKG_LICENSE_FILES:=LICENSE Doc/copyright.rst Doc/license.rst Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi/LICENSE Modules/_ctypes/libffi_osx/LICENSE Modules/expat/COPYING
PKG_CPE_ID:=cpe:/a:python:python
PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>, Jeffery To <jeffery.to@gmail.com>
# This file provides the necsessary host build variables
include ../python-host.mk
# For PyPackage
include ../python-package.mk
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
HOST_BUILD_PARALLEL:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_python-pkg-resources \
CONFIG_PACKAGE_python-setuptools CONFIG_PACKAGE_python-pip \
CONFIG_PYTHON_BLUETOOTH_SUPPORT
PKG_BUILD_DEPENDS:=python/host
HOST_BUILD_DEPENDS:=bzip2/host expat/host
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
define Package/python/Default
SUBMENU:=Python
SECTION:=lang
CATEGORY:=Languages
TITLE:=Python $(PYTHON_VERSION) programming language
URL:=https://www.python.org/
endef
define Package/python/Default/description
Python is a dynamic object-oriented programming language that can be used
for many kinds of software development. It offers strong support for
integration with other languages and tools, comes with extensive standard
libraries, and can be learned in a few days. Many Python programmers
report substantial productivity gains and feel the language encourages
the development of higher quality, more maintainable code.
endef
define Package/python-base
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) interpreter
DEPENDS:=+libpthread +zlib
endef
define Package/python-base/description
This package contains only the interpreter and the bare minimum
for the interpreter to start.
endef
define Package/python-light
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) light installation
DEPENDS:=+python-base +libffi +libbz2 +PYTHON_BLUETOOTH_SUPPORT:bluez-libs
endef
define Package/python-light/config
source "$(SOURCE)/Config-python-light.in"
endef
define Package/python-light/description
This package is essentially the python-base package plus
a few of the rarely used (and big) libraries stripped out
into separate packages.
endef
PYTHON_LIB_FILES_DEL:=
PYTHON_PACKAGES:=
PYTHON_PACKAGES_DEPENDS:=
define PyBasePackage
PYTHON_PACKAGES+=$(1)
ifeq ($(3),)
PYTHON_PACKAGES_DEPENDS+=$(1)
endif
PYTHON_LIB_FILES_DEL+=$(2)
define PyPackage/$(1)/filespec
ifneq ($(2),)
$(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file)))
-|/usr/lib/python$(PYTHON_VERSION)/*/test
-|/usr/lib/python$(PYTHON_VERSION)/*/tests
endif
endef
PyPackage/$(1)/install?=:
endef
include ./files/python-package-*.mk
define Package/python
$(call Package/python/Default)
DEPENDS:=+python-light $(foreach package,$(PYTHON_PACKAGES_DEPENDS),+$(package))
endef
define Package/python/description
This package contains the (almost) full Python install.
It's python-light + all other packages.
endef
MAKE_FLAGS+=\
CROSS_COMPILE=yes \
LD="$(TARGET_CC)" \
PGEN=pgen2
EXTRA_CFLAGS+= \
-DNDEBUG -fno-inline
EXTRA_LDFLAGS+= \
-L$(PKG_BUILD_DIR)
ENABLE_IPV6:=
ifeq ($(CONFIG_IPV6),y)
ENABLE_IPV6 += --enable-ipv6
endif
PYTHON_FOR_BUILD:= \
_PYTHON_PROJECT_BASE=$(PKG_BUILD_DIR) \
_PYTHON_HOST_PLATFORM=linux2 \
PYTHONPATH="$(PKG_BUILD_DIR)/Lib:$(PKG_BUILD_DIR)/build/lib.linux2-$(PYTHON_VERSION)" \
_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata \
$(HOST_PYTHON_BIN)
DISABLE_BLUETOOTH:= \
ac_cv_header_bluetooth_bluetooth_h=no \
ac_cv_header_bluetooth_h=no
CONFIGURE_ARGS+= \
--sysconfdir=/etc \
--enable-shared \
--without-cxx-main \
--with-threads \
--with-system-ffi \
--with-ensurepip=no \
--without-pymalloc \
$(if $(CONFIG_PYTHON_BLUETOOTH_SUPPORT),,$(DISABLE_BLUETOOTH)) \
PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)" \
$(ENABLE_IPV6) \
CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
OPT="$(TARGET_CFLAGS)"
define Build/Prepare
$(call Build/Prepare/Default)
$(CP) ./files/config.site $(PKG_BUILD_DIR)/config.site
endef
ifdef CONFIG_PACKAGE_python-setuptools
PYTHON_SETUPTOOLS_BUILD:=1
endif
ifdef CONFIG_PACKAGE_python-pkg-resources
PYTHON_SETUPTOOLS_BUILD:=1
endif
ifeq ($(PYTHON_SETUPTOOLS_BUILD),1)
define Build/Compile/python-setuptools
$(HOST_PYTHON_PIP) \
--disable-pip-version-check \
--cache-dir "$(DL_DIR)/pip-cache" \
install \
--ignore-installed \
--root=$(PKG_BUILD_DIR)/install-setuptools \
--prefix=/usr \
$(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/setuptools-$(PYTHON_SETUPTOOLS_VERSION)-py2.py3-none-any.whl
$(call PatchDir,$(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON_VERSION)/site-packages,./patches-setuptools,)
endef
endif # CONFIG_PACKAGE_python-setuptools
ifdef CONFIG_PACKAGE_python-pip
define Build/Compile/python-pip
$(HOST_PYTHON_PIP) \
--disable-pip-version-check \
--cache-dir "$(DL_DIR)/pip-cache" \
install \
--ignore-installed \
--root=$(PKG_BUILD_DIR)/install-pip \
--prefix=/usr \
$(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/pip-$(PYTHON_PIP_VERSION)-py2.py3-none-any.whl
$(call PatchDir,$(PKG_BUILD_DIR)/install-pip/usr/lib/python$(PYTHON_VERSION)/site-packages,./patches-pip,)
endef
endif # CONFIG_PACKAGE_python-pip
define Build/Compile
$(call Build/Compile/Default)
# Use host pip to install python-setuptools
$(call Build/Compile/python-setuptools)
$(call Build/Compile/python-pip)
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
$(INSTALL_DIR) $(2)/bin
$(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)-openwrt
$(CP) \
$(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
$(1)/usr/include/
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION) \
$(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \
$(1)/usr/lib/
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/python*.pc \
$(1)/usr/lib/pkgconfig
$(INSTALL_BIN) \
./files/python-config.in \
$(2)/bin/python$(PYTHON_VERSION)-config
$(SED) \
's|@EXENAME@|$(HOST_PYTHON_DIR)/bin/python$(PYTHON_VERSION)|' \
-e 's|@TARGET_PREFIX@|$(PYTHON_DIR)|' \
$(2)/bin/python$(PYTHON_VERSION)-config
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py \
$(1)/usr/lib/python$(PYTHON_VERSION)-openwrt/_sysconfigdatatarget.py
endef
PYTHON_BASE_LIB_FILES:= \
/usr/lib/python$(PYTHON_VERSION)/_abcoll.py \
/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py \
/usr/lib/python$(PYTHON_VERSION)/_weakrefset.py \
/usr/lib/python$(PYTHON_VERSION)/abc.py \
/usr/lib/python$(PYTHON_VERSION)/copy_reg.py \
/usr/lib/python$(PYTHON_VERSION)/genericpath.py \
/usr/lib/python$(PYTHON_VERSION)/linecache.py \
/usr/lib/python$(PYTHON_VERSION)/posixpath.py \
/usr/lib/python$(PYTHON_VERSION)/os.py \
/usr/lib/python$(PYTHON_VERSION)/re.py \
/usr/lib/python$(PYTHON_VERSION)/site.py \
/usr/lib/python$(PYTHON_VERSION)/sre_compile.py \
/usr/lib/python$(PYTHON_VERSION)/sre_constants.py \
/usr/lib/python$(PYTHON_VERSION)/sre_parse.py \
/usr/lib/python$(PYTHON_VERSION)/sysconfig.py \
/usr/lib/python$(PYTHON_VERSION)/stat.py \
/usr/lib/python$(PYTHON_VERSION)/traceback.py \
/usr/lib/python$(PYTHON_VERSION)/types.py \
/usr/lib/python$(PYTHON_VERSION)/UserDict.py \
/usr/lib/python$(PYTHON_VERSION)/warnings.py
PYTHON_LIB_FILES_DEL+=$(PYTHON_BASE_LIB_FILES)
define PyPackage/python-base/filespec
+|/usr/bin/python$(PYTHON_VERSION)
$(subst $(space),$(newline),$(foreach lib_file,$(PYTHON_BASE_LIB_FILES),+|$(lib_file)))
endef
define PyPackage/python-light/filespec
+|/usr/lib/python$(PYTHON_VERSION)
-|/usr/lib/python$(PYTHON_VERSION)/distutils/cygwinccompiler.py
-|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst*
-|/usr/lib/python$(PYTHON_VERSION)/ensurepip
-|/usr/lib/python$(PYTHON_VERSION)/idlelib
-|/usr/lib/python$(PYTHON_VERSION)/lib-tk
-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_testcapi.so
-|/usr/lib/python$(PYTHON_VERSION)/pdb.doc
-|/usr/lib/python$(PYTHON_VERSION)/test
-|/usr/lib/python$(PYTHON_VERSION)/webbrowser.py
-|/usr/lib/python$(PYTHON_VERSION)/*/test
-|/usr/lib/python$(PYTHON_VERSION)/*/tests
-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/readline.so
$(subst $(space),$(newline),$(foreach lib_file,$(PYTHON_LIB_FILES_DEL),-|$(lib_file)))
endef
define PyPackage/python-base/install
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib
$(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python
$(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python2
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/
endef
PyPackage/python-light/install:=:
PyPackage/python/install:=:
define PyPackage/python/filespec
-|$(PYTHON_PKG_DIR)
endef
HOST_LDFLAGS += \
-Wl$(comma)-rpath$(comma)$(STAGING_DIR_HOSTPKG)/lib
ifeq ($(HOST_OS),Linux)
HOST_LDFLAGS += \
-Wl,--no-as-needed -lrt
endif
ifeq ($(HOST_OS),Darwin)
HOST_CONFIGURE_VARS += \
ac_cv_header_libintl_h=no
endif
HOST_CONFIGURE_ARGS+= \
--without-cxx-main \
--without-pymalloc \
--with-threads \
--prefix=$(HOST_PYTHON_DIR) \
--exec-prefix=$(HOST_PYTHON_DIR) \
--with-system-expat=$(STAGING_DIR_HOSTPKG) \
--with-ensurepip=upgrade \
CONFIG_SITE=
define Host/Configure
$(SED) 's/^ENABLE_USER_SITE = None$$$$/ENABLE_USER_SITE = False/' $(HOST_BUILD_DIR)/Lib/site.py
$(call Host/Configure/Default)
endef
define Host/Compile
$(call Host/Compile/Default,python Parser/pgen sharedmods)
endef
define Host/Install
$(if $(wildcard $(HOST_PYTHON_PKG_DIR)/.setuptools_installed_$(PYTHON_SETUPTOOLS_VERSION)-$(PYTHON_SETUPTOOLS_PKG_RELEASE)),,
rm -rf \
$(HOST_PYTHON_PKG_DIR)/easy_install.py \
$(HOST_PYTHON_PKG_DIR)/pkg_resources \
$(HOST_PYTHON_PKG_DIR)/setuptools \
$(HOST_PYTHON_PKG_DIR)/setuptools-* \
$(HOST_PYTHON_PKG_DIR)/.setuptools-patched* \
$(HOST_PYTHON_PKG_DIR)/.setuptools_installed_*
)
$(if $(wildcard $(HOST_PYTHON_PKG_DIR)/.pip_installed_$(PYTHON_PIP_VERSION)-$(PYTHON_PIP_PKG_RELEASE)),,
rm -rf \
$(HOST_PYTHON_PKG_DIR)/pip \
$(HOST_PYTHON_PKG_DIR)/pip-* \
$(HOST_PYTHON_PKG_DIR)/.pip-patched* \
$(HOST_PYTHON_PKG_DIR)/.pip_installed_*
)
$(MAKE) -C $(HOST_BUILD_DIR) install
$(INSTALL_DIR) $(HOST_PYTHON_DIR)/bin/
$(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(HOST_PYTHON_DIR)/bin/pgen2
$(if $(wildcard $(HOST_PYTHON_PKG_DIR)/.setuptools_installed_$(PYTHON_SETUPTOOLS_VERSION)-$(PYTHON_SETUPTOOLS_PKG_RELEASE)),,
$(call HostPatchDir,$(HOST_PYTHON_PKG_DIR),./patches-setuptools,)
touch $(HOST_PYTHON_PKG_DIR)/.setuptools_installed_$(PYTHON_SETUPTOOLS_VERSION)-$(PYTHON_SETUPTOOLS_PKG_RELEASE)
)
$(if $(wildcard $(HOST_PYTHON_PKG_DIR)/.pip_installed_$(PYTHON_PIP_VERSION)-$(PYTHON_PIP_PKG_RELEASE)),,
$(call HostPatchDir,$(HOST_PYTHON_PKG_DIR),./patches-pip,)
touch $(HOST_PYTHON_PKG_DIR)/.pip_installed_$(PYTHON_PIP_VERSION)-$(PYTHON_PIP_PKG_RELEASE)
)
endef
$(eval $(call HostBuild))
$(foreach package, $(PYTHON_PACKAGES), \
$(eval $(call PyPackage,$(package))) \
$(eval $(call BuildPackage,$(package))) \
$(eval $(call BuildPackage,$(package)-src)) \
)
$(eval $(call PyPackage,python-base))
$(eval $(call PyPackage,python-light))
$(eval $(call PyPackage,python))
$(eval $(call BuildPackage,python-base))
$(eval $(call BuildPackage,python-light))
$(eval $(call BuildPackage,python))
$(eval $(call BuildPackage,python-base-src))
$(eval $(call BuildPackage,python-light-src))

View file

@ -1,12 +0,0 @@
#! /bin/sh
#
# Copyright (C) 2007-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
ac_cv_file__dev_ptmx=yes
ac_cv_file__dev_ptc=no
ac_cv_buggy_getaddrinfo=no

View file

@ -1,80 +0,0 @@
#!@EXENAME@
import sys
import os
import getopt
from distutils import sysconfig
# start changes
host_prefix = sysconfig.PREFIX
target_prefix = '@TARGET_PREFIX@'
target_data_dir = os.path.join(target_prefix, 'lib', 'python' + sysconfig.get_config_var('VERSION') + '-openwrt')
sys.path.append(target_data_dir)
try:
from _sysconfigdatatarget import build_time_vars
sysconfig._config_vars = {}
sysconfig._config_vars.update(build_time_vars)
except ImportError:
print >>sys.stderr, "Could not import target data from %s" % (target_data_dir)
sys.exit(1)
# end changes
# plus .replace(host_prefix, target_prefix) below
valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
'ldflags', 'help']
def exit_with_usage(code=1):
print >>sys.stderr, "Usage: %s [%s]" % (sys.argv[0],
'|'.join('--'+opt for opt in valid_opts))
sys.exit(code)
try:
opts, args = getopt.getopt(sys.argv[1:], '', valid_opts)
except getopt.error:
exit_with_usage()
if not opts:
exit_with_usage()
pyver = sysconfig.get_config_var('VERSION')
getvar = sysconfig.get_config_var
opt_flags = [flag for (flag, val) in opts]
if '--help' in opt_flags:
exit_with_usage(code=0)
for opt in opt_flags:
if opt == '--prefix':
#print sysconfig.PREFIX
print target_prefix
elif opt == '--exec-prefix':
#print sysconfig.EXEC_PREFIX
print target_prefix
elif opt in ('--includes', '--cflags'):
flags = ['-I' + sysconfig.get_python_inc(),
'-I' + sysconfig.get_python_inc(plat_specific=True)]
if opt == '--cflags':
flags.extend(getvar('CFLAGS').split())
#print ' '.join(flags)
print ' '.join(flags).replace(host_prefix, target_prefix)
elif opt in ('--libs', '--ldflags'):
libs = ['-lpython' + pyver]
libs += getvar('LIBS').split()
libs += getvar('SYSLIBS').split()
# add the prefix/lib/pythonX.Y/config dir, but only if there is no
# shared library in prefix/lib/.
if opt == '--ldflags':
if not getvar('Py_ENABLE_SHARED'):
libs.insert(0, '-L' + getvar('LIBPL'))
if not getvar('PYTHONFRAMEWORK'):
libs.extend(getvar('LINKFORSHARED').split())
#print ' '.join(libs)
print ' '.join(libs).replace(host_prefix, target_prefix)

View file

@ -1,23 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-codecs
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) codecs + unicode support
DEPENDS:=+python-light
endef
$(eval $(call PyBasePackage,python-codecs, \
/usr/lib/python$(PYTHON_VERSION)/encodings \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_cn.so \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_hk.so \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_iso2022.so \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_jp.so \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_kr.so \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_codecs_tw.so \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/unicodedata.so \
))

View file

@ -1,16 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-compiler
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) compiler module
DEPENDS:=+python-light
endef
$(eval $(call PyBasePackage,python-compiler, \
/usr/lib/python$(PYTHON_VERSION)/compiler \
))

View file

@ -1,18 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-ctypes
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) ctypes module
DEPENDS:=+python-light
endef
$(eval $(call PyBasePackage,python-ctypes, \
/usr/lib/python$(PYTHON_VERSION)/ctypes \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ctypes.so \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ctypes_test.so \
))

View file

@ -1,18 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-db
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) db module
DEPENDS:=+python-light +libdb47
endef
$(eval $(call PyBasePackage,python-db, \
/usr/lib/python$(PYTHON_VERSION)/bsddb \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_bsddb.so \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/dbm.so \
))

View file

@ -1,16 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-decimal
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) decimal module
DEPENDS:=+python-light
endef
$(eval $(call PyBasePackage,python-decimal, \
/usr/lib/python$(PYTHON_VERSION)/decimal.py \
))

View file

@ -1,27 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-dev
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) development files
DEPENDS:=+python +python-lib2to3
endef
define PyPackage/python-dev/install
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/bin/python*config $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config/libpython$(PYTHON_VERSION).a $(1)/usr/lib
endef
$(eval $(call PyBasePackage,python-dev, \
/usr/lib/python$(PYTHON_VERSION)/config \
/usr/include/python$(PYTHON_VERSION) \
/usr/lib/pkgconfig \
, \
DO_NOT_ADD_TO_PACKAGE_DEPENDS \
))

View file

@ -1,16 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-distutils
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) distutils
DEPENDS:=+python-light
endef
$(eval $(call PyBasePackage,python-distutils, \
/usr/lib/python$(PYTHON_VERSION)/distutils \
))

View file

@ -1,16 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-email
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) email module
DEPENDS:=+python-light
endef
$(eval $(call PyBasePackage,python-email, \
/usr/lib/python$(PYTHON_VERSION)/email \
))

View file

@ -1,16 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-gdbm
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) gdbm module
DEPENDS:=+python-light +libgdbm
endef
$(eval $(call PyBasePackage,python-gdbm, \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/gdbm.so \
))

View file

@ -1,18 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-lib2to3
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) lib2to3 module
DEPENDS:=+python
endef
$(eval $(call PyBasePackage,python-lib2to3, \
/usr/lib/python$(PYTHON_VERSION)/lib2to3 \
, \
DO_NOT_ADD_TO_PACKAGE_DEPENDS \
))

View file

@ -1,16 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-logging
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) logging module
DEPENDS:=+python-light
endef
$(eval $(call PyBasePackage,python-logging, \
/usr/lib/python$(PYTHON_VERSION)/logging \
))

View file

@ -1,17 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-multiprocessing
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) multiprocessing
DEPENDS:=+python-light
endef
$(eval $(call PyBasePackage,python-multiprocessing, \
/usr/lib/python$(PYTHON_VERSION)/multiprocessing \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_multiprocessing.so \
))

View file

@ -1,18 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-ncurses
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) ncurses module
DEPENDS:=+python-light +libncurses
endef
$(eval $(call PyBasePackage,python-ncurses, \
/usr/lib/python$(PYTHON_VERSION)/curses \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_curses.so \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_curses_panel.so \
))

View file

@ -1,17 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-openssl
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) SSL module
DEPENDS:=+python-light +libopenssl
endef
$(eval $(call PyBasePackage,python-openssl, \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_hashlib.so \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ssl.so \
))

View file

@ -1,30 +0,0 @@
#
# Copyright (C) 2017 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-pip
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) pip module
VERSION:=$(PYTHON_PIP_VERSION)-$(PYTHON_PIP_PKG_RELEASE)
LICENSE:=MIT
LICENSE_FILES:=LICENSE.txt
# CPE_ID:=cpe:/a:python:pip # not currently handled this way by uscan
DEPENDS:=+python +python-setuptools +python-pip-conf
endef
define PyPackage/python-pip/install
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages
$(CP) $(PKG_BUILD_DIR)/install-pip/usr/bin/* $(1)/usr/bin
$(CP) \
$(PKG_BUILD_DIR)/install-pip/usr/lib/python$(PYTHON_VERSION)/site-packages/pip \
$(PKG_BUILD_DIR)/install-pip/usr/lib/python$(PYTHON_VERSION)/site-packages/pip-$(PYTHON_PIP_VERSION).dist-info \
$(1)/usr/lib/python$(PYTHON_VERSION)/site-packages/
endef
$(eval $(call PyBasePackage,python-pip, \
, \
DO_NOT_ADD_TO_PACKAGE_DEPENDS \
))

View file

@ -1,28 +0,0 @@
#
# Copyright (C) 2019 Alexandru Ardelean <ardeleanalex@gmail.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-pkg-resources
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) pkg_resources module (part of etuptools)
VERSION:=$(PYTHON_SETUPTOOLS_VERSION)-$(PYTHON_SETUPTOOLS_PKG_RELEASE)
LICENSE:=MIT
LICENSE_FILES:=LICENSE
# CPE_ID:=cpe:/a:python:setuptools # not currently handled this way by uscan
DEPENDS:=+python
endef
define PyPackage/python-pkg-resources/install
$(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages
$(CP) \
$(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON_VERSION)/site-packages/pkg_resources \
$(1)/usr/lib/python$(PYTHON_VERSION)/site-packages
endef
$(eval $(call PyBasePackage,python-pkg-resources, \
, \
DO_NOT_ADD_TO_PACKAGE_DEPENDS \
))

View file

@ -1,18 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-pydoc
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) pydoc module
DEPENDS:=+python-light
endef
$(eval $(call PyBasePackage,python-pydoc, \
/usr/lib/python$(PYTHON_VERSION)/doctest.py \
/usr/lib/python$(PYTHON_VERSION)/pydoc.py \
/usr/lib/python$(PYTHON_VERSION)/pydoc_data \
))

View file

@ -1,31 +0,0 @@
#
# Copyright (C) 2017 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-setuptools
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) setuptools module
VERSION:=$(PYTHON_SETUPTOOLS_VERSION)-$(PYTHON_SETUPTOOLS_PKG_RELEASE)
LICENSE:=MIT
LICENSE_FILES:=LICENSE
# CPE_ID:=cpe:/a:python:setuptools # not currently handled this way by uscan
DEPENDS:=+python +python-pkg-resources
endef
define PyPackage/python-setuptools/install
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages
$(CP) $(PKG_BUILD_DIR)/install-setuptools/usr/bin/* $(1)/usr/bin
$(CP) \
$(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON_VERSION)/site-packages/setuptools \
$(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON_VERSION)/site-packages/setuptools-$(PYTHON_SETUPTOOLS_VERSION).dist-info \
$(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON_VERSION)/site-packages/easy_install.py \
$(1)/usr/lib/python$(PYTHON_VERSION)/site-packages
endef
$(eval $(call PyBasePackage,python-setuptools, \
, \
DO_NOT_ADD_TO_PACKAGE_DEPENDS \
))

View file

@ -1,17 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-sqlite3
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) sqlite3 module
DEPENDS:=+python-light +libsqlite3
endef
$(eval $(call PyBasePackage,python-sqlite3, \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sqlite3.so \
/usr/lib/python$(PYTHON_VERSION)/sqlite3 \
))

View file

@ -1,16 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-unittest
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) unittest module
DEPENDS:=+python-light
endef
$(eval $(call PyBasePackage,python-unittest, \
/usr/lib/python$(PYTHON_VERSION)/unittest \
))

View file

@ -1,20 +0,0 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Package/python-xml
$(call Package/python/Default)
TITLE:=Python $(PYTHON_VERSION) xml libs
DEPENDS:=+python-light +libexpat
endef
$(eval $(call PyBasePackage,python-xml, \
/usr/lib/python$(PYTHON_VERSION)/xml \
/usr/lib/python$(PYTHON_VERSION)/xmllib.py \
/usr/lib/python$(PYTHON_VERSION)/xmlrpclib.py \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_elementtree.so \
/usr/lib/python$(PYTHON_VERSION)/lib-dynload/pyexpat.so \
))

View file

@ -1,16 +0,0 @@
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=848136
https://sources.debian.org/patches/python-setuptools/40.8.0-1/reproducible.diff/
Index: b/setuptools/command/easy_install.py
===================================================================
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -436,7 +436,7 @@ consider to install to another location,
for spec in self.args:
self.easy_install(spec, not self.no_deps)
if self.record:
- outputs = self.outputs
+ outputs = list(sorted(self.outputs))
if self.root: # strip any package prefix
root_len = len(self.root)
for counter in range(len(outputs)):

View file

@ -1,16 +0,0 @@
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804249
https://sources.debian.org/patches/python-setuptools/40.8.0-1/sorted-requires.diff/
Index: b/setuptools/command/egg_info.py
===================================================================
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -621,7 +621,7 @@ def warn_depends_obsolete(cmd, basename,
def _write_requirements(stream, reqs):
lines = yield_lines(reqs or ())
append_cr = lambda line: line + '\n'
- lines = map(append_cr, lines)
+ lines = map(append_cr, sorted(lines))
stream.writelines(lines)

View file

@ -1,14 +0,0 @@
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=894215
https://sources.debian.org/patches/python-setuptools/40.8.0-1/PKG-INFO-output-reproducible.diff/
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -191,7 +191,7 @@ def write_pkg_file(self, file):
self.long_description_content_type
)
if self.provides_extras:
- for extra in self.provides_extras:
+ for extra in sorted(self.provides_extras):
write_field('Provides-Extra', extra)

View file

@ -1,20 +0,0 @@
From 6eeab87bc852481e599325549c854b701bf2e39f Mon Sep 17 00:00:00 2001
From: Alexandru Ardelean <aa@ocedo.com>
Date: Thu, 25 Sep 2014 18:18:29 +0300
Subject: [PATCH] enable zlib
---
Modules/Setup.dist | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/Modules/Setup.dist
+++ b/Modules/Setup.dist
@@ -464,7 +464,7 @@ GLHACK=-Dclear=__GLclear
# Andrew Kuchling's zlib module.
# This require zlib 1.1.3 (or later).
# See http://www.gzip.org/zlib/
-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
+zlib zlibmodule.c -lz
# Interface to the Expat XML parser
# More information on Expat can be found at www.libexpat.org.

View file

@ -1,12 +0,0 @@
--- a/setup.py
+++ b/setup.py
@@ -543,7 +543,8 @@ class PyBuildExt(build_ext):
add_dir_to_list(dir_list, directory)
if os.path.normpath(sys.prefix) != '/usr' \
- and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
+ and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
+ and not cross_compiling:
# OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
# (PYTHONFRAMEWORK is set) to avoid # linking problems when
# building a framework with different architectures than

View file

@ -1,18 +0,0 @@
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1133,6 +1133,7 @@ libinstall: build_all $(srcdir)/Lib/$(PL
done; \
done
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
+ifeq (@COMPILE_ALL_TESTS@,yes)
if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
$(DESTDIR)$(LIBDEST)/distutils/tests ; \
@@ -1159,6 +1160,7 @@ libinstall: build_all $(srcdir)/Lib/$(PL
$(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
# Create the PLATDIR source directory, if one wasn't distributed..
$(srcdir)/Lib/$(PLATDIR):

View file

@ -1,11 +0,0 @@
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -71,7 +71,7 @@ int Py_InteractiveFlag; /* Needed by Py_
int Py_InspectFlag; /* Needed to determine whether to exit at SystemExit */
int Py_NoSiteFlag; /* Suppress 'import site' */
int Py_BytesWarningFlag; /* Warn on comparison between bytearray and unicode */
-int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */
+int Py_DontWriteBytecodeFlag = 1; /* Suppress writing bytecode files (*.py[co]) */
int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */
int Py_FrozenFlag; /* Needed by getpath.c */
int Py_UnicodeFlag = 0; /* Needed by compile.c */

View file

@ -1,57 +0,0 @@
--- a/configure
+++ b/configure
@@ -7084,7 +7084,7 @@ sys/param.h sys/poll.h sys/random.h sys/
sys/termio.h sys/time.h \
sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
-bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h
+linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -7306,6 +7306,24 @@ fi
fi
+# bluetooth/bluetooth.h has been known to not compile with -std=c99.
+# http://permalink.gmane.org/gmane.linux.bluez.kernel/22294
+SAVE_CFLAGS=$CFLAGS
+CFLAGS="-std=c99 $CFLAGS"
+for ac_header in bluetooth/bluetooth.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "bluetooth/bluetooth.h" "ac_cv_header_bluetooth_bluetooth_h" "$ac_includes_default"
+if test "x$ac_cv_header_bluetooth_bluetooth_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_BLUETOOTH_BLUETOOTH_H 1
+_ACEOF
+
+fi
+
+done
+
+CFLAGS=$SAVE_CFLAGS
+
# On Linux, netlink.h requires asm/types.h
for ac_header in linux/netlink.h
do :
--- a/configure.ac
+++ b/configure.ac
@@ -1739,10 +1739,17 @@ sys/param.h sys/poll.h sys/random.h sys/
sys/termio.h sys/time.h \
sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
-bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h)
+linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h)
AC_HEADER_DIRENT
AC_HEADER_MAJOR
+# bluetooth/bluetooth.h has been known to not compile with -std=c99.
+# http://permalink.gmane.org/gmane.linux.bluez.kernel/22294
+SAVE_CFLAGS=$CFLAGS
+CFLAGS="-std=c99 $CFLAGS"
+AC_CHECK_HEADERS(bluetooth/bluetooth.h)
+CFLAGS=$SAVE_CFLAGS
+
# On Linux, netlink.h requires asm/types.h
AC_CHECK_HEADERS(linux/netlink.h,,,[
#ifdef HAVE_ASM_TYPES_H

View file

@ -1,16 +0,0 @@
--- a/setup.py
+++ b/setup.py
@@ -500,13 +500,8 @@ class PyBuildExt(build_ext):
os.unlink(tmpfile)
def detect_modules(self):
- # Ensure that /usr/local is always used
- 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')
if cross_compiling:
self.add_gcc_paths()
- self.add_multiarch_paths()
# Add paths specified in the environment variables LDFLAGS and
# CPPFLAGS for header and library files.

View file

@ -1,10 +0,0 @@
--- a/Lib/distutils/command/build_scripts.py
+++ b/Lib/distutils/command/build_scripts.py
@@ -89,6 +89,7 @@ class build_scripts (Command):
adjust = 1
post_interp = match.group(1) or ''
+ adjust = 0
if adjust:
log.info("copying and adjusting %s -> %s", script,
self.build_dir)

View file

@ -1,50 +0,0 @@
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.
The _python_sysroot variable is also used to prefix the LIBDIR value
taken from the sysconfigdata module.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -19,8 +19,13 @@ import sys
from distutils.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)
+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'))
+else:
+ PREFIX = os.path.normpath(sys.prefix)
+ EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
# Path to the base directory of the project. On Windows the binary may
# live in project/PCBuild9. If we're dealing with an x64 Windows build,
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -240,7 +240,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('.')

View file

@ -1,32 +0,0 @@
--- a/setup.py
+++ b/setup.py
@@ -1129,6 +1129,7 @@ class PyBuildExt(build_ext):
if db_setup_debug: print "db lib: ", dblib, "not found"
except db_found:
+ rt_dblib_dir = None if cross_compiling else dblib_dir
if db_setup_debug:
print "bsddb using BerkeleyDB lib:", db_ver, dblib
print "bsddb lib dir:", dblib_dir, " inc dir:", db_incdir
@@ -1143,7 +1144,7 @@ class PyBuildExt(build_ext):
exts.append(Extension('_bsddb', ['_bsddb.c'],
depends = ['bsddb.h'],
library_dirs=dblib_dir,
- runtime_library_dirs=dblib_dir,
+ runtime_library_dirs=rt_dblib_dir,
include_dirs=db_incs,
libraries=dblibs))
else:
@@ -1354,10 +1355,11 @@ class PyBuildExt(build_ext):
break
elif cand == "bdb":
if db_incs is not None:
+ rt_dblib_dir = None if cross_compiling else dblib_dir
print "building dbm using bdb"
dbmext = Extension('dbm', ['dbmmodule.c'],
library_dirs=dblib_dir,
- runtime_library_dirs=dblib_dir,
+ runtime_library_dirs=rt_dblib_dir,
include_dirs=db_incs,
define_macros=[
('HAVE_BERKDB_H', None),

View file

@ -1,13 +0,0 @@
--- a/setup.py
+++ b/setup.py
@@ -509,8 +509,9 @@ class PyBuildExt(build_ext):
# directly since an inconsistently reproducible issue comes up where
# the environment variable is not set even though the value were passed
# into configure and stored in the Makefile (issue found on OS X 10.3).
+ rt_lib_dirs = [] if cross_compiling else self.compiler.runtime_library_dirs
for env_var, arg_name, dir_list in (
- ('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
+ ('LDFLAGS', '-R', rt_lib_dirs),
('LDFLAGS', '-L', self.compiler.library_dirs),
('CPPFLAGS', '-I', self.compiler.include_dirs)):
env_val = sysconfig.get_config_var(env_var)

View file

@ -1,10 +0,0 @@
--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
@@ -108,6 +108,7 @@ def compile(file, cfile=None, dfile=None
timestamp = long(os.fstat(f.fileno()).st_mtime)
except AttributeError:
timestamp = long(os.stat(file).st_mtime)
+ timestamp = long(os.getenv('SOURCE_DATE_EPOCH', timestamp))
codestring = f.read()
try:
codeobject = __builtin__.compile(codestring, dfile or file,'exec')

View file

@ -1,28 +0,0 @@
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -634,6 +634,16 @@ regen-all: regen-opcode-targets regen-gr
############################################################################
# Special rules for object files
+DATE_FMT = %b %d %Y
+TIME_FMT = %H:%M:%S
+ifdef SOURCE_DATE_EPOCH
+ BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u "+$(DATE_FMT)")
+ BUILD_TIME ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(TIME_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(TIME_FMT)" 2>/dev/null || date -u "+$(TIME_FMT)")
+else
+ BUILD_DATE ?= $(shell date "+$(DATE_FMT)")
+ BUILD_TIME ?= $(shell date "+$(TIME_FMT)")
+endif
+
Modules/getbuildinfo.o: $(PARSER_OBJS) \
$(OBJECT_OBJS) \
$(PYTHON_OBJS) \
@@ -642,6 +652,8 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \
$(MODOBJS) \
$(srcdir)/Modules/getbuildinfo.c
$(CC) -c $(PY_CFLAGS) \
+ -DDATE="\"$(BUILD_DATE)\"" \
+ -DTIME="\"$(BUILD_TIME)\"" \
-DGITVERSION="\"`LC_ALL=C $(GITVERSION)`\"" \
-DGITTAG="\"`LC_ALL=C $(GITTAG)`\"" \
-DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \

View file

@ -1,31 +0,0 @@
--- a/Lib/compileall.py
+++ b/Lib/compileall.py
@@ -152,10 +152,10 @@ def main():
"""Script main program."""
import getopt
try:
- opts, args = getopt.getopt(sys.argv[1:], 'lfqd:x:i:')
+ opts, args = getopt.getopt(sys.argv[1:], 'lr:fqd:x:i:')
except getopt.error, msg:
print msg
- print "usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \
+ print "usage: python compileall.py [-l] [-r recursion] [-f] [-q] [-d destdir] " \
"[-x regexp] [-i list] [directory|file ...]"
print
print "arguments: zero or more file and directory names to compile; " \
@@ -164,6 +164,7 @@ def main():
print
print "options:"
print "-l: don't recurse into subdirectories"
+ print "-r recursion: control the maximum recursion level"
print "-f: force rebuild even if timestamps are up-to-date"
print "-q: output only error messages"
print "-d destdir: directory to prepend to file paths for use in " \
@@ -187,6 +188,7 @@ def main():
flist = None
for o, a in opts:
if o == '-l': maxlevels = 0
+ if o == '-r': maxlevels = int(a)
if o == '-d': ddir = a
if o == '-f': force = 1
if o == '-q': quiet = 1

View file

@ -1,74 +0,0 @@
https://bugs.python.org/issue21622
Based on the patch from Alpine Linux
https://git.alpinelinux.org/aports/tree/main/python2/musl-find_library.patch
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -86,6 +86,8 @@ if os.name == "posix" and sys.platform =
elif os.name == "posix":
# Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump
import re, tempfile, errno
+ from glob import glob
+ musl_ldso = glob('/lib/ld-musl-*.so.1')
def _findLib_gcc(name):
# Run GCC's linker with the -t (aka --trace) option and examine the
@@ -232,6 +234,57 @@ elif os.name == "posix":
def find_library(name, is64 = False):
return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
+ elif musl_ldso and os.path.isfile(musl_ldso[0]):
+
+ def _is_elf(filepath):
+ try:
+ with open(filepath, 'rb') as fh:
+ return fh.read(4) == b'\x7fELF'
+ except:
+ return False
+
+ def find_library(name):
+ # absolute name?
+ if os.path.isabs(name):
+ if _is_elf(name):
+ return name
+ else:
+ return None
+
+ # special case for unified standard libs
+ stdlibs = ['libcrypt.so', 'libdl.so', 'libm.so', 'libpthread.so', 'libresolv.so', 'librt.so', 'libutil.so', 'libxnet.so']
+ if name in stdlibs:
+ name = 'libc.so'
+ elif ('lib' + name + '.so') in stdlibs:
+ name = 'c'
+
+ paths = []
+ # read path list from /etc/ld-musl-$(ARCH).path
+ path_list = musl_ldso[0].replace('/lib/', '/etc/').replace('.so.1', '.path')
+ try:
+ with open(path_list, 'r') as fh:
+ paths = [path for line in fh for path in line.rstrip('\n').split(':') if path]
+ except:
+ paths = []
+ # default path list if /etc/ld-musl-$(ARCH).path is empty or does not exist
+ if not paths:
+ paths = ['/lib', '/usr/local/lib', '/usr/lib']
+
+ # prepend paths from LD_LIBRARY_PATH
+ if 'LD_LIBRARY_PATH' in os.environ:
+ paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
+
+ for d in paths:
+ f = os.path.join(d, name)
+ if _is_elf(f):
+ return os.path.basename(f)
+
+ prefix = os.path.join(d, 'lib'+name)
+ for suffix in ['.so', '.so.*']:
+ for f in glob('{0}{1}'.format(prefix, suffix)):
+ if _is_elf(f):
+ return os.path.basename(f)
+
else:
def _findSoname_ldconfig(name):

View file

@ -1,11 +0,0 @@
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -3070,7 +3070,7 @@ done:
if (arg == Py_None) {
/* optional time values not given */
Py_BEGIN_ALLOW_THREADS
- res = utime(path, NULL);
+ res = utimes(path, NULL);
Py_END_ALLOW_THREADS
}
else if (!PyTuple_Check(arg) || PyTuple_Size(arg) != 2) {

View file

@ -1,209 +0,0 @@
From 2a9c3805ddedf282881ef7811a561c70b74f80b1 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross@burtonini.com>
Date: Wed, 19 Sep 2018 07:25:48 +0100
Subject: [PATCH] closes bpo-34585: Don't do runtime test to get float byte
order. (GH-9085)
Currently configure.ac uses AC_RUN_IFELSE to determine the byte order of doubles, but this silently fails under cross compilation and Python doesn't do floats properly.
Instead, steal a macro from autoconf-archive which compiles code using magic doubles (which encode to ASCII) and grep for the representation in the binary.
RFC because this doesn't yet handle the weird ancient ARMv4 OABI 'mixed-endian' encoding properly. This encoding is ancient and I don't believe the union of "Python 3.8 users" and "OABI users" has anything in. Should the support for this just be dropped too? Alternatively, someone will need to find an OABI toolchain to verify the encoding of the magic double.
---
.../2018-09-18-16-28-31.bpo-34585.CGMu0h.rst | 3 +
configure.ac | 76 +++--------------
m4/ax_c_float_words_bigendian.m4 | 83 +++++++++++++++++++
3 files changed, 99 insertions(+), 63 deletions(-)
create mode 100644 Misc/NEWS.d/next/Build/2018-09-18-16-28-31.bpo-34585.CGMu0h.rst
create mode 100644 m4/ax_c_float_words_bigendian.m4
diff --git a/Misc/NEWS.d/next/Build/2018-09-18-16-28-31.bpo-34585.CGMu0h.rst b/Misc/NEWS.d/next/Build/2018-09-18-16-28-31.bpo-34585.CGMu0h.rst
new file mode 100644
index 0000000000000..01318e6e46a32
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2018-09-18-16-28-31.bpo-34585.CGMu0h.rst
@@ -0,0 +1,3 @@
+Check for floating-point byte order in configure.ac using compilation tests
+instead of executing code, so that these checks work in cross-compiled
+builds.
diff --git a/configure.ac b/configure.ac
index 03638f8ae9bc7..96331ec221be2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4206,74 +4206,24 @@ fi
# * Check for various properties of floating point *
# **************************************************
-AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
-AC_CACHE_VAL(ac_cv_little_endian_double, [
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <string.h>
-int main() {
- double x = 9006104071832581.0;
- if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
- return 0;
- else
- return 1;
-}
-]])],
-[ac_cv_little_endian_double=yes],
-[ac_cv_little_endian_double=no],
-[ac_cv_little_endian_double=no])])
-AC_MSG_RESULT($ac_cv_little_endian_double)
-if test "$ac_cv_little_endian_double" = yes
-then
- AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
- [Define if C doubles are 64-bit IEEE 754 binary format, stored
- with the least significant byte first])
-fi
-
-AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
-AC_CACHE_VAL(ac_cv_big_endian_double, [
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <string.h>
-int main() {
- double x = 9006104071832581.0;
- if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
- return 0;
- else
- return 1;
-}
-]])],
-[ac_cv_big_endian_double=yes],
-[ac_cv_big_endian_double=no],
-[ac_cv_big_endian_double=no])])
-AC_MSG_RESULT($ac_cv_big_endian_double)
-if test "$ac_cv_big_endian_double" = yes
+AX_C_FLOAT_WORDS_BIGENDIAN
+if test "$ax_cv_c_float_words_bigendian" = "yes"
then
AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
[Define if C doubles are 64-bit IEEE 754 binary format, stored
with the most significant byte first])
-fi
-
-# Some ARM platforms use a mixed-endian representation for doubles.
-# While Python doesn't currently have full support for these platforms
-# (see e.g., issue 1762561), we can at least make sure that float <-> string
-# conversions work.
-AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
-AC_CACHE_VAL(ac_cv_mixed_endian_double, [
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <string.h>
-int main() {
- double x = 9006104071832581.0;
- if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
- return 0;
- else
- return 1;
-}
-]])],
-[ac_cv_mixed_endian_double=yes],
-[ac_cv_mixed_endian_double=no],
-[ac_cv_mixed_endian_double=no])])
-AC_MSG_RESULT($ac_cv_mixed_endian_double)
-if test "$ac_cv_mixed_endian_double" = yes
+elif test "$ax_cv_c_float_words_bigendian" = "no"
then
+ AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
+ [Define if C doubles are 64-bit IEEE 754 binary format, stored
+ with the least significant byte first])
+else
+ # Some ARM platforms use a mixed-endian representation for doubles.
+ # While Python doesn't currently have full support for these platforms
+ # (see e.g., issue 1762561), we can at least make sure that float <-> string
+ # conversions work.
+ # FLOAT_WORDS_BIGENDIAN doesnt actually detect this case, but if it's not big
+ # or little, then it must be this?
AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
[Define if C doubles are 64-bit IEEE 754 binary format, stored
in ARM mixed-endian order (byte order 45670123)])
diff --git a/m4/ax_c_float_words_bigendian.m4 b/m4/ax_c_float_words_bigendian.m4
new file mode 100644
index 0000000000000..216b90d803187
--- /dev/null
+++ b/m4/ax_c_float_words_bigendian.m4
@@ -0,0 +1,83 @@
+# ===============================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_c_float_words_bigendian.html
+# ===============================================================================
+#
+# SYNOPSIS
+#
+# AX_C_FLOAT_WORDS_BIGENDIAN([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
+#
+# DESCRIPTION
+#
+# Checks the ordering of words within a multi-word float. This check is
+# necessary because on some systems (e.g. certain ARM systems), the float
+# word ordering can be different from the byte ordering. In a multi-word
+# float context, "big-endian" implies that the word containing the sign
+# bit is found in the memory location with the lowest address. This
+# implementation was inspired by the AC_C_BIGENDIAN macro in autoconf.
+#
+# The endianness is detected by first compiling C code that contains a
+# special double float value, then grepping the resulting object file for
+# certain strings of ASCII values. The double is specially crafted to have
+# a binary representation that corresponds with a simple string. In this
+# implementation, the string "noonsees" was selected because the
+# individual word values ("noon" and "sees") are palindromes, thus making
+# this test byte-order agnostic. If grep finds the string "noonsees" in
+# the object file, the target platform stores float words in big-endian
+# order. If grep finds "seesnoon", float words are in little-endian order.
+# If neither value is found, the user is instructed to specify the
+# ordering.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Daniel Amelang <dan@amelang.net>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 11
+
+AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN],
+ [AC_CACHE_CHECK(whether float word ordering is bigendian,
+ ax_cv_c_float_words_bigendian, [
+
+ax_cv_c_float_words_bigendian=unknown
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+
+double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0;
+
+]])], [
+
+if grep noonsees conftest.$ac_objext >/dev/null ; then
+ ax_cv_c_float_words_bigendian=yes
+fi
+if grep seesnoon conftest.$ac_objext >/dev/null ; then
+ if test "$ax_cv_c_float_words_bigendian" = unknown; then
+ ax_cv_c_float_words_bigendian=no
+ else
+ ax_cv_c_float_words_bigendian=unknown
+ fi
+fi
+
+])])
+
+case $ax_cv_c_float_words_bigendian in
+ yes)
+ m4_default([$1],
+ [AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1,
+ [Define to 1 if your system stores words within floats
+ with the most significant word first])]) ;;
+ no)
+ $2 ;;
+ *)
+ m4_default([$3],
+ [AC_MSG_ERROR([
+
+Unknown float word ordering. You need to manually preset
+ax_cv_c_float_words_bigendian=no (or yes) according to your system.
+
+ ])]) ;;
+esac
+
+])# AX_C_FLOAT_WORDS_BIGENDIAN

View file

@ -1,218 +0,0 @@
From b3b8cb419e496629873fa7dda82a01863f58617a Mon Sep 17 00:00:00 2001
From: Benjamin Peterson <benjamin@python.org>
Date: Tue, 18 Sep 2018 23:49:05 -0700
Subject: [PATCH] run autoconf (GH-9411)
Follow up to 2a9c3805ddedf282881ef7811a561c70b74f80b1 (bpo-34585).
---
aclocal.m4 | 1 +
configure | 146 ++++++++++++++++----------------------------------
pyconfig.h.in | 4 ++
3 files changed, 51 insertions(+), 100 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4
index 6a24d8e6b9c00..030e6877de9f7 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -288,3 +288,4 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
+m4_include([m4/ax_c_float_words_bigendian.m4])
diff --git a/configure b/configure
index 7b0c734b5e25e..38546d6ca7b40 100755
--- a/configure
+++ b/configure
@@ -13853,131 +13853,77 @@ fi
# * Check for various properties of floating point *
# **************************************************
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are little-endian IEEE 754 binary64" >&5
-$as_echo_n "checking whether C doubles are little-endian IEEE 754 binary64... " >&6; }
-if ${ac_cv_little_endian_double+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether float word ordering is bigendian" >&5
+$as_echo_n "checking whether float word ordering is bigendian... " >&6; }
+if ${ax_cv_c_float_words_bigendian+:} false; then :
$as_echo_n "(cached) " >&6
else
-if test "$cross_compiling" = yes; then :
- ac_cv_little_endian_double=no
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+ax_cv_c_float_words_bigendian=unknown
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <string.h>
-int main() {
- double x = 9006104071832581.0;
- if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
- return 0;
- else
- return 1;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- ac_cv_little_endian_double=yes
-else
- ac_cv_little_endian_double=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
+double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0;
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_little_endian_double" >&5
-$as_echo "$ac_cv_little_endian_double" >&6; }
-if test "$ac_cv_little_endian_double" = yes
-then
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
-$as_echo "#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1" >>confdefs.h
+if grep noonsees conftest.$ac_objext >/dev/null ; then
+ ax_cv_c_float_words_bigendian=yes
+fi
+if grep seesnoon conftest.$ac_objext >/dev/null ; then
+ if test "$ax_cv_c_float_words_bigendian" = unknown; then
+ ax_cv_c_float_words_bigendian=no
+ else
+ ax_cv_c_float_words_bigendian=unknown
+ fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are big-endian IEEE 754 binary64" >&5
-$as_echo_n "checking whether C doubles are big-endian IEEE 754 binary64... " >&6; }
-if ${ac_cv_big_endian_double+:} false; then :
- $as_echo_n "(cached) " >&6
-else
-
-if test "$cross_compiling" = yes; then :
- ac_cv_big_endian_double=no
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <string.h>
-int main() {
- double x = 9006104071832581.0;
- if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
- return 0;
- else
- return 1;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- ac_cv_big_endian_double=yes
-else
- ac_cv_big_endian_double=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_c_float_words_bigendian" >&5
+$as_echo "$ax_cv_c_float_words_bigendian" >&6; }
-fi
+case $ax_cv_c_float_words_bigendian in
+ yes)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_big_endian_double" >&5
-$as_echo "$ac_cv_big_endian_double" >&6; }
-if test "$ac_cv_big_endian_double" = yes
-then
+$as_echo "#define FLOAT_WORDS_BIGENDIAN 1" >>confdefs.h
+ ;;
+ no)
+ ;;
+ *)
+ as_fn_error $? "
-$as_echo "#define DOUBLE_IS_BIG_ENDIAN_IEEE754 1" >>confdefs.h
+Unknown float word ordering. You need to manually preset
+ax_cv_c_float_words_bigendian=no (or yes) according to your system.
-fi
+ " "$LINENO" 5 ;;
+esac
-# Some ARM platforms use a mixed-endian representation for doubles.
-# While Python doesn't currently have full support for these platforms
-# (see e.g., issue 1762561), we can at least make sure that float <-> string
-# conversions work.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are ARM mixed-endian IEEE 754 binary64" >&5
-$as_echo_n "checking whether C doubles are ARM mixed-endian IEEE 754 binary64... " >&6; }
-if ${ac_cv_mixed_endian_double+:} false; then :
- $as_echo_n "(cached) " >&6
-else
-if test "$cross_compiling" = yes; then :
- ac_cv_mixed_endian_double=no
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
+if test "$ax_cv_c_float_words_bigendian" = "yes"
+then
-#include <string.h>
-int main() {
- double x = 9006104071832581.0;
- if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
- return 0;
- else
- return 1;
-}
+$as_echo "#define DOUBLE_IS_BIG_ENDIAN_IEEE754 1" >>confdefs.h
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- ac_cv_mixed_endian_double=yes
-else
- ac_cv_mixed_endian_double=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
+elif test "$ax_cv_c_float_words_bigendian" = "no"
+then
-fi
+$as_echo "#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1" >>confdefs.h
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mixed_endian_double" >&5
-$as_echo "$ac_cv_mixed_endian_double" >&6; }
-if test "$ac_cv_mixed_endian_double" = yes
-then
+else
+ # Some ARM platforms use a mixed-endian representation for doubles.
+ # While Python doesn't currently have full support for these platforms
+ # (see e.g., issue 1762561), we can at least make sure that float <-> string
+ # conversions work.
+ # FLOAT_WORDS_BIGENDIAN doesnt actually detect this case, but if it's not big
+ # or little, then it must be this?
$as_echo "#define DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 1" >>confdefs.h
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 360f79994fafe..41e0479cad2e3 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -30,6 +30,10 @@
/* Define if --enable-ipv6 is specified */
#undef ENABLE_IPV6
+/* Define to 1 if your system stores words within floats with the most
+ significant word first */
+#undef FLOAT_WORDS_BIGENDIAN
+
/* Define if flock needs to be linked with bsd library. */
#undef FLOCK_NEEDS_LIBBSD