pkgsrc-Changes archive

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

CVS commit: pkgsrc/lang/python39/patches



Module Name:    pkgsrc
Committed By:   adam
Date:           Sat Oct 10 20:20:12 UTC 2020

Added Files:
        pkgsrc/lang/python39/patches: patch-Lib_ctypes_util.py
            patch-Lib_distutils_command_install.py
            patch-Lib_distutils_sysconfig.py
            patch-Lib_distutils_unixccompiler.py
            patch-Lib_lib2to3_pgen2_driver.py patch-Lib_sysconfig.py
            patch-Makefile.pre.in patch-Modules_makesetup
            patch-Modules_nismodule.c patch-Modules_socketmodule.c
            patch-Modules_socketmodule.h patch-Python_thread__pthread.h
            patch-configure patch-pyconfig.h.in patch-setup.py

Log Message:
python39: add patches


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/lang/python39/patches/patch-Lib_ctypes_util.py \
    pkgsrc/lang/python39/patches/patch-Lib_distutils_command_install.py \
    pkgsrc/lang/python39/patches/patch-Lib_distutils_sysconfig.py \
    pkgsrc/lang/python39/patches/patch-Lib_distutils_unixccompiler.py \
    pkgsrc/lang/python39/patches/patch-Lib_lib2to3_pgen2_driver.py \
    pkgsrc/lang/python39/patches/patch-Lib_sysconfig.py \
    pkgsrc/lang/python39/patches/patch-Makefile.pre.in \
    pkgsrc/lang/python39/patches/patch-Modules_makesetup \
    pkgsrc/lang/python39/patches/patch-Modules_nismodule.c \
    pkgsrc/lang/python39/patches/patch-Modules_socketmodule.c \
    pkgsrc/lang/python39/patches/patch-Modules_socketmodule.h \
    pkgsrc/lang/python39/patches/patch-Python_thread__pthread.h \
    pkgsrc/lang/python39/patches/patch-configure \
    pkgsrc/lang/python39/patches/patch-pyconfig.h.in \
    pkgsrc/lang/python39/patches/patch-setup.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: pkgsrc/lang/python39/patches/patch-Lib_ctypes_util.py
diff -u /dev/null pkgsrc/lang/python39/patches/patch-Lib_ctypes_util.py:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-Lib_ctypes_util.py       Sat Oct 10 20:20:12 2020
@@ -0,0 +1,76 @@
+$NetBSD: patch-Lib_ctypes_util.py,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+Fallback to clang.
+
+Look for shared libraries in PkgSrc prefix.
+Note: /usr/local will get replaced by SUBST.
+
+Pull in patch for http://bugs.python.org/issue23287 for SunOS
+
+--- Lib/ctypes/util.py.orig    2019-03-25 20:21:05.000000000 +0000
++++ Lib/ctypes/util.py
+@@ -102,6 +102,8 @@ elif os.name == "posix":
+ 
+         c_compiler = shutil.which('gcc')
+         if not c_compiler:
++            c_compiler = shutil.which('clang')
++        if not c_compiler:
+             c_compiler = shutil.which('cc')
+         if not c_compiler:
+             # No C compiler available, give up
+@@ -213,34 +215,15 @@ elif os.name == "posix":
+ 
+     elif sys.platform == "sunos5":
+ 
+-        def _findLib_crle(name, is64):
+-            if not os.path.exists('/usr/bin/crle'):
+-                return None
++        def _findLib_path(name, is64):
+ 
+             env = dict(os.environ)
+             env['LC_ALL'] = 'C'
+ 
+             if is64:
+-                args = ('/usr/bin/crle', '-64')
++                paths = "/lib/64:/usr/lib/64:/usr/local/lib"
+             else:
+-                args = ('/usr/bin/crle',)
+-
+-            paths = None
+-            try:
+-                proc = subprocess.Popen(args,
+-                                        stdout=subprocess.PIPE,
+-                                        stderr=subprocess.DEVNULL,
+-                                        env=env)
+-            except OSError:  # E.g. bad executable
+-                return None
+-            with proc:
+-                for line in proc.stdout:
+-                    line = line.strip()
+-                    if line.startswith(b'Default Library Path (ELF):'):
+-                        paths = os.fsdecode(line).split()[4]
+-
+-            if not paths:
+-                return None
++                paths = "/lib:/usr/lib:/usr/local/lib"
+ 
+             for dir in paths.split(":"):
+                 libfile = os.path.join(dir, "lib%s.so" % name)
+@@ -250,7 +233,7 @@ elif os.name == "posix":
+             return None
+ 
+         def find_library(name, is64 = False):
+-            return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
++            return _get_soname(_findLib_path(name, is64) or _findLib_gcc(name))
+ 
+     else:
+ 
+@@ -287,7 +270,7 @@ elif os.name == "posix":
+         def _findLib_ld(name):
+             # See issue #9998 for why this is needed
+             expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)
+-            cmd = ['ld', '-t']
++            cmd = ['ld', '-t', '-L', '/usr/local/lib']
+             libpath = os.environ.get('LD_LIBRARY_PATH')
+             if libpath:
+                 for d in libpath.split(':'):
Index: pkgsrc/lang/python39/patches/patch-Lib_distutils_command_install.py
diff -u /dev/null pkgsrc/lang/python39/patches/patch-Lib_distutils_command_install.py:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-Lib_distutils_command_install.py Sat Oct 10 20:20:12 2020
@@ -0,0 +1,12 @@
+$NetBSD: patch-Lib_distutils_command_install.py,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+--- Lib/distutils/command/install.py.orig      2016-12-23 02:21:19.000000000 +0000
++++ Lib/distutils/command/install.py
+@@ -652,5 +652,6 @@ class install(Command):
+                     ('install_headers', has_headers),
+                     ('install_scripts', has_scripts),
+                     ('install_data',    has_data),
+-                    ('install_egg_info', lambda self:True),
+                    ]
++    if not os.environ.get('PKGSRC_PYTHON_NO_EGG'):
++        sub_commands += [('install_egg_info', lambda self:True),]
Index: pkgsrc/lang/python39/patches/patch-Lib_distutils_sysconfig.py
diff -u /dev/null pkgsrc/lang/python39/patches/patch-Lib_distutils_sysconfig.py:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-Lib_distutils_sysconfig.py       Sat Oct 10 20:20:12 2020
@@ -0,0 +1,28 @@
+$NetBSD: patch-Lib_distutils_sysconfig.py,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+Remove _multiarch from config path (differs across platforms).
+Simplify _sysconfigdata to include only platform name.
+
+--- Lib/distutils/sysconfig.py.orig    2016-12-23 02:21:19.000000000 +0000
++++ Lib/distutils/sysconfig.py
+@@ -242,8 +242,6 @@ def get_makefile_filename():
+         return os.path.join(_sys_home or project_base, "Makefile")
+     lib_dir = get_python_lib(plat_specific=0, standard_lib=1)
+     config_file = 'config-{}{}'.format(get_python_version(), build_flags)
+-    if hasattr(sys.implementation, '_multiarch'):
+-        config_file += '-%s' % sys.implementation._multiarch
+     return os.path.join(lib_dir, config_file, 'Makefile')
+ 
+ 
+@@ -419,10 +417,8 @@ def _init_posix():
+     """Initialize the module as appropriate for POSIX systems."""
+     # _sysconfigdata is generated at build time, see the sysconfig module
+     name = os.environ.get('_PYTHON_SYSCONFIGDATA_NAME',
+-        '_sysconfigdata_{abi}_{platform}_{multiarch}'.format(
+-        abi=sys.abiflags,
++        '_sysconfigdata_{platform}'.format(
+         platform=sys.platform,
+-        multiarch=getattr(sys.implementation, '_multiarch', ''),
+     ))
+     _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
+     build_time_vars = _temp.build_time_vars
Index: pkgsrc/lang/python39/patches/patch-Lib_distutils_unixccompiler.py
diff -u /dev/null pkgsrc/lang/python39/patches/patch-Lib_distutils_unixccompiler.py:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-Lib_distutils_unixccompiler.py   Sat Oct 10 20:20:12 2020
@@ -0,0 +1,31 @@
+$NetBSD: patch-Lib_distutils_unixccompiler.py,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+Do not force RUNPATH vs RPATH, trust the compiler to know what the
+platform wants.
+
+--- Lib/distutils/unixccompiler.py.orig        2018-03-29 11:57:55.000000000 +0000
++++ Lib/distutils/unixccompiler.py
+@@ -234,22 +234,7 @@ class UnixCCompiler(CCompiler):
+                 return ["-Wl,+s", "-L" + dir]
+             return ["+s", "-L" + dir]
+         else:
+-            if self._is_gcc(compiler):
+-                # gcc on non-GNU systems does not need -Wl, but can
+-                # use it anyway.  Since distutils has always passed in
+-                # -Wl whenever gcc was used in the past it is probably
+-                # safest to keep doing so.
+-                if sysconfig.get_config_var("GNULD") == "yes":
+-                    # GNU ld needs an extra option to get a RUNPATH
+-                    # instead of just an RPATH.
+-                    return "-Wl,--enable-new-dtags,-R" + dir
+-                else:
+-                    return "-Wl,-R" + dir
+-            else:
+-                # No idea how --enable-new-dtags would be passed on to
+-                # ld if this system was using GNU ld.  Don't know if a
+-                # system like this even exists.
+-                return "-R" + dir
++            return "-Wl,-R" + dir
+ 
+     def library_option(self, lib):
+         return "-l" + lib
Index: pkgsrc/lang/python39/patches/patch-Lib_lib2to3_pgen2_driver.py
diff -u /dev/null pkgsrc/lang/python39/patches/patch-Lib_lib2to3_pgen2_driver.py:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-Lib_lib2to3_pgen2_driver.py      Sat Oct 10 20:20:12 2020
@@ -0,0 +1,32 @@
+$NetBSD: patch-Lib_lib2to3_pgen2_driver.py,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+On systems where both of the conditions
+
+1. LD_LIBRARY_PATH does _not_ take precedence over DT_RPATH
+   (e.g. Linux)
+2. A previous libpython with the same major.minor is already installed
+   (e.g. a previous version of this package)
+
+hold, the built python will be linked with the installed libpython,
+causing it to report an old teeny version in sys.version_info while
+staging the install. Then "make package" fails with PLIST mismatches for
+{,Pattern}Grammar.*.pickle.
+
+pkgsrc knows which version we're building. Pass that down instead.
+
+In patch-Lib_distutils_unixccompiler.py, we override Python maintainers'
+expectations for Linux builds in favor of pkgsrc's expectations for
+builds on all platforms. This patch is needed because of that patch.
+
+--- Lib/lib2to3/pgen2/driver.py.orig   2020-06-27 08:35:53.000000000 +0000
++++ Lib/lib2to3/pgen2/driver.py
+@@ -108,7 +108,8 @@ def _generate_pickle_name(gt):
+     head, tail = os.path.splitext(gt)
+     if tail == ".txt":
+         tail = ""
+-    return head + tail + ".".join(map(str, sys.version_info)) + ".pickle"
++    sys_version_info = "@PKGVERSION_NOREV@" + ".final.0"
++    return head + tail + sys_version_info + ".pickle"
+ 
+ 
+ def load_grammar(gt="Grammar.txt", gp=None,
Index: pkgsrc/lang/python39/patches/patch-Lib_sysconfig.py
diff -u /dev/null pkgsrc/lang/python39/patches/patch-Lib_sysconfig.py:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-Lib_sysconfig.py Sat Oct 10 20:20:12 2020
@@ -0,0 +1,26 @@
+$NetBSD: patch-Lib_sysconfig.py,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+Remove _multiarch from config path (differs across platforms).
+Simplify _sysconfigdata to include only platform name.
+
+--- Lib/sysconfig.py.orig      2016-12-23 02:21:19.000000000 +0000
++++ Lib/sysconfig.py
+@@ -337,17 +337,13 @@ def get_makefile_filename():
+         config_dir_name = 'config-%s%s' % (_PY_VERSION_SHORT, sys.abiflags)
+     else:
+         config_dir_name = 'config'
+-    if hasattr(sys.implementation, '_multiarch'):
+-        config_dir_name += '-%s' % sys.implementation._multiarch
+     return os.path.join(get_path('stdlib'), config_dir_name, 'Makefile')
+ 
+ 
+ def _get_sysconfigdata_name():
+     return os.environ.get('_PYTHON_SYSCONFIGDATA_NAME',
+-        '_sysconfigdata_{abi}_{platform}_{multiarch}'.format(
+-        abi=sys.abiflags,
++        '_sysconfigdata_{platform}'.format(
+         platform=sys.platform,
+-        multiarch=getattr(sys.implementation, '_multiarch', ''),
+     ))
+ 
+ 
Index: pkgsrc/lang/python39/patches/patch-Makefile.pre.in
diff -u /dev/null pkgsrc/lang/python39/patches/patch-Makefile.pre.in:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-Makefile.pre.in  Sat Oct 10 20:20:12 2020
@@ -0,0 +1,114 @@
+$NetBSD: patch-Makefile.pre.in,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+Use only one optimisation level; needed for PLIST and setuptools compatibility.
+Do not build/install libpython3.so.
+Simplify _sysconfigdata to include only platform name.
+Swap targets libinstall and libainstall, to byte-compile python-config.py.
+
+--- Makefile.pre.in.orig       2019-08-29 21:59:20.000000000 +0000
++++ Makefile.pre.in
+@@ -100,7 +100,7 @@ PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODI
+ # be able to build extension modules using the directories specified in the
+ # environment variables
+ PY_CPPFLAGS=  $(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)
+-PY_LDFLAGS=   $(CONFIGURE_LDFLAGS) $(LDFLAGS)
++PY_LDFLAGS=   -L. $(CONFIGURE_LDFLAGS) $(LDFLAGS)
+ PY_LDFLAGS_NODIST=$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)
+ NO_AS_NEEDED= @NO_AS_NEEDED@
+ SGI_ABI=      @SGI_ABI@
+@@ -222,7 +222,7 @@ DIST=              $(DISTFILES) $(DISTDIRS)
+ LIBRARY=      @LIBRARY@
+ LDLIBRARY=      @LDLIBRARY@
+ BLDLIBRARY=     @BLDLIBRARY@
+-PY3LIBRARY=     @PY3LIBRARY@
++PY3LIBRARY=
+ DLLLIBRARY=   @DLLLIBRARY@
+ LDLIBRARYDIR=   @LDLIBRARYDIR@
+ INSTSONAME=   @INSTSONAME@
+@@ -923,8 +923,6 @@ regen-opcode-targets:
+               $(srcdir)/Python/opcode_targets.h.new
+       $(UPDATE_FILE) $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/opcode_targets.h.new
+ 
+-Python/ceval.o: $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/ceval_gil.h \
+-              $(srcdir)/Python/condvar.h
+ 
+ Python/frozen.o: $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib_external.h \
+               $(srcdir)/Python/importlib_zipimport.h
+@@ -934,7 +932,7 @@ Python/frozen.o: $(srcdir)/Python/import
+ # an include guard, so we can't use a pipeline to transform its output.
+ Include/pydtrace_probes.h: $(srcdir)/Include/pydtrace.d
+       $(MKDIR_P) Include
+-      $(DTRACE) $(DFLAGS) -o $@ -h -s $<
++      $(DTRACE) $(DFLAGS) -o $@ -h -s $(srcdir)/Include/pydtrace.d
+       : sed in-place edit with POSIX-only tools
+       sed 's/PYTHON_/PyDTrace_/' $@ > $@.tmp
+       mv $@.tmp $@
+@@ -944,7 +942,7 @@ Python/import.o: $(srcdir)/Include/pydtr
+ Modules/gcmodule.o: $(srcdir)/Include/pydtrace.h
+ 
+ Python/pydtrace.o: $(srcdir)/Include/pydtrace.d $(DTRACE_DEPS)
+-      $(DTRACE) $(DFLAGS) -o $@ -G -s $< $(DTRACE_DEPS)
++      $(DTRACE) $(DFLAGS) -o $@ -G -s $(srcdir)/Include/pydtrace.d $(DTRACE_DEPS)
+ 
+ Objects/typeobject.o: Objects/typeslots.inc
+ 
+@@ -1187,7 +1185,7 @@ altinstall: commoninstall
+       fi
+ 
+ commoninstall:  check-clean-src @FRAMEWORKALTINSTALLFIRST@ \
+-              altbininstall libinstall inclinstall libainstall \
++              altbininstall libainstall inclinstall libinstall \
+               sharedinstall oldsharedinstall altmaninstall \
+               @FRAMEWORKALTINSTALLLAST@
+ 
+@@ -1246,7 +1244,8 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORK
+               if test -n "$(PY3LIBRARY)"; then \
+                       $(INSTALL_SHARED) $(PY3LIBRARY) $(DESTDIR)$(LIBDIR)/$(PY3LIBRARY); \
+               fi; \
+-      else    true; \
++      elif test -f $(INSTSONAME); then \
++               $(INSTALL_SHARED) $(INSTSONAME) $(DESTDIR)$(LIBDIR); \
+       fi
+       if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
+               rm -f $(DESTDIR)$(BINDIR)python$(VERSION)-32$(EXE); \
+@@ -1443,7 +1442,7 @@ libinstall:      build_all $(srcdir)/Modules/
+                       esac; \
+               done; \
+       done
+-      $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py \
++      $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(MACHDEP).py \
+               $(DESTDIR)$(LIBDEST); \
+       $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
+       if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
+@@ -1461,11 +1460,6 @@ libinstall:     build_all $(srcdir)/Modules/
+               -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+               $(DESTDIR)$(LIBDEST)
+       -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+-              $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \
+-              -j0 -d $(LIBDEST) -f \
+-              -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+-              $(DESTDIR)$(LIBDEST)
+-      -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+               $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+               -j0 -d $(LIBDEST)/site-packages -f \
+               -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+@@ -1474,10 +1468,6 @@ libinstall:     build_all $(srcdir)/Modules/
+               -j0 -d $(LIBDEST)/site-packages -f \
+               -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+       -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+-              $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \
+-              -j0 -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
+@@ -1599,7 +1589,7 @@ sharedinstall: sharedmods
+               --install-scripts=$(BINDIR) \
+               --install-platlib=$(DESTSHARED) \
+               --root=$(DESTDIR)/
+-      -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py
++      -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(MACHDEP).py
+       -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__
+ 
+ # Here are a couple of targets for MacOSX again, to install a full
Index: pkgsrc/lang/python39/patches/patch-Modules_makesetup
diff -u /dev/null pkgsrc/lang/python39/patches/patch-Modules_makesetup:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-Modules_makesetup        Sat Oct 10 20:20:12 2020
@@ -0,0 +1,15 @@
+$NetBSD: patch-Modules_makesetup,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+Support -pthread compiler flag.
+http://bugs.python.org/issue21461
+
+--- Modules/makesetup.orig     2008-06-11 05:26:20.000000000 +0000
++++ Modules/makesetup
+@@ -166,6 +166,7 @@ sed -e 's/[        ]*#.*//' -e '/^[        ]*$/d' |
+                       -rpath)         libs="$libs $arg"; skip=libs;;
+                       --rpath)        libs="$libs $arg"; skip=libs;;
+                       -[A-Zl]*)       libs="$libs $arg";;
++                      -pthread)       libs="$libs $arg";;
+                       *.a)            libs="$libs $arg";;
+                       *.so)           libs="$libs $arg";;
+                       *.sl)           libs="$libs $arg";;
Index: pkgsrc/lang/python39/patches/patch-Modules_nismodule.c
diff -u /dev/null pkgsrc/lang/python39/patches/patch-Modules_nismodule.c:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-Modules_nismodule.c      Sat Oct 10 20:20:12 2020
@@ -0,0 +1,16 @@
+$NetBSD: patch-Modules_nismodule.c,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+DragonFlyBSD support
+http://bugs.python.org/issue21459
+
+--- Modules/nismodule.c.orig   2010-08-19 09:03:03.000000000 +0000
++++ Modules/nismodule.c
+@@ -85,7 +85,7 @@ nis_mapname (char *map, int *pfix)
+     return map;
+ }
+ 
+-#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__)
++#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
+ typedef int (*foreachfunc)(unsigned long, char *, int, char *, int, void *);
+ #else
+ typedef int (*foreachfunc)(int, char *, int, char *, int, char *);
Index: pkgsrc/lang/python39/patches/patch-Modules_socketmodule.c
diff -u /dev/null pkgsrc/lang/python39/patches/patch-Modules_socketmodule.c:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-Modules_socketmodule.c   Sat Oct 10 20:20:12 2020
@@ -0,0 +1,27 @@
+$NetBSD: patch-Modules_socketmodule.c,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+Support NetBSD's socketcan implementation
+
+--- Modules/socketmodule.c.orig        2020-10-05 15:07:58.000000000 +0000
++++ Modules/socketmodule.c
+@@ -7826,6 +7826,20 @@ PyInit__socket(void)
+ 
+     PyModule_AddIntMacro(m, J1939_FILTER_MAX);
+ #endif
++#ifdef HAVE_NETCAN_CAN_H
++    PyModule_AddIntMacro(m, CAN_EFF_FLAG);
++    PyModule_AddIntMacro(m, CAN_RTR_FLAG);
++    PyModule_AddIntMacro(m, CAN_ERR_FLAG);
++
++    PyModule_AddIntMacro(m, CAN_SFF_MASK);
++    PyModule_AddIntMacro(m, CAN_EFF_MASK);
++    PyModule_AddIntMacro(m, CAN_ERR_MASK);
++
++    PyModule_AddIntMacro(m, CAN_RAW_FILTER);
++    /* PyModule_AddIntMacro(m, CAN_RAW_ERR_FILTER); */
++    PyModule_AddIntMacro(m, CAN_RAW_LOOPBACK);
++    PyModule_AddIntMacro(m, CAN_RAW_RECV_OWN_MSGS);
++#endif
+ #ifdef SOL_RDS
+     PyModule_AddIntMacro(m, SOL_RDS);
+ #endif
Index: pkgsrc/lang/python39/patches/patch-Modules_socketmodule.h
diff -u /dev/null pkgsrc/lang/python39/patches/patch-Modules_socketmodule.h:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-Modules_socketmodule.h   Sat Oct 10 20:20:12 2020
@@ -0,0 +1,17 @@
+$NetBSD: patch-Modules_socketmodule.h,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+Support NetBSD's socketcan implementation
+
+--- Modules/socketmodule.h.orig        2020-10-05 15:07:58.000000000 +0000
++++ Modules/socketmodule.h
+@@ -148,6 +148,10 @@ typedef int socklen_t;
+ #include <linux/can/j1939.h>
+ #endif
+ 
++#ifdef HAVE_NETCAN_CAN_H
++#include <netcan/can.h>
++#endif
++
+ #ifdef HAVE_SYS_SYS_DOMAIN_H
+ #include <sys/sys_domain.h>
+ #endif
Index: pkgsrc/lang/python39/patches/patch-Python_thread__pthread.h
diff -u /dev/null pkgsrc/lang/python39/patches/patch-Python_thread__pthread.h:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-Python_thread__pthread.h Sat Oct 10 20:20:12 2020
@@ -0,0 +1,14 @@
+$NetBSD: patch-Python_thread__pthread.h,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+--- Python/thread_pthread.h.orig       2013-05-15 16:33:00.000000000 +0000
++++ Python/thread_pthread.h
+@@ -50,6 +50,9 @@
+    we need to add 0 to make it work there as well. */
+ #if (_POSIX_SEMAPHORES+0) == -1
+ #define HAVE_BROKEN_POSIX_SEMAPHORES
++#elif defined(__NetBSD__)
++/* XXX accesses to closed file descriptors, needs debugging */
++#define HAVE_BROKEN_POSIX_SEMAPHORES
+ #else
+ #include <semaphore.h>
+ #include <errno.h>
Index: pkgsrc/lang/python39/patches/patch-configure
diff -u /dev/null pkgsrc/lang/python39/patches/patch-configure:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-configure        Sat Oct 10 20:20:12 2020
@@ -0,0 +1,61 @@
+$NetBSD: patch-configure,v 1.1 2020/10/10 20:20:12 adam 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.
+
+--- configure.orig     2020-10-05 15:07:58.000000000 +0000
++++ configure
+@@ -6961,7 +6961,7 @@ UNIVERSAL_ARCH_FLAGS=
+ # tweak BASECFLAGS based on compiler and platform
+ case $GCC in
+ yes)
+-    CFLAGS_NODIST="$CFLAGS_NODIST -std=c99"
++    CFLAGS_NODIST="$CFLAGS_NODIST -std=gnu99"
+ 
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra" >&5
+ $as_echo_n "checking for -Wextra... " >&6; }
+@@ -9617,7 +9617,6 @@ then
+               # to ensure that tests don't crash
+               # Note: This matches the value of THREAD_STACK_SIZE in
+               # thread_pthread.h
+-              LINKFORSHARED="-Wl,-stack_size,1000000 $LINKFORSHARED"
+ 
+               if test "$enable_framework"
+               then
+@@ -14437,10 +14436,10 @@ _ACEOF
+ if ac_fn_c_try_compile "$LINENO"; then :
+ 
+ 
+-if $GREP noonsees conftest.$ac_objext >/dev/null ; then
++if strings -a conftest.$ac_objext | grep noonsees >/dev/null ; then
+   ax_cv_c_float_words_bigendian=yes
+ fi
+-if $GREP seesnoon conftest.$ac_objext >/dev/null ; then
++if strings -a conftest.$ac_objext | grep seesnoon >/dev/null ; then
+   if test "$ax_cv_c_float_words_bigendian" = unknown; then
+     ax_cv_c_float_words_bigendian=no
+   else
+@@ -15326,8 +15325,6 @@ fi
+ 
+ 
+ case $ac_sys_system in
+-    Linux*|GNU*|Darwin|VxWorks)
+-      EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
+     *)
+       EXT_SUFFIX=${SHLIB_SUFFIX};;
+ esac
+@@ -15383,11 +15380,7 @@ fi
+ 
+ 
+ 
+-if test x$PLATFORM_TRIPLET = x; then
+-  LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}"
+-else
+-  LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
+-fi
++LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}"
+ 
+ 
+ # Check whether right shifting a negative integer extends the sign bit
Index: pkgsrc/lang/python39/patches/patch-pyconfig.h.in
diff -u /dev/null pkgsrc/lang/python39/patches/patch-pyconfig.h.in:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-pyconfig.h.in    Sat Oct 10 20:20:12 2020
@@ -0,0 +1,16 @@
+$NetBSD: patch-pyconfig.h.in,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+detect netcan/can.h on NetBSD
+
+--- pyconfig.h.in.orig 2019-09-06 08:21:57.000000000 +0000
++++ pyconfig.h.in
+@@ -631,6 +631,9 @@
+ /* Define to 1 if you have the <linux/memfd.h> header file. */
+ #undef HAVE_LINUX_MEMFD_H
+ 
++/* Define to 1 if you have the <netcan/can.h> header file. */
++#undef HAVE_NETCAN_CAN_H
++
+ /* Define to 1 if you have the <linux/netlink.h> header file. */
+ #undef HAVE_LINUX_NETLINK_H
+ 
Index: pkgsrc/lang/python39/patches/patch-setup.py
diff -u /dev/null pkgsrc/lang/python39/patches/patch-setup.py:1.1
--- /dev/null   Sat Oct 10 20:20:12 2020
+++ pkgsrc/lang/python39/patches/patch-setup.py Sat Oct 10 20:20:12 2020
@@ -0,0 +1,143 @@
+$NetBSD: patch-setup.py,v 1.1 2020/10/10 20:20:12 adam 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.
+Also look for uuid/uuid.h.
+
+--- setup.py.orig      2020-10-05 15:07:58.000000000 +0000
++++ setup.py
+@@ -29,7 +29,7 @@ except ImportError:
+     SUBPROCESS_BOOTSTRAP = True
+ 
+ 
+-from distutils import log
++from distutils import log, text_file
+ from distutils.command.build_ext import build_ext
+ from distutils.command.build_scripts import build_scripts
+ from distutils.command.install import install
+@@ -43,7 +43,7 @@ from distutils.spawn import find_executa
+ TEST_EXTENSIONS = True
+ 
+ # This global variable is used to hold the list of modules to be disabled.
+-DISABLED_MODULE_LIST = []
++DISABLED_MODULE_LIST = ["_curses", "_curses_panel", "_elementtree", "_gdbm", "pyexpat", "readline", "_sqlite3", "_tkinter", "xxlimited"]
+ 
+ 
+ def get_platform():
+@@ -740,15 +740,15 @@ class PyBuildExt(build_ext):
+                         add_dir_to_list(dir_list, directory)
+ 
+     def configure_compiler(self):
+-        # Ensure that /usr/local is always used, but the local build
+-        # directories (i.e. '.' and 'Include') must be first.  See issue
+-        # 10520.
+-        if not CROSS_COMPILING:
+-            add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+-            add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+-        # only change this for cross builds for 3.3, issues on Mageia
+-        if CROSS_COMPILING:
+-            self.add_cross_compiling_paths()
++        # Add the buildlink directories for pkgsrc
++        if os.environ.get('BUILDLINK_DIR'):
++            dir = os.environ['BUILDLINK_DIR']
++            libdir = dir + '/lib'
++            incdir = dir + '/include'
++            if libdir not in self.compiler.library_dirs:
++                self.compiler.library_dirs.insert(0, libdir)
++            if incdir not in self.compiler.include_dirs:
++                self.compiler.include_dirs.insert(0, incdir)
+         self.add_multiarch_paths()
+         self.add_ldflags_cppflags()
+ 
+@@ -1013,8 +1013,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
+-        elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'):
+-            curses_library = 'ncursesw'
+         # 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'):
+@@ -1116,8 +1114,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
+-        if (curses_enabled and not skip_curses_panel and
+-                self.compiler.find_library_file(self.lib_dirs, panel_library)):
++        if curses_enabled and not skip_curses_panel:
+             self.add(Extension('_curses_panel', ['_curses_panel.c'],
+                            include_dirs=curses_includes,
+                            define_macros=curses_defines,
+@@ -1368,6 +1365,31 @@ class PyBuildExt(build_ext):
+         dbm_order = ['gdbm']
+         # The standard Unix dbm module:
+         if not CYGWIN:
++            # Top half based on find_file
++            def find_ndbm_h(dirs):
++                ret = None
++                if MACOS:
++                    sysroot = macosx_sdk_root()
++                for dir in dirs:
++                    f = os.path.join(dir, 'ndbm.h')
++                    if MACOS and is_macosx_sdk_path(dir):
++                        f = os.path.join(sysroot, dir[1:], 'ndbm.h')
++                    if not os.path.exists(f):
++                        continue
++
++                    ret = True
++                    input = text_file.TextFile(f)
++                    while True:
++                        line = input.readline()
++                        if not line:
++                            break
++                        if re.search('This file is part of GDBM', line):
++                            ret = None
++                            break
++                    input.close()
++                    break
++                return ret
++
+             config_args = [arg.strip("'")
+                            for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
+             dbm_args = [arg for arg in config_args
+@@ -1379,7 +1401,7 @@ class PyBuildExt(build_ext):
+             dbmext = None
+             for cand in dbm_order:
+                 if cand == "ndbm":
+-                    if find_file("ndbm.h", self.inc_dirs, []) is not None:
++                    if find_ndbm_h(self.inc_dirs) is not None:
+                         # Some systems have -lndbm, others have -lgdbm_compat,
+                         # others don't have either
+                         if self.compiler.find_library_file(self.lib_dirs,
+@@ -1779,6 +1801,8 @@ class PyBuildExt(build_ext):
+     def detect_uuid(self):
+         # Build the _uuid module if possible
+         uuid_incs = find_file("uuid.h", self.inc_dirs, ["/usr/include/uuid"])
++        if uuid_incs is None:
++            uuid_incs = find_file("uuid/uuid.h", self.inc_dirs, [])
+         if uuid_incs is not None:
+             if self.compiler.find_library_file(self.lib_dirs, 'uuid'):
+                 uuid_libs = ['uuid']
+@@ -2226,10 +2250,7 @@ class PyBuildExt(build_ext):
+             sources = ['_decimal/_decimal.c']
+             depends = ['_decimal/docstrings.h']
+         else:
+-            include_dirs = [os.path.abspath(os.path.join(self.srcdir,
+-                                                         'Modules',
+-                                                         '_decimal',
+-                                                         'libmpdec'))]
++            include_dirs = ['Modules/_decimal/libmpdec']
+             libraries = ['m']
+             sources = [
+               '_decimal/_decimal.c',
+@@ -2609,7 +2630,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
+-          scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
++          scripts = ["Tools/scripts/pydoc3",
+                      "Tools/scripts/2to3"]
+         )
+ 



Home | Main Index | Thread Index | Old Index