summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authorriastradh <riastradh@pkgsrc.org>2022-04-03 10:54:52 +0000
committerriastradh <riastradh@pkgsrc.org>2022-04-03 10:54:52 +0000
commit7ab0c9d18b01ad9db7757bb5d35a4d0b1b59b982 (patch)
treefbabcd5ab2f97011dee23259d555a2d0de5ba26a /lang
parentce3ca66da2e87e33b92c870d47e1418d601252ec (diff)
downloadpkgsrc-7ab0c9d18b01ad9db7757bb5d35a4d0b1b59b982.tar.gz
lang/python310: Make it cross-compile.
Diffstat (limited to 'lang')
-rw-r--r--lang/python310/Makefile23
-rw-r--r--lang/python310/distinfo6
-rw-r--r--lang/python310/patches/patch-configure20
-rw-r--r--lang/python310/patches/patch-setup.py43
4 files changed, 68 insertions, 24 deletions
diff --git a/lang/python310/Makefile b/lang/python310/Makefile
index 29efac6d5ff..b0fd9df787d 100644
--- a/lang/python310/Makefile
+++ b/lang/python310/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.12 2022/03/19 18:59:40 adam Exp $
+# $NetBSD: Makefile,v 1.13 2022/04/03 10:54:52 riastradh Exp $
.include "dist.mk"
@@ -36,6 +36,27 @@ PTHREAD_OPTS+= require
.include "../../mk/bsd.prefs.mk"
+.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
+TOOL_DEPENDS+= ${PKGNAME}:../../${PKGPATH}
+# XXX copied from ../../lang/python/pyversion.mk to avoid including it
+# XXX should use NATIVE_PREFIX but we don't have that
+CONFIGURE_ARGS+= PYTHON_FOR_BUILD=${PREFIX:Q}/bin/python3.10
+CONFIGURE_ARGS+= MACHDEP=${PY_PLATNAME}
+CONFIGURE_ARGS+= \
+ _PYTHON_HOST_PLATFORM=${LOWER_OPSYS}-${MACHINE_GNU_ARCH}
+CONFIGURE_ARGS+= ac_sys_system=${OPSYS}
+. if ${OPSYS} == "OSF1"
+CONFIGURE_ARGS+= ac_cv_buggy_getaddrinfo=true
+. else
+CONFIGURE_ARGS+= ac_cv_buggy_getaddrinfo=false
+. endif
+CONFIGURE_ARGS.NetBSD+= ac_cv_file__dev_ptmx=yes
+CONFIGURE_ARGS.NetBSD+= ac_cv_file__dev_ptc=no
+MAKE_ENV+= \
+ _PYTHON_HOST_PLATFORM=${LOWER_OPSYS}-${MACHINE_GNU_ARCH}
+MAKE_ENV+= _PYTHON_PROJECT_BASE=${WRKSRC:Q}
+.endif
+
# http://bugs.python.org/issue13241
.if !empty(MACHINE_PLATFORM:MDarwin-1[12].*)
PKGSRC_COMPILER= clang
diff --git a/lang/python310/distinfo b/lang/python310/distinfo
index 3c8d260647d..fae84b30635 100644
--- a/lang/python310/distinfo
+++ b/lang/python310/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.14 2022/03/25 17:55:19 adam Exp $
+$NetBSD: distinfo,v 1.15 2022/04/03 10:54:52 riastradh Exp $
BLAKE2s (Python-3.10.4.tar.xz) = 764967513abd194f54dbed2ef7520c1aeca19628627337947542b24c1ac50bb3
SHA512 (Python-3.10.4.tar.xz) = 6c9aeecddc55c7896b2e8527fca131c7b2b6127d56ce1a001ccedfebf590334e0c0bb7c517ed3cf1da3c1910e002552b56aa7e03eeb672f42ff0bd8150799113
@@ -11,6 +11,6 @@ SHA1 (patch-Makefile.pre.in) = 932a89313e8f26c435675f2487eb2141876a5f5a
SHA1 (patch-Modules_socketmodule.c) = 3e2db474b4ef08edd25528465605fff1d3d0f61b
SHA1 (patch-Modules_socketmodule.h) = 8761c7238bc74e45adefb6e647dc3b39b7bdd81c
SHA1 (patch-Python_thread__pthread.h) = bf1aeab011b3afedc02e68fcf5cef091b3e0aefa
-SHA1 (patch-configure) = b238289b98d85128d0b0ad02ce926e36c0febc02
+SHA1 (patch-configure) = 8ffe98e51407d10e46e7d1531f2e0e0b58e1cfa6
SHA1 (patch-pyconfig.h.in) = 1ab77914315acbf0352d242ed66200bea54548f6
-SHA1 (patch-setup.py) = 491b5ff230dd6393fabe787b429a131c88a14f45
+SHA1 (patch-setup.py) = f71085603ac5d343ee60c1d18f4f4bde0791fa6b
diff --git a/lang/python310/patches/patch-configure b/lang/python310/patches/patch-configure
index e683aa61e42..e55bb7ca6b5 100644
--- a/lang/python310/patches/patch-configure
+++ b/lang/python310/patches/patch-configure
@@ -1,13 +1,23 @@
-$NetBSD: patch-configure,v 1.3 2022/01/15 16:23:47 adam Exp $
+$NetBSD: patch-configure,v 1.4 2022/04/03 10:54:52 riastradh Exp $
Use gnu99 instead of c99 to avoid "alloca() undefined" problems.
Fix linking on Darwin; don't use -stack_size.
Changes for consistency across pkgsrc platforms.
Simplify _sysconfigdata to include only platform name.
detect netcan/can.h on NetBSD
+Disable barrier to cross-compilation.
---- configure.orig 2022-01-13 18:52:14.000000000 +0000
+--- configure.orig 2022-03-23 20:12:04.000000000 +0000
+++ configure
+@@ -3380,7 +3380,7 @@ fi
+ $as_echo "\"$MACHDEP\"" >&6; }
+
+
+-if test "$cross_compiling" = yes; then
++if false && test "$cross_compiling" = yes; then
+ case "$host" in
+ *-*-linux*)
+ case "$host_cpu" in
@@ -7051,7 +7051,7 @@ UNIVERSAL_ARCH_FLAGS=
# tweak BASECFLAGS based on compiler and platform
case $GCC in
@@ -35,7 +45,7 @@ detect netcan/can.h on NetBSD
# Sizes and alignments of various common basic types
-@@ -14762,10 +14773,10 @@ _ACEOF
+@@ -14729,10 +14740,10 @@ _ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
@@ -48,7 +58,7 @@ detect netcan/can.h on NetBSD
if test "$ax_cv_c_float_words_bigendian" = unknown; then
ax_cv_c_float_words_bigendian=no
else
-@@ -15666,7 +15677,7 @@ _ACEOF
+@@ -15633,7 +15644,7 @@ _ACEOF
fi
@@ -57,7 +67,7 @@ detect netcan/can.h on NetBSD
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LDVERSION" >&5
$as_echo_n "checking LDVERSION... " >&6; }
-@@ -15719,11 +15730,7 @@ fi
+@@ -15686,11 +15697,7 @@ fi
diff --git a/lang/python310/patches/patch-setup.py b/lang/python310/patches/patch-setup.py
index 41b931428f4..6e38c3da2d2 100644
--- a/lang/python310/patches/patch-setup.py
+++ b/lang/python310/patches/patch-setup.py
@@ -1,15 +1,28 @@
-$NetBSD: patch-setup.py,v 1.4 2022/01/14 10:32:28 tnn Exp $
+$NetBSD: patch-setup.py,v 1.5 2022/04/03 10:54:52 riastradh Exp $
Disable certain modules, so they can be built as separate packages.
Do not look for ncursesw.
Assume panel_library is correct; this is a fix for ncurses' gnupanel
which will get transformed to panel in buildlink.
Don't search for modules in PREFIX. Fixes build failure when py-setuptools
- are installed.
+ are installed.
+Enable cross-build by setting sys._home and sys.path to build directory
---- setup.py.orig 2021-12-06 18:23:39.000000000 +0000
+--- setup.py.orig 2022-03-23 20:12:04.000000000 +0000
+++ setup.py
-@@ -13,6 +13,7 @@ import warnings
+@@ -1,5 +1,11 @@
+ # Autodetecting setup.py script for building the Python extensions
+
++import sys
++sys._home = __file__[:-len('/setup.py')]
++sys.path.append(__file__[:-len('/setup.py')] + '/Lib')
++with open('pybuilddir.txt') as pybuilddir:
++ sys.path.append(__file__[:-len('/setup.py')] + '/' + next(pybuilddir))
++
+ import argparse
+ import importlib._bootstrap
+ import importlib.machinery
+@@ -13,6 +19,7 @@ import warnings
from glob import glob, escape
import _osx_support
@@ -17,7 +30,7 @@ Don't search for modules in PREFIX. Fixes build failure when py-setuptools
try:
import subprocess
-@@ -45,6 +46,7 @@ with warnings.catch_warnings():
+@@ -45,6 +52,7 @@ with warnings.catch_warnings():
DeprecationWarning
)
@@ -25,7 +38,7 @@ Don't search for modules in PREFIX. Fixes build failure when py-setuptools
from distutils.command.build_ext import build_ext
from distutils.command.build_scripts import build_scripts
from distutils.command.install import install
-@@ -58,7 +60,7 @@ with warnings.catch_warnings():
+@@ -58,7 +66,7 @@ with warnings.catch_warnings():
TEST_EXTENSIONS = (sysconfig.get_config_var('TEST_MODULES') == 'yes')
# This global variable is used to hold the list of modules to be disabled.
@@ -34,7 +47,7 @@ Don't search for modules in PREFIX. Fixes build failure when py-setuptools
# --list-module-names option used by Tools/scripts/generate_module_names.py
LIST_MODULE_NAMES = False
-@@ -249,6 +251,16 @@ def grep_headers_for(function, headers):
+@@ -249,6 +257,16 @@ def grep_headers_for(function, headers):
return False
@@ -51,7 +64,7 @@ Don't search for modules in PREFIX. Fixes build failure when py-setuptools
def find_file(filename, std_dirs, paths):
"""Searches for the directory where a given file is located,
and returns a possibly-empty list of additional directories, or None
-@@ -821,15 +833,15 @@ class PyBuildExt(build_ext):
+@@ -823,15 +841,15 @@ class PyBuildExt(build_ext):
add_dir_to_list(dir_list, directory)
def configure_compiler(self):
@@ -76,7 +89,7 @@ Don't search for modules in PREFIX. Fixes build failure when py-setuptools
self.add_multiarch_paths()
self.add_ldflags_cppflags()
-@@ -877,6 +889,9 @@ class PyBuildExt(build_ext):
+@@ -879,6 +897,9 @@ class PyBuildExt(build_ext):
self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
if MACOS:
@@ -86,7 +99,7 @@ Don't search for modules in PREFIX. Fixes build failure when py-setuptools
# 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.
-@@ -1104,8 +1119,6 @@ class PyBuildExt(build_ext):
+@@ -1106,8 +1127,6 @@ class PyBuildExt(build_ext):
# use the same library for the readline and curses modules.
if 'curses' in readline_termcap_library:
curses_library = readline_termcap_library
@@ -95,7 +108,7 @@ Don't search for modules in PREFIX. Fixes build failure when py-setuptools
# Issue 36210: OSS provided ncurses does not link on AIX
# Use IBM supplied 'curses' for successful build of _curses
elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
-@@ -1209,8 +1222,7 @@ class PyBuildExt(build_ext):
+@@ -1211,8 +1230,7 @@ class PyBuildExt(build_ext):
# If the curses module is enabled, check for the panel module
# _curses_panel needs some form of ncurses
skip_curses_panel = True if AIX else False
@@ -105,7 +118,7 @@ Don't search for modules in PREFIX. Fixes build failure when py-setuptools
self.add(Extension('_curses_panel', ['_curses_panel.c'],
include_dirs=curses_includes,
define_macros=curses_defines,
-@@ -1455,6 +1467,31 @@ class PyBuildExt(build_ext):
+@@ -1457,6 +1475,31 @@ class PyBuildExt(build_ext):
dbm_order = ['gdbm']
# The standard Unix dbm module:
if not CYGWIN:
@@ -137,7 +150,7 @@ Don't search for modules in PREFIX. Fixes build failure when py-setuptools
config_args = [arg.strip("'")
for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
dbm_args = [arg for arg in config_args
-@@ -1466,7 +1503,7 @@ class PyBuildExt(build_ext):
+@@ -1468,7 +1511,7 @@ class PyBuildExt(build_ext):
dbmext = None
for cand in dbm_order:
if cand == "ndbm":
@@ -146,7 +159,7 @@ Don't search for modules in PREFIX. Fixes build failure when py-setuptools
# Some systems have -lndbm, others have -lgdbm_compat,
# others don't have either
if self.compiler.find_library_file(self.lib_dirs,
-@@ -2326,10 +2363,7 @@ class PyBuildExt(build_ext):
+@@ -2328,10 +2371,7 @@ class PyBuildExt(build_ext):
sources = ['_decimal/_decimal.c']
depends = ['_decimal/docstrings.h']
else:
@@ -158,7 +171,7 @@ Don't search for modules in PREFIX. Fixes build failure when py-setuptools
libraries = ['m']
sources = [
'_decimal/_decimal.c',
-@@ -2745,7 +2779,7 @@ def main():
+@@ -2747,7 +2787,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