summaryrefslogtreecommitdiff
path: root/package/python2
diff options
context:
space:
mode:
Diffstat (limited to 'package/python2')
-rw-r--r--package/python2/Makefile150
-rw-r--r--package/python2/files/patch-Lib_distutils_sysconfig_py10
-rw-r--r--package/python2/files/python-config.patch21
-rw-r--r--package/python2/patches/0001-2.7-bpo-33127-Compatibility-patch-for-LibreSSL-2.7.0.patch79
-rw-r--r--package/python2/patches/patch-Makefile_pre_in40
-rw-r--r--package/python2/patches/patch-configure_ac22
-rw-r--r--package/python2/patches/patch-setup_py115
7 files changed, 0 insertions, 437 deletions
diff --git a/package/python2/Makefile b/package/python2/Makefile
deleted file mode 100644
index 358866b0f..000000000
--- a/package/python2/Makefile
+++ /dev/null
@@ -1,150 +0,0 @@
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-
-include ${ADK_TOPDIR}/rules.mk
-
-PKG_NAME:= python2
-PKG_VERSION:= 2.7.14
-PKG_RELEASE:= 1
-PKG_HASH:= 304c9b202ea6fbd0a4a8e0ad3733715fbd4749f2204a9173a58ec53c32ea73e8
-PKG_DESCR:= python2 script interpreter
-PKG_SECTION:= dev/lang
-PKG_DEPENDS:= libffi
-PKG_BUILDDEP:= libffi python2-host
-HOST_BUILDDEP:= libffi-host libressl-host
-PKG_NEEDS:= threads
-PKG_URL:= http://www.python.org/
-PKG_SITES:= http://www.python.org/ftp/python/${PKG_VERSION}/
-PKG_OPTS:= dev
-
-DISTFILES:= Python-${PKG_VERSION}.tgz
-WRKDIST= ${WRKDIR}/Python-${PKG_VERSION}
-
-PKG_FLAVOURS_PYTHON2:= MOD_ZLIB MOD_BZ2 MOD_EXPAT MOD_SQLITE MOD_GDBM
-PKG_FLAVOURS_PYTHON2+= MOD_NCURSES MOD_SSL MOD_READLINE
-
-PKGFD_MOD_ZLIB:= zlib support
-PKGFB_MOD_ZLIB:= zlib
-PKGFS_MOD_ZLIB:= zlib
-PKGFD_MOD_BZ2:= bzip2 support
-PKGFB_MOD_BZ2:= bzip2
-PKGFS_MOD_BZ2:= libbz2
-PKGFD_MOD_EXPAT:= xml support
-PKGFB_MOD_EXPAT:= expat
-PKGFS_MOD_EXPAT:= libexpat
-PKGFD_MOD_SQLITE:= sqlite support
-PKGFB_MOD_SQLITE:= sqlite
-PKGFS_MOD_SQLITE:= libsqlite
-PKGFD_MOD_GDBM:= gdbm support
-PKGFB_MOD_GDBM:= gdbm
-PKGFS_MOD_GDBM:= libgdbm
-PKGFD_MOD_NCURSES:= ncurses support
-PKGFB_MOD_NCURSES:= ncurses
-PKGFS_MOD_NCURSES:= libncurses
-PKGFD_MOD_READLINE:= readline support
-PKGFB_MOD_READLINE:= readline
-PKGFS_MOD_READLINE:= libreadline
-PKGFD_MOD_SSL:= ssl support
-PKGFB_MOD_SSL:= libressl
-PKGFS_MOD_SSL:= libressl
-
-include ${ADK_TOPDIR}/mk/host.mk
-include ${ADK_TOPDIR}/mk/package.mk
-
-$(eval $(call HOST_template,PYTHON2,python2,${PKG_VERSION}-${PKG_RELEASE}))
-$(eval $(call PKG_template,PYTHON2,python2,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
-
-define PKG_mod_template
-
-INSTALL_MODS_$${ADK_PACKAGE_${1}}+= ${2}-install
-
-${2}-install:
- ${INSTALL_DIR} $$(IDIR_$(1))/usr/lib/python2.7/lib-dynload
- for m in ${2}; do \
- ${INSTALL_DATA} $(WRKINST)/usr/lib/python2.7/lib-dynload/$$$${m}*.so $$(IDIR_$(1))/usr/lib/python2.7/lib-dynload ;\
- done
-endef
-
-$(eval $(call PKG_template,PYTHON2_MOD_ZLIB,python2-mod-zlib,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_ZLIB},${PKGFD_MOD_ZLIB},${PKG_SECTION}))
-$(eval $(call PKG_template,PYTHON2_MOD_BZ2,python2-mod-bz2,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_BZ2},${PKGFD_MOD_BZ2},${PKG_SECTION}))
-$(eval $(call PKG_template,PYTHON2_MOD_EXPAT,python2-mod-expat,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_EXPAT},${PKGFD_MOD_EXPAT},${PKG_SECTION}))
-$(eval $(call PKG_template,PYTHON2_MOD_SQLITE,python2-mod-sqlite,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_SQLITE},${PKGFD_MOD_SQLITE},${PKG_SECTION}))
-$(eval $(call PKG_template,PYTHON2_MOD_GDBM,python2-mod-gdbm,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_GDBM},${PKGFD_MOD_GDBM},${PKG_SECTION}))
-$(eval $(call PKG_template,PYTHON2_MOD_NCURSES,python2-mod-ncurses,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_NCURSES},${PKGFD_MOD_NCURSES},${PKG_SECTION}))
-$(eval $(call PKG_template,PYTHON2_MOD_SSL,python2-mod-ssl,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_SSL},${PKGFD_MOD_SSL},${PKG_SECTION}))
-$(eval $(call PKG_template,PYTHON2_MOD_READLINE,python2-mod-readline,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_READLINE},${PKGFD_MOD_READLINE},${PKG_SECTION}))
-
-$(eval $(call PKG_mod_template,PYTHON2_MOD_ZLIB,zlib))
-$(eval $(call PKG_mod_template,PYTHON2_MOD_BZ2,bz2))
-$(eval $(call PKG_mod_template,PYTHON2_MOD_EXPAT,pyexpat))
-$(eval $(call PKG_mod_template,PYTHON2_MOD_SQLITE,_sqlite))
-$(eval $(call PKG_mod_template,PYTHON2_MOD_GDBM,gdbm))
-$(eval $(call PKG_mod_template,PYTHON2_MOD_NCURSES,_curses))
-$(eval $(call PKG_mod_template,PYTHON2_MOD_SSL,_ssl))
-$(eval $(call PKG_mod_template,PYTHON2_MOD_READLINE,readline))
-
-ifeq ($(ADK_TARGET_USE_STATIC_LIBS_ONLY),y)
-CONFIGURE_ARGS+= --disable-shared
-endif
-
-HOST_CFLAGS+= -fPIC
-
-AUTOTOOL_STYLE:= autoreconf
-CONFIGURE_ENV+= ac_cv_have_long_long_format=yes \
- ac_cv_file__dev_ptmx=yes \
- ac_cv_file__dev_ptc=no
-CONFIGURE_ARGS+= --with-threads \
- --disable-toolbox-glue \
- --disable-ipv6 \
- --with-system-ffi \
- --without-cxx-main
-
-HOST_CONFIGURE_ENV+= MACOSX_DEPLOYMENT_TARGET=10.9
-HOST_CONFIGURE_ARGS+= --with-threads \
- --with-system-ffi \
- --disable-ipv6 \
- --disable-toolbox-glue \
- --without-cxx-main
-
-hostpre-configure:
- $(CP) $(ADK_TOPDIR)/package/python2/files/patch-Lib_distutils_sysconfig_py $(WRKBUILD)
- $(SED) "s#@@STAGING_TARGET_DIR@@#$(STAGING_TARGET_DIR)#" $(WRKBUILD)/patch-Lib_distutils_sysconfig_py
- $(SED) "s#@@STAGING_HOST_DIR@@#$(STAGING_HOST_DIR)#" $(WRKBUILD)/patch-Lib_distutils_sysconfig_py
- (cd $(WRKBUILD) && ${PATCHP0} < patch-Lib_distutils_sysconfig_py)
- $(SED) "s#@EXENAME@#$(STAGING_HOST_DIR)/usr/bin/python#" \
- $(WRKBUILD)/Misc/python-config.in
-
-hostpost-install:
- $(CP) $(ADK_TOPDIR)/package/python2/files/python-config.patch $(WRKBUILD)/
- $(SED) "s#@@STAGING_TARGET_DIR@@#$(STAGING_TARGET_DIR)#" $(WRKBUILD)/python-config.patch
- $(SED) "s#@@STAGING_HOST_DIR@@#$(STAGING_HOST_DIR)#" $(WRKBUILD)/python-config.patch
- (cd $(STAGING_HOST_DIR)/usr/bin && \
- ${PATCHP0} < $(WRKBUILD)/python-config.patch)
-
-pre-configure:
- $(CP) $(ADK_TOPDIR)/package/python2/files/patch-Lib_distutils_sysconfig_py $(WRKBUILD)
- $(SED) "s#@@STAGING_TARGET_DIR@@#$(STAGING_TARGET_DIR)#" $(WRKBUILD)/patch-Lib_distutils_sysconfig_py
- $(SED) "s#@@STAGING_HOST_DIR@@#$(STAGING_HOST_DIR)#" $(WRKBUILD)/patch-Lib_distutils_sysconfig_py
- (cd $(WRKBUILD) && ${PATCHP0} <$(WRKBUILD)/patch-Lib_distutils_sysconfig_py)
- $(SED) "s#@EXENAME@#$(STAGING_HOST_DIR)/usr/bin/python#" \
- $(WRKBUILD)/Misc/python-config.in
-
-ifeq ($(ADK_TARGET_USE_STATIC_LIBS_ONLY),y)
-python2-install:
-else
-python2-install: ${INSTALL_MODS_y} ${INSTALL_MODS_m}
-endif
- ${INSTALL_DIR} ${IDIR_PYTHON2}/usr/bin ${IDIR_PYTHON2}/usr/lib
- ${INSTALL_DIR} ${IDIR_PYTHON2}/usr/include/python2.7
- ${INSTALL_BIN} ${WRKINST}/usr/bin/python ${IDIR_PYTHON2}/usr/bin
- ${INSTALL_DIR} ${IDIR_PYTHON2}/usr/lib/python2.7
- ${CP} ${WRKINST}/usr/lib/libpython*.* ${IDIR_PYTHON2}/usr/lib
- ${CP} ${WRKINST}/usr/lib/python2.7/* ${IDIR_PYTHON2}/usr/lib/python2.7
- ${CP} ${WRKINST}/usr/include/python2.7/pyconfig.h \
- ${IDIR_PYTHON2}/usr/include/python2.7
- @-for i in zlib bz2 _curses _ssl gdbm _sqlite pyexpat readline; do \
- rm ${IDIR_PYTHON2}/usr/lib/python2.7/lib-dynload/$${i}*so 2>/dev/null; \
- done
-
-include ${ADK_TOPDIR}/mk/host-bottom.mk
-include ${ADK_TOPDIR}/mk/pkg-bottom.mk
diff --git a/package/python2/files/patch-Lib_distutils_sysconfig_py b/package/python2/files/patch-Lib_distutils_sysconfig_py
deleted file mode 100644
index cbd51020d..000000000
--- a/package/python2/files/patch-Lib_distutils_sysconfig_py
+++ /dev/null
@@ -1,10 +0,0 @@
---- Lib.orig/distutils/sysconfig.py 2013-05-12 05:32:42.000000000 +0200
-+++ Lib/distutils/sysconfig.py 2013-11-03 18:03:53.000000000 +0100
-@@ -76,6 +76,7 @@ def get_python_inc(plat_specific=0, pref
- """
- if prefix is None:
- prefix = plat_specific and EXEC_PREFIX or PREFIX
-+ prefix = re.sub('@@STAGING_HOST_DIR@@', '@@STAGING_TARGET_DIR@@', prefix)
-
- if os.name == "posix":
- if python_build:
diff --git a/package/python2/files/python-config.patch b/package/python2/files/python-config.patch
deleted file mode 100644
index 0a6ff7145..000000000
--- a/package/python2/files/python-config.patch
+++ /dev/null
@@ -1,21 +0,0 @@
---- python2.7-config.orig 2013-12-11 12:40:37.244519764 +0100
-+++ python2.7-config 2013-12-11 12:41:43.279093075 +0100
-@@ -3,6 +3,7 @@
- import sys
- import os
- import getopt
-+import re
- from distutils import sysconfig
-
- valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
-@@ -37,8 +38,8 @@
- print sysconfig.EXEC_PREFIX
-
- elif opt in ('--includes', '--cflags'):
-- flags = ['-I' + sysconfig.get_python_inc(),
-- '-I' + sysconfig.get_python_inc(plat_specific=True)]
-+ flags = ['-I' + re.sub('@@STAGING_TARGET_DIR@@', '@@STAGING_HOST_DIR@@', sysconfig.get_python_inc()),
-+ '-I' + re.sub('@@STAGING_TARGET_DIR@@', '@@STAGING_HOST_DIR@@', sysconfig.get_python_inc(plat_specific=True))]
- if opt == '--cflags':
- flags.extend(getvar('CFLAGS').split())
- print ' '.join(flags)
diff --git a/package/python2/patches/0001-2.7-bpo-33127-Compatibility-patch-for-LibreSSL-2.7.0.patch b/package/python2/patches/0001-2.7-bpo-33127-Compatibility-patch-for-LibreSSL-2.7.0.patch
deleted file mode 100644
index e5759db40..000000000
--- a/package/python2/patches/0001-2.7-bpo-33127-Compatibility-patch-for-LibreSSL-2.7.0.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From edd541897b9c28ee0d0f0131746aa5f19665a104 Mon Sep 17 00:00:00 2001
-From: Christian Heimes <christian@python.org>
-Date: Sat, 24 Mar 2018 19:34:15 +0100
-Subject: [PATCH] [2.7] bpo-33127: Compatibility patch for LibreSSL 2.7.0
- (GH-6210) (GH-6215)
-
-LibreSSL 2.7 introduced OpenSSL 1.1.0 API. The ssl module now detects
-LibreSSL 2.7 and only provides API shims for OpenSSL < 1.1.0 and
-LibreSSL < 2.7.
-
-Documentation updates and fixes for failing tests will be provided in
-another patch set.
-
-Signed-off-by: Christian Heimes <christian@python.org>.
-(cherry picked from commit 4ca0739c9d97ac7cd45499e0d31be68dc659d0e1)
-
-Co-authored-by: Christian Heimes <christian@python.org>
----
- .../2018-03-24-15-08-24.bpo-33127.olJmHv.rst | 1 +
- Modules/_ssl.c | 24 ++++++++++++++--------
- Tools/ssl/multissltests.py | 3 ++-
- 3 files changed, 19 insertions(+), 9 deletions(-)
- create mode 100644 Misc/NEWS.d/next/Library/2018-03-24-15-08-24.bpo-33127.olJmHv.rst
-
-diff --git a/Modules/_ssl.c b/Modules/_ssl.c
-index da8b20f54f..d0ce913d3d 100644
---- a/Modules/_ssl.c
-+++ b/Modules/_ssl.c
-@@ -102,6 +102,12 @@ struct py_ssl_library_code {
-
- #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
- # define OPENSSL_VERSION_1_1 1
-+# define PY_OPENSSL_1_1_API 1
-+#endif
-+
-+/* LibreSSL 2.7.0 provides necessary OpenSSL 1.1.0 APIs */
-+#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x2070000fL
-+# define PY_OPENSSL_1_1_API 1
- #endif
-
- /* Openssl comes with TLSv1.1 and TLSv1.2 between 1.0.0h and 1.0.1
-@@ -149,16 +155,18 @@ struct py_ssl_library_code {
- #define INVALID_SOCKET (-1)
- #endif
-
--#ifdef OPENSSL_VERSION_1_1
--/* OpenSSL 1.1.0+ */
--#ifndef OPENSSL_NO_SSL2
--#define OPENSSL_NO_SSL2
--#endif
--#else /* OpenSSL < 1.1.0 */
--#if defined(WITH_THREAD)
-+/* OpenSSL 1.0.2 and LibreSSL needs extra code for locking */
-+#if !defined(OPENSSL_VERSION_1_1) && defined(WITH_THREAD)
- #define HAVE_OPENSSL_CRYPTO_LOCK
- #endif
-
-+#if defined(OPENSSL_VERSION_1_1) && !defined(OPENSSL_NO_SSL2)
-+#define OPENSSL_NO_SSL2
-+#endif
-+
-+#ifndef PY_OPENSSL_1_1_API
-+/* OpenSSL 1.1 API shims for OpenSSL < 1.1.0 and LibreSSL < 2.7.0 */
-+
- #define TLS_method SSLv23_method
-
- static int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne)
-@@ -201,7 +209,7 @@ static X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *store)
- {
- return store->param;
- }
--#endif /* OpenSSL < 1.1.0 or LibreSSL */
-+#endif /* OpenSSL < 1.1.0 or LibreSSL < 2.7.0 */
-
-
- enum py_ssl_error {
---
-2.16.1
-
diff --git a/package/python2/patches/patch-Makefile_pre_in b/package/python2/patches/patch-Makefile_pre_in
deleted file mode 100644
index bcb0e1f6b..000000000
--- a/package/python2/patches/patch-Makefile_pre_in
+++ /dev/null
@@ -1,40 +0,0 @@
---- Python-2.7.13.orig/Makefile.pre.in 2016-12-17 21:05:06.000000000 +0100
-+++ Python-2.7.13/Makefile.pre.in 2017-03-16 19:38:14.000000000 +0100
-@@ -545,7 +545,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.tx
- esac; \
- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
- _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
-- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
-+ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py build
-
- # Build static library
- # avoid long command lines, same as LIBRARY_OBJS
-@@ -1120,28 +1120,6 @@ libinstall: build_all $(srcdir)/Lib/$(PL
- $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
- $(DESTDIR)$(LIBDEST)/distutils/tests ; \
- fi
-- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
-- $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
-- -d $(LIBDEST) -f \
-- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
-- $(DESTDIR)$(LIBDEST)
-- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
-- $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
-- -d $(LIBDEST) -f \
-- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
-- $(DESTDIR)$(LIBDEST)
-- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
-- $(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
-- -d $(LIBDEST)/site-packages -f \
-- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
-- $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
-- -d $(LIBDEST)/site-packages -f \
-- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-- -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
-
- # Create the PLATDIR source directory, if one wasn't distributed..
- $(srcdir)/Lib/$(PLATDIR):
diff --git a/package/python2/patches/patch-configure_ac b/package/python2/patches/patch-configure_ac
deleted file mode 100644
index 1a09f6eed..000000000
--- a/package/python2/patches/patch-configure_ac
+++ /dev/null
@@ -1,22 +0,0 @@
---- Python-2.7.13.orig/configure.ac 2016-12-17 21:05:07.000000000 +0100
-+++ Python-2.7.13/configure.ac 2017-03-16 19:29:41.000000000 +0100
-@@ -22,7 +22,7 @@ rm -f pybuilddir.txt
- if test "$cross_compiling" = yes; then
- AC_MSG_CHECKING([for python interpreter for cross build])
- if test -z "$PYTHON_FOR_BUILD"; then
-- for interp in python$PACKAGE_VERSION python2 python; do
-+ for interp in python; do
- which $interp >/dev/null 2>&1 || continue
- if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:>@ >= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then
- break
-@@ -1079,9 +1079,7 @@ then
- if test "$Py_DEBUG" = 'true' ; then
- # Optimization messes up debuggers, so turn it off for
- # debug builds.
-- OPT="-g -O0 -Wall $STRICT_PROTO"
-- else
-- OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
-+ OPT="$STRICT_PROTO"
- fi
- ;;
- *)
diff --git a/package/python2/patches/patch-setup_py b/package/python2/patches/patch-setup_py
deleted file mode 100644
index bf8e90c9d..000000000
--- a/package/python2/patches/patch-setup_py
+++ /dev/null
@@ -1,115 +0,0 @@
---- Python-2.7.13.orig/setup.py 2016-12-17 21:05:07.000000000 +0100
-+++ Python-2.7.13/setup.py 2017-03-16 19:45:12.000000000 +0100
-@@ -74,7 +74,7 @@ def find_file(filename, std_dirs, paths)
- 'paths' is a list of additional locations to check; if the file is
- found in one of them, the resulting list will contain the directory.
- """
-- if host_platform == 'darwin':
-+ if host_platform == 'darwin' and not cross_compiling:
- # Honor the MacOSX SDK setting when one was specified.
- # An SDK is a directory with the same structure as a real
- # system, but with only header files and libraries.
-@@ -84,7 +84,7 @@ def find_file(filename, std_dirs, paths)
- for dir in std_dirs:
- f = os.path.join(dir, filename)
-
-- if host_platform == 'darwin' and is_macosx_sdk_path(dir):
-+ if host_platform == 'darwin' and is_macosx_sdk_path(dir) and not cross_compiling:
- f = os.path.join(sysroot, dir[1:], filename)
-
- if os.path.exists(f): return []
-@@ -93,7 +93,7 @@ def find_file(filename, std_dirs, paths)
- for dir in paths:
- f = os.path.join(dir, filename)
-
-- if host_platform == 'darwin' and is_macosx_sdk_path(dir):
-+ if host_platform == 'darwin' and is_macosx_sdk_path(dir) and not cross_compiling:
- f = os.path.join(sysroot, dir[1:], filename)
-
- if os.path.exists(f):
-@@ -107,7 +107,7 @@ def find_library_file(compiler, libname,
- if result is None:
- return None
-
-- if host_platform == 'darwin':
-+ if host_platform == 'darwin' and not cross_compiling:
- sysroot = macosx_sdk_root()
-
- # Check whether the found file is in one of the standard directories
-@@ -116,7 +116,7 @@ def find_library_file(compiler, libname,
- # Ensure path doesn't end with path separator
- p = p.rstrip(os.sep)
-
-- if host_platform == 'darwin' and is_macosx_sdk_path(p):
-+ if host_platform == 'darwin' and is_macosx_sdk_path(p) and not cross_compiling:
- # Note that, as of Xcode 7, Apple SDKs may contain textual stub
- # libraries with .tbd extensions rather than the normal .dylib
- # shared libraries installed in /. The Apple compiler tool
-@@ -145,7 +145,7 @@ def find_library_file(compiler, libname,
- # Ensure path doesn't end with path separator
- p = p.rstrip(os.sep)
-
-- if host_platform == 'darwin' and is_macosx_sdk_path(p):
-+ if host_platform == 'darwin' and is_macosx_sdk_path(p) and not cross_compiling:
- if os.path.join(sysroot, p[1:]) == dirname:
- return [ p ]
-
-@@ -178,6 +178,7 @@ class PyBuildExt(build_ext):
-
- def build_extensions(self):
-
-+ self.compiler.library_dirs = []
- # Detect which modules should be compiled
- missing = self.detect_modules()
-
-@@ -299,6 +300,7 @@ class PyBuildExt(build_ext):
-
- def build_extension(self, ext):
-
-+
- if ext.name == '_ctypes':
- if not self.configure_ctypes(ext):
- return
-@@ -460,7 +462,8 @@ class PyBuildExt(build_ext):
- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
- if cross_compiling:
- self.add_gcc_paths()
-- self.add_multiarch_paths()
-+ if not cross_compiling:
-+ self.add_multiarch_paths()
-
- # Add paths specified in the environment variables LDFLAGS and
- # CPPFLAGS for header and library files.
-@@ -497,7 +500,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
-@@ -515,8 +519,13 @@ class PyBuildExt(build_ext):
- # lib_dirs and inc_dirs are used to search for files;
- # if a file is found in one of those directories, it can
- # be assumed that no additional -I,-L directives are needed.
-+ if cross_compiling:
-+ add_dir_to_list(self.compiler.library_dirs,
-+ sysconfig.get_config_var('srcdir'))
-+
- inc_dirs = self.compiler.include_dirs[:]
- lib_dirs = self.compiler.library_dirs[:]
-+
- if not cross_compiling:
- for d in (
- '/usr/include',
-@@ -550,7 +559,7 @@ class PyBuildExt(build_ext):
- if host_platform == 'hp-ux11':
- lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
-
-- if host_platform == 'darwin':
-+ if host_platform == 'darwin' and not cross_compiling:
- # This should work on any unixy platform ;-)
- # If the user has bothered specifying additional -I and -L flags
- # in OPT and LDFLAGS we might as well use them here.