Files
MINGW-packages/mingw-w64-python-numpy/0012-clang-no-gcc-workaround.patch
Jeremy Drake 4419ac4c6f numpy: fix clang build
Disable BLAS and fortran.  Numpy states both are optional to build, but
had an issue in their build scripts if fortran wasn't found.

Add an explicit clang check to a GCC bug workaround for GCC < 8.4,
because clang pretends to be a really old GCC version (like 4.x).
2021-07-22 20:44:29 -07:00

59 lines
2.3 KiB
Diff

--- numpy-1.21.0/numpy/distutils/command/autodist.py.orig 2021-07-22 19:58:29.268697600 -0700
+++ numpy-1.21.0/numpy/distutils/command/autodist.py 2021-07-22 19:59:01.473946900 -0700
@@ -62,6 +62,22 @@
""")
return cmd.try_compile(body, None, None)
+def check_compiler_clang(cmd):
+ """Check if the compiler is Clang."""
+
+ cmd._check_compiler()
+ body = textwrap.dedent("""
+ int
+ main()
+ {
+ #if (! defined __clang__)
+ #error clang required
+ #endif
+ return 0;
+ }
+ """)
+ return cmd.try_compile(body, None, None)
+
def check_gcc_version_at_least(cmd, major, minor=0, patchlevel=0):
"""
--- numpy-1.21.0/numpy/distutils/command/config.py.orig 2021-07-22 19:59:38.526117300 -0700
+++ numpy-1.21.0/numpy/distutils/command/config.py 2021-07-22 20:01:07.256382700 -0700
@@ -23,7 +23,8 @@
check_gcc_version_at_least,
check_inline,
check_restrict,
- check_compiler_gcc)
+ check_compiler_gcc,
+ check_compiler_clang)
LANG_EXT['f77'] = '.f'
LANG_EXT['f90'] = '.f90'
@@ -422,6 +423,10 @@
"""Return True if the C compiler is gcc"""
return check_compiler_gcc(self)
+ def check_compiler_clang(self):
+ """Return True if the C compiler is clang"""
+ return check_compiler_clang(self)
+
def check_gcc_function_attribute(self, attribute, name):
return check_gcc_function_attribute(self, attribute, name)
--- numpy-1.21.0/numpy/core/setup.py.orig 2021-06-18 14:49:32.241745700 -0700
+++ numpy-1.21.0/numpy/core/setup.py 2021-07-22 20:01:28.394050600 -0700
@@ -172,6 +172,7 @@
# support on Windows-based platforms
if (sys.platform in ('win32', 'cygwin') and
config.check_compiler_gcc() and
+ not config.check_compiler_clang() and
not config.check_gcc_version_at_least(8, 4)):
ext.extra_compile_args.extend(
['-ffixed-xmm%s' % n for n in range(16, 32)])