pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/math/py-numpy py-numpy: Workaround undefined-symbol er...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c90732631f63
branches:  trunk
changeset: 379804:c90732631f63
user:      ryoon <ryoon%pkgsrc.org@localhost>
date:      Mon May 23 17:28:41 2022 +0000

description:
py-numpy: Workaround undefined-symbol errors under NetBSD at least

py-numpy-1.22.4's symbol check mechanism does not work for NetBSD
and the other platforms, because gcc and clang calculate trivial math
functions, for example, log1pl() and expm1l(), with immediate arguments,
for example 0. So compiling 'log1pl(0)' is always successful
even if -lm is not added to the compiler's commandline arguments.
Use GNU autotools style check with ugly workaround.
I have no idea about WASM case. However current mechanism will
not work as expected.
Bump PKGREVISION.

diffstat:

 math/py-numpy/Makefile                                        |   3 +-
 math/py-numpy/distinfo                                        |   5 +-
 math/py-numpy/patches/patch-numpy_core_setup.py               |  13 +-
 math/py-numpy/patches/patch-numpy_distutils_command_config.py |  69 +++++++++++
 4 files changed, 85 insertions(+), 5 deletions(-)

diffs (127 lines):

diff -r 487132f85da9 -r c90732631f63 math/py-numpy/Makefile
--- a/math/py-numpy/Makefile    Mon May 23 17:21:10 2022 +0000
+++ b/math/py-numpy/Makefile    Mon May 23 17:28:41 2022 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.93 2022/05/22 19:14:00 adam Exp $
+# $NetBSD: Makefile,v 1.94 2022/05/23 17:28:41 ryoon Exp $
 
 DISTNAME=      numpy-1.22.4
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME}
+PKGREVISION=   1
 CATEGORIES=    math python
 MASTER_SITES=  ${MASTER_SITE_PYPI:=n/numpy/}
 EXTRACT_SUFX=  .zip
diff -r 487132f85da9 -r c90732631f63 math/py-numpy/distinfo
--- a/math/py-numpy/distinfo    Mon May 23 17:21:10 2022 +0000
+++ b/math/py-numpy/distinfo    Mon May 23 17:28:41 2022 +0000
@@ -1,10 +1,11 @@
-$NetBSD: distinfo,v 1.72 2022/05/22 19:14:00 adam Exp $
+$NetBSD: distinfo,v 1.73 2022/05/23 17:28:41 ryoon Exp $
 
 BLAKE2s (numpy-1.22.4.zip) = 020700e15b661d064377106b6c3ecd5959c524e32cc2f3d1b97739894bbbcff8
 SHA512 (numpy-1.22.4.zip) = bb2993459157c43f8c419de98be1c832f108b4eb6b96e1d20f406eccd782681ad8d0f8653637962ac592abe7d75719c17678ec97f035f6c87d4c7f939a1a8a48
 Size (numpy-1.22.4.zip) = 11458830 bytes
-SHA1 (patch-numpy_core_setup.py) = 9e2388dd0de7f31994d3b27c10e439acd3ca1a03
+SHA1 (patch-numpy_core_setup.py) = 9f5d5934112d533f44207c2106db75465170d605
 SHA1 (patch-numpy_core_src_npymath_npy__math__private.h) = e3b8e751fd0b6b6c6794d714aa5f60dfe9d7f421
+SHA1 (patch-numpy_distutils_command_config.py) = eb37d28482689703e0c1a264f9768409cf8bb4b6
 SHA1 (patch-numpy_distutils_fcompiler_____init____.py) = 49d070da5b48bd9818b37ac3254341fa68503c53
 SHA1 (patch-numpy_distutils_fcompiler_g95.py) = be73b64a3e551df998b6a904d6db762bf28a98ed
 SHA1 (patch-numpy_distutils_fcompiler_gnu.py) = 1ab3fd7b3f42328f4094f1b21a65c05ae4d975b7
diff -r 487132f85da9 -r c90732631f63 math/py-numpy/patches/patch-numpy_core_setup.py
--- a/math/py-numpy/patches/patch-numpy_core_setup.py   Mon May 23 17:21:10 2022 +0000
+++ b/math/py-numpy/patches/patch-numpy_core_setup.py   Mon May 23 17:28:41 2022 +0000
@@ -1,9 +1,18 @@
-$NetBSD: patch-numpy_core_setup.py,v 1.7 2022/05/22 19:14:00 adam Exp $
+$NetBSD: patch-numpy_core_setup.py,v 1.8 2022/05/23 17:28:41 ryoon Exp $
 
 Use C language (not F77 from blas_info); fixes library name on Darwin.
 
---- numpy/core/setup.py.orig   2022-05-20 05:46:10.000000000 +0000
+--- numpy/core/setup.py.orig   2022-05-19 22:46:10.000000000 +0000
 +++ numpy/core/setup.py
+@@ -217,7 +217,7 @@ def check_math_capabilities(config, ext,
+             f, args, headers, m = tup[0], tup[1], [tup[2]], fname2def(tup[0])
+         else:
+             f, args, headers, m = tup[0], tup[1], [tup[2]], fname2def(tup[3])
+-        if config.check_func(f, decl=False, call=True, call_args=args,
++        if config.check_func(f, decl=False, call=False, call_args=args,
+                              headers=headers):
+             moredefs.append((m, 1))
+ 
 @@ -868,6 +868,7 @@ def configuration(parent_package='',top_
  
      if have_blas:
diff -r 487132f85da9 -r c90732631f63 math/py-numpy/patches/patch-numpy_distutils_command_config.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/py-numpy/patches/patch-numpy_distutils_command_config.py     Mon May 23 17:28:41 2022 +0000
@@ -0,0 +1,69 @@
+$NetBSD: patch-numpy_distutils_command_config.py,v 1.1 2022/05/23 17:28:41 ryoon Exp $
+
+* Workaround for undefined-sysbol errors from graphics/py-matplotlib.
+
+--- numpy/distutils/command/config.py.orig     2022-05-17 10:56:58.000000000 +0000
++++ numpy/distutils/command/config.py
+@@ -321,11 +321,7 @@ class config(old_config):
+         # return a value.
+         self._check_compiler()
+         body = []
+-        if decl:
+-            if type(decl) == str:
+-                body.append(decl)
+-            else:
+-                body.append("int %s (void);" % func)
++        body.append("int %s (void);" % func)
+         # Handle MSVC intrinsics: force MS compiler to make a function call.
+         # Useful to test for some functions when built with optimization on, to
+         # avoid build error because the intrinsic and our 'fake' test
+@@ -336,15 +332,16 @@ class config(old_config):
+         body.append("int main (void) {")
+         if call:
+             if call_args is None:
++                body.append("  %s(%s);" % (func, call_args))
+                 call_args = ''
+-            body.append("  %s(%s);" % (func, call_args))
++            body.append("  %s();" % func)
+         else:
+             body.append("  %s;" % func)
+         body.append("  return 0;")
+         body.append("}")
+         body = '\n'.join(body) + "\n"
+ 
+-        return self.try_link(body, headers, include_dirs,
++        return self.try_link(body, None, include_dirs,
+                              libraries, library_dirs)
+ 
+     def check_funcs_once(self, funcs,
+@@ -376,10 +373,8 @@ class config(old_config):
+         """
+         self._check_compiler()
+         body = []
+-        if decl:
+-            for f, v in decl.items():
+-                if v:
+-                    body.append("int %s (void);" % f)
++        for f in funcs:
++            body.append("int %s (void);" % f)
+ 
+         # Handle MS intrinsics. See check_func for more info.
+         body.append("#ifdef _MSC_VER")
+@@ -395,7 +390,7 @@ class config(old_config):
+                         args = ''
+                     else:
+                         args = call_args[f]
+-                    body.append("  %s(%s);" % (f, args))
++                    body.append("  %s();" % f)
+                 else:
+                     body.append("  %s;" % f)
+         else:
+@@ -405,7 +400,7 @@ class config(old_config):
+         body.append("}")
+         body = '\n'.join(body) + "\n"
+ 
+-        return self.try_link(body, headers, include_dirs,
++        return self.try_link(body, None, include_dirs,
+                              libraries, library_dirs)
+ 
+     def check_inline(self):



Home | Main Index | Thread Index | Old Index