pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/lang python3[4567]: find_library() fixes; remove -stac...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6bb1a919f6ba
branches:  trunk
changeset: 330415:6bb1a919f6ba
user:      adam <adam%pkgsrc.org@localhost>
date:      Sat Mar 02 13:23:35 2019 +0000

description:
python3[4567]: find_library() fixes; remove -stack_size from LDFLAGS on Darwin.

PkgSrc changes:
* Make find_library() consitant for all Python versions:
  - Fallback to clang, when gcc is not installed.
  - Find libraries in PkgSrc prefix.
* Do not use -stack_size; it ends up in 'pythonNN-config --ldflags', and some
  modules fail to build.

diffstat:

 lang/python34/Makefile                         |  22 ++++---------
 lang/python34/distinfo                         |   4 +-
 lang/python34/patches/patch-configure          |  34 +++++++++++++--------
 lang/python35/Makefile                         |  22 ++++---------
 lang/python35/distinfo                         |   6 +-
 lang/python35/options.mk                       |  12 +++---
 lang/python35/patches/patch-Lib_ctypes_util.py |  17 +++++++++-
 lang/python35/patches/patch-configure          |  20 +++++++++---
 lang/python36/Makefile                         |  22 ++++---------
 lang/python36/distinfo                         |   6 +-
 lang/python36/options.mk                       |  13 ++++---
 lang/python36/patches/patch-Lib_ctypes_util.py |  17 +++++++++-
 lang/python36/patches/patch-configure          |  35 +++++++++++-----------
 lang/python37/Makefile                         |  26 ++++++----------
 lang/python37/distinfo                         |   5 +-
 lang/python37/options.mk                       |  18 +++++-----
 lang/python37/patches/patch-Lib_ctypes_util.py |  27 +++++++++++++++++
 lang/python37/patches/patch-configure          |  40 +++++++++++++++----------
 18 files changed, 196 insertions(+), 150 deletions(-)

diffs (truncated from 950 to 300 lines):

diff -r ca4ab82a625b -r 6bb1a919f6ba lang/python34/Makefile
--- a/lang/python34/Makefile    Sat Mar 02 11:12:38 2019 +0000
+++ b/lang/python34/Makefile    Sat Mar 02 13:23:35 2019 +0000
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.28 2018/08/07 08:44:41 adam Exp $
+# $NetBSD: Makefile,v 1.29 2019/03/02 13:23:35 adam Exp $
 
 .include "dist.mk"
 
 PKGNAME=       python34-${PY_DISTVERSION}
+PKGREVISION=   1
 CATEGORIES=    lang python
 
 MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
@@ -12,7 +13,7 @@
 
 CONFLICTS+=    python-[0-9]*
 
-PLIST_AWK+=            -f ${PKGSRCDIR}/lang/python/plist-python.awk
+PLIST_AWK=             -f ${PKGSRCDIR}/lang/python/plist-python.awk
 PLIST_AWK_ENV+=                PYVERS=34
 PRINT_PLIST_AWK+=      /^[^@]/ && /[^\/]+\.py[co]$$/ {
 PRINT_PLIST_AWK+=      gsub(/__pycache__\//, "")
@@ -148,25 +149,16 @@
 REPLACE_FILES.python+= Lib/uu.py
 REPLACE_FILES.python+= Lib/webbrowser.py
 
+# XXX: It might be needed to add manually more paths like ${PREFIX}/qt5/lib
+# Test: python -c 'from ctypes.util import find_library; print(find_library("ffi"));'
 SUBST_CLASSES+=                findlib
-SUBST_MESSAGE.findlib= Fixing find_library_file on Darwin.
+SUBST_MESSAGE.findlib= Fixing find_library().
 SUBST_STAGE.findlib=   pre-configure
 SUBST_FILES.findlib=   Lib/ctypes/macholib/dyld.py
 SUBST_FILES.findlib+=  Lib/ctypes/util.py
 SUBST_FILES.findlib+=  Lib/distutils/unixccompiler.py
 SUBST_SED.findlib=     -e 's,/usr/local,${PREFIX},'
-
-# XXX: It might be needed to add manually more paths like ${PREFIX}/qt5/lib
-# Testing:
-# >>> from ctypes.util import find_library
-# >>> find_library("m")
-# 'libm.so.0'
-
-SUBST_CLASSES+=                pfindlib
-SUBST_MESSAGE.pfindlib=        Fixing find_library() on POSIX-like (excluding Darwin) systems.
-SUBST_STAGE.pfindlib=  pre-configure
-SUBST_FILES.pfindlib=  Lib/ctypes/util.py
-SUBST_SED.pfindlib=    -e 's!\(-Wl,-t -o\)!${COMPILER_RPATH_FLAG}${PREFIX}/lib -L${PREFIX}/lib \1!'
+SUBST_SED.findlib+=    -e 's!\(-Wl,-t -o\)!${COMPILER_RPATH_FLAG}${PREFIX}/lib -L${PREFIX}/lib \1!'
 
 .include "options.mk"
 
diff -r ca4ab82a625b -r 6bb1a919f6ba lang/python34/distinfo
--- a/lang/python34/distinfo    Sat Mar 02 11:12:38 2019 +0000
+++ b/lang/python34/distinfo    Sat Mar 02 13:23:35 2019 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.32 2018/08/07 08:44:41 adam Exp $
+$NetBSD: distinfo,v 1.33 2019/03/02 13:23:35 adam Exp $
 
 SHA1 (Python-3.4.9.tar.xz) = 83ea4018f6e5f1db87c4e54c8a48ba6a8350abd4
 RMD160 (Python-3.4.9.tar.xz) = 941536bcadacd7c42c3f3fa94aa42186443ea673
@@ -14,6 +14,6 @@
 SHA1 (patch-Modules_socketmodule.c) = 3b091755d7c104b5d1fc696a0d4a679ed3565ef4
 SHA1 (patch-Modules_socketmodule.h) = ed334a97c2a6662c5b44b4e50c1b8efcc220fa1f
 SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be
-SHA1 (patch-configure) = 5cf4d44d24020a9b6fe41deeb916edbe87a937cb
+SHA1 (patch-configure) = a98c9527e654fcd581d564a71f0258be7986f4dc
 SHA1 (patch-pyconfig.h.in) = 1fbd8b94a6317e31a3b9db683db0c2c9c4334713
 SHA1 (patch-setup.py) = 42c81cb89b2568124b40d1bc2134d3221b4bca1e
diff -r ca4ab82a625b -r 6bb1a919f6ba lang/python34/patches/patch-configure
--- a/lang/python34/patches/patch-configure     Sat Mar 02 11:12:38 2019 +0000
+++ b/lang/python34/patches/patch-configure     Sat Mar 02 13:23:35 2019 +0000
@@ -1,17 +1,17 @@
-$NetBSD: patch-configure,v 1.1 2018/06/17 19:21:21 adam Exp $
+$NetBSD: patch-configure,v 1.2 2019/03/02 13:23:35 adam Exp $
 
 MirBSD support
 http://bugs.python.org/issue21458
 
 Changes for consistency across pkgsrc platforms.
 
-XXX: Not sure what the BLDSHARED changes are about.
+Fix linking on Darwin; don't use -stack_size.
 
 detect netcan/can.h on NetBSD
 
---- configure.orig     2017-01-17 08:57:47.000000000 +0100
-+++ configure  2017-05-30 15:49:43.508649775 +0200
-@@ -3369,7 +3369,7 @@
+--- configure.orig     2018-08-02 09:18:47.000000000 +0000
++++ configure
+@@ -3369,7 +3369,7 @@ case $ac_sys_system/$ac_sys_release in
    # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
    # In addition, Stefan Krah confirms that issue #1244610 exists through
    # OpenBSD 4.6, but is fixed in 4.7.
@@ -20,7 +20,7 @@
      define_xopen_source=no
      # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
      # also defined. This can be overridden by defining _BSD_SOURCE
-@@ -5650,15 +5650,10 @@
+@@ -5650,15 +5650,10 @@ $as_echo "#define Py_ENABLE_SHARED 1" >>
              PY3LIBRARY=libpython3.so
          fi
            ;;
@@ -37,7 +37,7 @@
          INSTSONAME="$LDLIBRARY".$SOVERSION
          if test "$with_pydebug" != yes
            then
-@@ -7283,7 +7278,7 @@
+@@ -7283,7 +7278,7 @@ done
  
  
  # On Linux, can.h and can/raw.h require sys/socket.h
@@ -46,7 +46,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" "
-@@ -8561,8 +8556,8 @@
+@@ -8561,8 +8556,8 @@ then
                        LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
                else
                        # No framework, use the Python app as bundle-loader
@@ -57,7 +57,7 @@
                        LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
                fi ;;
        Darwin/*)
-@@ -8586,9 +8581,9 @@
+@@ -8586,9 +8581,9 @@ then
                                LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
                        else
                                # No framework, use the Python app as bundle-loader
@@ -70,7 +70,7 @@
                        fi
                else
                        # building for OS X 10.3 and later
-@@ -8627,6 +8622,9 @@
+@@ -8627,6 +8622,9 @@ then
                                   ;;
                                esac
                fi;;
@@ -80,7 +80,7 @@
        NetBSD*|DragonFly*)
                LDSHARED='$(CC) -shared'
                LDCXXSHARED='$(CXX) -shared';;
-@@ -8670,7 +8668,7 @@
+@@ -8670,7 +8668,7 @@ then
                 fi;;
        Linux*|GNU*) CCSHARED="-fPIC";;
        BSD/OS*/4*) CCSHARED="-fpic";;
@@ -89,7 +89,15 @@
        OpenUNIX*|UnixWare*)
                if test "$GCC" = "yes"
                then CCSHARED="-fPIC"
-@@ -8719,7 +8717,7 @@
+@@ -8709,7 +8707,6 @@ then
+               # Issue #18075: the default maximum stack size (8MBytes) is too
+               # small for the default recursion limit. Increase the stack size
+               # to ensure that tests don't crash
+-              LINKFORSHARED="-Wl,-stack_size,1000000 $LINKFORSHARED"
+ 
+               if test "$enable_framework"
+               then
+@@ -8719,7 +8716,7 @@ then
        OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
        SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
        ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
@@ -98,7 +106,7 @@
                if [ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]
                then
                        LINKFORSHARED="-Wl,--export-dynamic"
-@@ -14017,8 +14015,6 @@
+@@ -14017,8 +14014,6 @@ $as_echo "$SOABI" >&6; }
  
  
  case $ac_sys_system in
diff -r ca4ab82a625b -r 6bb1a919f6ba lang/python35/Makefile
--- a/lang/python35/Makefile    Sat Mar 02 11:12:38 2019 +0000
+++ b/lang/python35/Makefile    Sat Mar 02 13:23:35 2019 +0000
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.15 2018/08/07 08:44:02 adam Exp $
+# $NetBSD: Makefile,v 1.16 2019/03/02 13:23:36 adam Exp $
 
 .include "dist.mk"
 
 PKGNAME=       python35-${PY_DISTVERSION}
+PKGREVISION=   1
 CATEGORIES=    lang python
 
 MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
@@ -12,7 +13,7 @@
 
 CONFLICTS+=    python-[0-9]*
 
-PLIST_AWK+=            -f ${PKGSRCDIR}/lang/python/plist-python.awk
+PLIST_AWK=             -f ${PKGSRCDIR}/lang/python/plist-python.awk
 PLIST_AWK_ENV+=                PYVERS=35
 PRINT_PLIST_AWK+=      /^[^@]/ && /[^\/]+\.pyc$$/ {
 PRINT_PLIST_AWK+=      sub(/__pycache__\//, "")
@@ -152,24 +153,15 @@
 REPLACE_FILES.python+= Lib/uu.py
 REPLACE_FILES.python+= Lib/webbrowser.py
 
+# XXX: It might be needed to add manually more paths like ${PREFIX}/qt5/lib
+# Test: python -c 'from ctypes.util import find_library; print(find_library("ffi"));'
 SUBST_CLASSES+=                findlib
-SUBST_MESSAGE.findlib= Fixing find_library_file on Darwin.
+SUBST_MESSAGE.findlib= Fixing find_library().
 SUBST_STAGE.findlib=   pre-configure
 SUBST_FILES.findlib=   Lib/ctypes/macholib/dyld.py
 SUBST_FILES.findlib+=  Lib/ctypes/util.py
 SUBST_SED.findlib=     -e 's,/usr/local,${PREFIX},'
-
-# XXX: It might be needed to add manually more paths like ${PREFIX}/qt5/lib
-# Testing:
-# >>> from ctypes.util import find_library
-# >>> find_library("m")
-# 'libm.so.0'
-
-SUBST_CLASSES+=                pfindlib
-SUBST_MESSAGE.pfindlib=        Fixing find_library() on POSIX-like (excluding Darwin) systems.
-SUBST_STAGE.pfindlib=  pre-configure
-SUBST_FILES.pfindlib=  Lib/ctypes/util.py
-SUBST_SED.pfindlib=    -e "s!\('-Wl,-t', \)!'${COMPILER_RPATH_FLAG}${PREFIX}/lib', '-L${PREFIX}/lib', \1!"
+SUBST_SED.findlib+=    -e "s!\('-Wl,-t'\)!'${COMPILER_RPATH_FLAG}${PREFIX}/lib', '-L${PREFIX}/lib', \1!"
 
 .include "options.mk"
 
diff -r ca4ab82a625b -r 6bb1a919f6ba lang/python35/distinfo
--- a/lang/python35/distinfo    Sat Mar 02 11:12:38 2019 +0000
+++ b/lang/python35/distinfo    Sat Mar 02 13:23:35 2019 +0000
@@ -1,10 +1,10 @@
-$NetBSD: distinfo,v 1.17 2018/08/07 08:44:02 adam Exp $
+$NetBSD: distinfo,v 1.18 2019/03/02 13:23:36 adam Exp $
 
 SHA1 (Python-3.5.6.tar.xz) = 05548da58ec75a7af316c4a4cb8fc667ac6ac8f9
 RMD160 (Python-3.5.6.tar.xz) = 5a02cb3664ad98d1767c79dfdd88a850b866241f
 SHA512 (Python-3.5.6.tar.xz) = 1ccf287dbe8594eb577c1197c19d882fbe235c72f4c01cda23258f2add8a93e639b41ebaf556508b867cbe1b4c1fc4e1cf457d70b98cf7a1502013660a7e0ac1
 Size (Python-3.5.6.tar.xz) = 15412832 bytes
-SHA1 (patch-Lib_ctypes_util.py) = 24ee6d33e39edc2168adabb2065941ff4efb977c
+SHA1 (patch-Lib_ctypes_util.py) = 23985965e248eaefd84e21f12b070d5f5e6107c2
 SHA1 (patch-Lib_distutils_command_install.py) = 9b44f339f65f029b7f17dbc654739a7ae3c12780
 SHA1 (patch-Lib_distutils_unixccompiler.py) = 7d0b70a64b79ee6084c41d8fbb01c8e8e4553419
 SHA1 (patch-Makefile.pre.in) = 213f57b7130507e541ee23d6b8da097fd6168fb7
@@ -14,6 +14,6 @@
 SHA1 (patch-Modules_socketmodule.c) = 63d583340b071b07ff3e31cf332fcc2ca9ab50e3
 SHA1 (patch-Modules_socketmodule.h) = 13a3290eb72078067060d3e71b7baa08f3eb591c
 SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be
-SHA1 (patch-configure) = bce1b2f7dfedb23c561e1d8f32959cd043cdd0df
+SHA1 (patch-configure) = 3da9bebda139361ead9dec6c350d0e26454ef58b
 SHA1 (patch-pyconfig.h.in) = e0aa80eb1ed3677da77fcd0a93f72b61ce148d0d
 SHA1 (patch-setup.py) = 26ea130352cf73a49110d86bbccf1803795211e5
diff -r ca4ab82a625b -r 6bb1a919f6ba lang/python35/options.mk
--- a/lang/python35/options.mk  Sat Mar 02 11:12:38 2019 +0000
+++ b/lang/python35/options.mk  Sat Mar 02 13:23:35 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: options.mk,v 1.2 2017/01/01 15:06:24 adam Exp $
+# $NetBSD: options.mk,v 1.3 2019/03/02 13:23:36 adam Exp $
 
 PKG_OPTIONS_VAR=       PKG_OPTIONS.python35
 PKG_SUPPORTED_OPTIONS+=        x11
@@ -10,11 +10,11 @@
 .if !empty(PKG_OPTIONS:Mx11)
 # Support for native X11 paths as an option
 # This code is no-op for modular X11, however for simplicity don't make it conditional.
-SUBST_CLASSES+=                        x11findlib
-SUBST_MESSAGE.x11findlib=      Fixing find_library() for native X11.
-SUBST_STAGE.x11findlib=                pre-configure
-SUBST_FILES.x11findlib=                Lib/ctypes/util.py
-SUBST_SED.x11findlib=          -e 's!\(-Wl,-t -o\)!${COMPILER_RPATH_FLAG}${X11BASE}/lib -L${X11BASE}/lib \1!'
+SUBST_CLASSES+=                xfindlib
+SUBST_MESSAGE.xfindlib=        Fixing find_library() for native X11.
+SUBST_STAGE.xfindlib=  pre-configure
+SUBST_FILES.xfindlib=  Lib/ctypes/util.py
+SUBST_SED.xfindlib=    -e "s!\('-Wl,-t'\)!'${COMPILER_RPATH_FLAG}${X11BASE}/lib', '-L${X11BASE}/lib', \1!"
 
 # Required to get definition of X11BASE and retain X11 rpath paths for linker
 # We need to pass rpath to _ctypes.so to get functional dlopen(3) for X11 libs
diff -r ca4ab82a625b -r 6bb1a919f6ba lang/python35/patches/patch-Lib_ctypes_util.py
--- a/lang/python35/patches/patch-Lib_ctypes_util.py    Sat Mar 02 11:12:38 2019 +0000
+++ b/lang/python35/patches/patch-Lib_ctypes_util.py    Sat Mar 02 13:23:35 2019 +0000
@@ -1,11 +1,22 @@
-$NetBSD: patch-Lib_ctypes_util.py,v 1.1 2018/06/17 19:21:22 adam Exp $
+$NetBSD: patch-Lib_ctypes_util.py,v 1.2 2019/03/02 13:23:36 adam Exp $
+
+Fallback to clang.
 
 Find libraries using 'ld' (taken from Python 3.7).
 Note: /usr/local will get replaced by SUBST.
 
---- Lib/ctypes/util.py.orig    2018-05-14 15:07:31.000000000 +0000
+--- Lib/ctypes/util.py.orig    2018-08-02 09:19:12.000000000 +0000
 +++ Lib/ctypes/util.py
-@@ -285,8 +285,32 @@ elif os.name == "posix":
+@@ -103,6 +103,8 @@ elif os.name == "posix":
+ 
+         c_compiler = shutil.which('gcc')
+         if not c_compiler:
++            c_compiler = shutil.which('clang')
++        if not c_compiler:



Home | Main Index | Thread Index | Old Index