pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/python310 lang/python310: Make it cross-compile.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/83e1647669e6
branches:  trunk
changeset: 376184:83e1647669e6
user:      riastradh <riastradh%pkgsrc.org@localhost>
date:      Sun Apr 03 10:54:52 2022 +0000

description:
lang/python310: Make it cross-compile.

diffstat:

 lang/python310/Makefile                |  23 +++++++++++++++++-
 lang/python310/distinfo                |   6 ++--
 lang/python310/patches/patch-configure |  20 +++++++++++---
 lang/python310/patches/patch-setup.py  |  43 ++++++++++++++++++++++-----------
 4 files changed, 68 insertions(+), 24 deletions(-)

diffs (246 lines):

diff -r b981bc56a245 -r 83e1647669e6 lang/python310/Makefile
--- a/lang/python310/Makefile   Sun Apr 03 10:51:19 2022 +0000
+++ b/lang/python310/Makefile   Sun Apr 03 10:54:52 2022 +0000
@@ -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 @@
 
 .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 -r b981bc56a245 -r 83e1647669e6 lang/python310/distinfo
--- a/lang/python310/distinfo   Sun Apr 03 10:51:19 2022 +0000
+++ b/lang/python310/distinfo   Sun Apr 03 10:54:52 2022 +0000
@@ -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-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 -r b981bc56a245 -r 83e1647669e6 lang/python310/patches/patch-configure
--- a/lang/python310/patches/patch-configure    Sun Apr 03 10:51:19 2022 +0000
+++ b/lang/python310/patches/patch-configure    Sun Apr 03 10:54:52 2022 +0000
@@ -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 @@
  
  
  # 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 @@
    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 @@
  
  { $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 -r b981bc56a245 -r 83e1647669e6 lang/python310/patches/patch-setup.py
--- a/lang/python310/patches/patch-setup.py     Sun Apr 03 10:51:19 2022 +0000
+++ b/lang/python310/patches/patch-setup.py     Sun Apr 03 10:54:52 2022 +0000
@@ -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 @@
  
  try:
      import subprocess
-@@ -45,6 +46,7 @@ with warnings.catch_warnings():
+@@ -45,6 +52,7 @@ with warnings.catch_warnings():
          DeprecationWarning
      )
  
@@ -25,7 +38,7 @@
      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 @@
  
  # --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 @@
  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 @@
          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 @@
              # 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 @@
          # 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 @@
              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 @@
              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 @@
                          # 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 @@
              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



Home | Main Index | Thread Index | Old Index