pkgsrc-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b981bc56a245
branches:  trunk
changeset: 376183:b981bc56a245
user:      riastradh <riastradh%pkgsrc.org@localhost>
date:      Sun Apr 03 10:51:19 2022 +0000

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

diffstat:

 lang/python39/Makefile                |  23 ++++++++++++++++++-
 lang/python39/distinfo                |   6 ++--
 lang/python39/patches/patch-configure |  28 ++++++++++++++++-------
 lang/python39/patches/patch-setup.py  |  41 +++++++++++++++++++++++-----------
 4 files changed, 71 insertions(+), 27 deletions(-)

diffs (266 lines):

diff -r e7c96379deed -r b981bc56a245 lang/python39/Makefile
--- a/lang/python39/Makefile    Sun Apr 03 10:33:44 2022 +0000
+++ b/lang/python39/Makefile    Sun Apr 03 10:51:19 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.19 2022/03/19 18:58:24 adam Exp $
+# $NetBSD: Makefile,v 1.20 2022/04/03 10:51:19 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.9
+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 e7c96379deed -r b981bc56a245 lang/python39/distinfo
--- a/lang/python39/distinfo    Sun Apr 03 10:33:44 2022 +0000
+++ b/lang/python39/distinfo    Sun Apr 03 10:51:19 2022 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.26 2022/03/25 17:54:37 adam Exp $
+$NetBSD: distinfo,v 1.27 2022/04/03 10:51:19 riastradh Exp $
 
 BLAKE2s (Python-3.9.12.tar.xz) = 501eaf0162b3030762c2a7e20ed83294a91afbf8b491fb560c2d5517ee9ec5a8
 SHA512 (Python-3.9.12.tar.xz) = 081981901e14149748fd35228db0b3b1d96fef227ae7404f07b8bad0fda4b02649bf31c348c94aefdaf3327565d78f9489437c2c02f647b15d41376a27a23e97
@@ -15,6 +15,6 @@
 SHA1 (patch-Modules_socketmodule.c) = 5c894f2291cdf0dd355671a1878863e0342207de
 SHA1 (patch-Modules_socketmodule.h) = 8761c7238bc74e45adefb6e647dc3b39b7bdd81c
 SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be
-SHA1 (patch-configure) = d44439b22e8444141e2632b9fd9b1f343b38b712
+SHA1 (patch-configure) = 944b8bb9601fd064333305778fb57997ce0ac531
 SHA1 (patch-pyconfig.h.in) = 2f06af7358690b46eaff404226b898962b049a0e
-SHA1 (patch-setup.py) = 58cb7c277962a89586631f8f2c953e451537690a
+SHA1 (patch-setup.py) = 12e485a46c63bfe4da3ee6f9072bdab3694830d2
diff -r e7c96379deed -r b981bc56a245 lang/python39/patches/patch-configure
--- a/lang/python39/patches/patch-configure     Sun Apr 03 10:33:44 2022 +0000
+++ b/lang/python39/patches/patch-configure     Sun Apr 03 10:51:19 2022 +0000
@@ -1,14 +1,24 @@
-$NetBSD: patch-configure,v 1.6 2021/05/22 11:36:01 bouyer Exp $
+$NetBSD: patch-configure,v 1.7 2022/04/03 10:51:19 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     2021-05-03 16:54:42.000000000 +0200
-+++ configure  2021-05-22 11:50:33.365792903 +0200
-@@ -6964,7 +6964,7 @@
+--- configure.orig     2022-03-23 21:12:08.000000000 +0000
++++ configure
+@@ -3352,7 +3352,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
+@@ -6992,7 +6992,7 @@ UNIVERSAL_ARCH_FLAGS=
  # tweak BASECFLAGS based on compiler and platform
  case $GCC in
  yes)
@@ -17,7 +27,7 @@
  
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra" >&5
  $as_echo_n "checking for -Wextra... " >&6; }
-@@ -8344,7 +8344,7 @@
+@@ -8372,7 +8372,7 @@ done
  
  
  # On Linux, can.h, can/bcm.h, can/j1939.h, can/raw.h require sys/socket.h
@@ -26,7 +36,7 @@
  do :
    as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
  ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "
-@@ -9655,7 +9655,6 @@
+@@ -9683,7 +9683,6 @@ then
                # to ensure that tests don't crash
                # Note: This matches the value of THREAD_STACK_SIZE in
                # thread_pthread.h
@@ -34,7 +44,7 @@
  
                if test "$enable_framework"
                then
-@@ -14500,10 +14499,10 @@
+@@ -14544,10 +14543,10 @@ _ACEOF
  if ac_fn_c_try_compile "$LINENO"; then :
  
  
@@ -47,7 +57,7 @@
    if test "$ax_cv_c_float_words_bigendian" = unknown; then
      ax_cv_c_float_words_bigendian=no
    else
-@@ -15388,7 +15387,7 @@
+@@ -15448,7 +15447,7 @@ _ACEOF
  fi
  
  
@@ -56,7 +66,7 @@
  
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking LDVERSION" >&5
  $as_echo_n "checking LDVERSION... " >&6; }
-@@ -15441,11 +15440,7 @@
+@@ -15501,11 +15500,7 @@ fi
  
  
  
diff -r e7c96379deed -r b981bc56a245 lang/python39/patches/patch-setup.py
--- a/lang/python39/patches/patch-setup.py      Sun Apr 03 10:33:44 2022 +0000
+++ b/lang/python39/patches/patch-setup.py      Sun Apr 03 10:51:19 2022 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-setup.py,v 1.7 2022/01/14 10:32:28 tnn Exp $
+$NetBSD: patch-setup.py,v 1.8 2022/04/03 10:51:19 riastradh Exp $
 
 Disable certain modules, so they can be built as separate packages.
 Do not look for ncursesw.
@@ -6,10 +6,23 @@
 which will get transformed to panel in buildlink.
 Don't search for modules in PREFIX. Fixes build failure when py-setuptools
   are installed.
+Enable cross-build by setting sys._home and sys.path to build directory
 
---- setup.py.orig      2021-11-15 17:43:00.000000000 +0000
+--- setup.py.orig      2022-03-23 21:12:08.000000000 +0000
 +++ setup.py
-@@ -11,6 +11,7 @@ import sysconfig
+@@ -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
+@@ -11,6 +17,7 @@ import sysconfig
  from glob import glob, escape
  import _osx_support
  
@@ -17,7 +30,7 @@
  
  try:
      import subprocess
-@@ -30,7 +31,7 @@ except ImportError:
+@@ -30,7 +37,7 @@ except ImportError:
      SUBPROCESS_BOOTSTRAP = True
  
  
@@ -26,7 +39,7 @@
  from distutils.command.build_ext import build_ext
  from distutils.command.build_scripts import build_scripts
  from distutils.command.install import install
-@@ -44,7 +45,7 @@ from distutils.spawn import find_executa
+@@ -44,7 +51,7 @@ from distutils.spawn import find_executa
  TEST_EXTENSIONS = True
  
  # This global variable is used to hold the list of modules to be disabled.
@@ -35,7 +48,7 @@
  
  
  def get_platform():
-@@ -224,6 +225,16 @@ def grep_headers_for(function, headers):
+@@ -227,6 +234,16 @@ def grep_headers_for(function, headers):
                  return True
      return False
  
@@ -52,7 +65,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
-@@ -728,15 +739,15 @@ class PyBuildExt(build_ext):
+@@ -733,15 +750,15 @@ class PyBuildExt(build_ext):
                          add_dir_to_list(dir_list, directory)
  
      def configure_compiler(self):
@@ -77,7 +90,7 @@
          self.add_multiarch_paths()
          self.add_ldflags_cppflags()
  
-@@ -784,6 +795,9 @@ class PyBuildExt(build_ext):
+@@ -789,6 +806,9 @@ class PyBuildExt(build_ext):
              self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
  
          if MACOS:
@@ -87,7 +100,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.
-@@ -1001,8 +1015,6 @@ class PyBuildExt(build_ext):
+@@ -1006,8 +1026,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
@@ -96,7 +109,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'):
-@@ -1104,8 +1116,7 @@ class PyBuildExt(build_ext):
+@@ -1109,8 +1127,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
@@ -106,7 +119,7 @@
              self.add(Extension('_curses_panel', ['_curses_panel.c'],
                             include_dirs=curses_includes,
                             define_macros=curses_defines,
-@@ -1356,6 +1367,31 @@ class PyBuildExt(build_ext):
+@@ -1361,6 +1378,31 @@ class PyBuildExt(build_ext):
          dbm_order = ['gdbm']
          # The standard Unix dbm module:
          if not CYGWIN:
@@ -138,7 +151,7 @@
              config_args = [arg.strip("'")
                             for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
              dbm_args = [arg for arg in config_args
-@@ -1367,7 +1403,7 @@ class PyBuildExt(build_ext):
+@@ -1372,7 +1414,7 @@ class PyBuildExt(build_ext):
              dbmext = None
              for cand in dbm_order:
                  if cand == "ndbm":
@@ -147,7 +160,7 @@
                          # Some systems have -lndbm, others have -lgdbm_compat,
                          # others don't have either
                          if self.compiler.find_library_file(self.lib_dirs,
-@@ -2207,10 +2243,7 @@ class PyBuildExt(build_ext):
+@@ -2209,10 +2251,7 @@ class PyBuildExt(build_ext):
              sources = ['_decimal/_decimal.c']
              depends = ['_decimal/docstrings.h']
          else:
@@ -159,7 +172,7 @@
              libraries = ['m']
              sources = [
                '_decimal/_decimal.c',
-@@ -2595,7 +2628,7 @@ def main():
+@@ -2597,7 +2636,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