summaryrefslogtreecommitdiff
path: root/math/openblas
diff options
context:
space:
mode:
authorbacon <bacon@pkgsrc.org>2020-11-05 16:31:45 +0000
committerbacon <bacon@pkgsrc.org>2020-11-05 16:31:45 +0000
commitaf1f6c555188acf044ce2518e4dd049cb9fbc8ac (patch)
treed5482c490fc7ec5c2d188cacb7a66355e552213a /math/openblas
parentd4755bfbc4151c03a83f2546f1a8d0fa2866db45 (diff)
downloadpkgsrc-af1f6c555188acf044ce2518e4dd049cb9fbc8ac.tar.gz
math/openblas: import openblas-0.3.7
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. OpenBLAS is an open source project supported by Lab of Parallel Software and Computational Science, ISCAS. This package builds the serial library. Needs patching and testing on platforms besides Linux
Diffstat (limited to 'math/openblas')
-rw-r--r--math/openblas/DESCR5
-rw-r--r--math/openblas/Makefile7
-rw-r--r--math/openblas/Makefile.common142
-rw-r--r--math/openblas/PLIST9
-rw-r--r--math/openblas/buildlink3.mk12
-rw-r--r--math/openblas/distinfo27
-rw-r--r--math/openblas/options.mk18
-rw-r--r--math/openblas/patches/patch-Makefile72
-rw-r--r--math/openblas/patches/patch-Makefile.install43
-rw-r--r--math/openblas/patches/patch-Makefile.system52
-rw-r--r--math/openblas/patches/patch-c_check15
-rw-r--r--math/openblas/patches/patch-common__arm.h20
-rw-r--r--math/openblas/patches/patch-cpuid__arm.c16
-rw-r--r--math/openblas/patches/patch-cpuid__arm64.c15
-rw-r--r--math/openblas/patches/patch-cpuid_ia64.c16
-rw-r--r--math/openblas/patches/patch-exports+Makefile22
-rw-r--r--math/openblas/patches/patch-f_check24
-rw-r--r--math/openblas/patches/patch-getarch.c26
-rw-r--r--math/openblas/patches/patch-interface__ztrmv.c15
-rw-r--r--math/openblas/patches/patch-utest_Makefile19
-rw-r--r--math/openblas/version.mk3
21 files changed, 578 insertions, 0 deletions
diff --git a/math/openblas/DESCR b/math/openblas/DESCR
new file mode 100644
index 00000000000..5f86d758e4e
--- /dev/null
+++ b/math/openblas/DESCR
@@ -0,0 +1,5 @@
+OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
+OpenBLAS is an open source project supported by
+Lab of Parallel Software and Computational Science, ISCAS.
+
+This package builds the serial library.
diff --git a/math/openblas/Makefile b/math/openblas/Makefile
new file mode 100644
index 00000000000..8528d8bcdcc
--- /dev/null
+++ b/math/openblas/Makefile
@@ -0,0 +1,7 @@
+# $NetBSD: Makefile,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+MAINTAINER= thomas.orgis@uni-hamburg.de
+
+OPENBLAS_VARIANT= openblas
+.include "../../math/openblas/Makefile.common"
+.include "../../mk/bsd.pkg.mk"
diff --git a/math/openblas/Makefile.common b/math/openblas/Makefile.common
new file mode 100644
index 00000000000..e089b8e8851
--- /dev/null
+++ b/math/openblas/Makefile.common
@@ -0,0 +1,142 @@
+# $NetBSD: Makefile.common,v 1.1 2020/11/05 16:31:45 bacon Exp $
+#
+# used by math/openblas_pthread/Makefile
+# used by math/openblas_openmp/Makefile
+# used by math/openblas/Makefile
+#
+# This is the common Makefile for OpenBLAS builds. It depends on
+# OPENBLAS_VARIANT = (openblas|openblas_pthread|openblas_openmp)
+# being set.
+
+DISTNAME= OpenBLAS-${OPENBLAS_VERSION}
+PKGNAME= ${OPENBLAS_VARIANT}-${OPENBLAS_VERSION}
+DIST_SUBDIR= openblas-${OPENBLAS_VERSION}
+CATEGORIES= math
+MASTER_SITES= ${MASTER_SITE_GITHUB:=xianyi/} \
+ http://www.netlib.org/lapack/timing/
+DISTFILES= ${DISTNAME}.tar.gz ${LARGE_FILE} ${TIMING_FILE}
+LARGE_FILE= large.tgz
+TIMING_FILE= timing.tgz
+GITHUB_PROJECT= OpenBLAS
+GITHUB_TAG= v${OPENBLAS_VERSION}
+
+DISTINFO_FILE= ${.CURDIR}/../../math/openblas/distinfo
+PATCHDIR= ${.CURDIR}/../../math/openblas/patches
+
+HOMEPAGE= https://github.com/xianyi/OpenBLAS
+COMMENT= Optimized BLAS library based on GotoBLAS2
+LICENSE= modified-bsd
+
+# Needs source patching and/or GCC_REQD for NetBSD
+# NetBSD gfortran framework needs improvements for this and other packages
+# Untested on other platforms
+ONLY_FOR_PLATFORM= Linux-*-*
+
+USE_LANGUAGES= c fortran
+USE_TOOLS+= gmake perl:build
+
+NO_CONFIGURE= yes
+
+TEST_TARGET= tests
+
+# Work around CFLAGS breakage:
+# https://github.com/xianyi/OpenBLAS/issues/818
+MAKE_FLAGS+= CFLAGS=${CFLAGS:Q}
+MAKE_FLAGS+= CXXFLAGS=${CXXFLAGS:Q}
+MAKE_FLAGS+= FFLAGS=${FFLAGS:Q}
+# Also set compilers explicitly, overriding Makefile.rule
+MAKE_FLAGS+= CC=${CC:Q}
+MAKE_FLAGS+= CXX=${CXX:Q}
+MAKE_FLAGS+= FC=${FC:Q}
+
+# You may override the autodetected thread count limit.
+# Default is detected from build host, which may differ from run host.
+BUILD_DEFS+= OPENBLAS_THREAD_LIMIT
+
+.include "../../mk/bsd.prefs.mk"
+
+# Default checks number of cores of build host.
+# Do we want a pkgsrc-wide default?
+OPENBLAS_THREAD_LIMIT?= # empty
+.if !empty(OPENBLAS_THREAD_LIMIT)
+MAKE_FLAGS+= NUM_THREADS=${OPENBLAS_THREAD_LIMIT:Q}
+.endif
+BENCHMARK_MAXTHREADS?= 8
+
+.if ${MACHINE_ARCH:M*64} == ""
+MAKE_FLAGS+= BINARY32=1
+.else
+MAKE_FLAGS+= BINARY64=1
+.endif
+# Those come in separate BLAS-agnostic packages.
+# ... except we start headaches about ILP64?
+MAKE_FLAGS+= NO_CBLAS=1 NO_LAPACKE=1
+
+# Separate headers and cmake stuff.
+MAKE_FLAGS+= OPENBLAS_INCLUDE_DIR=${PREFIX}/include/${OPENBLAS_VARIANT}
+MAKE_FLAGS+= OPENBLAS_CMAKE_DIR=${PREFIX}/lib/cmake/${OPENBLAS_VARIANT}
+
+# TODO: Set INTERFACE64=1 with additional OPENBLAS_VARIANTs.
+# Need to settle on a convention for SYMBOLSUFFIX first, see
+# https://github.com/xianyi/OpenBLAS/issues/646 .
+.if ${OPENBLAS_VARIANT} == openblas
+MAKE_FLAGS+= USE_OPENMP=0 USE_THREAD=0 USE_LOCKING=1
+BENCHMARK_ENV= USE_SIMPLE_THREADED_LEVEL3=1
+.elif ${OPENBLAS_VARIANT} == openblas_pthread
+BENCHMARK_ENV= OPENBLAS_NUM_THREADS=${BENCHMARK_MAXTHREADS}
+MAKE_FLAGS+= LIBNAMESUFFIX=pthread USE_OPENMP=0 USE_THREAD=1
+.elif ${OPENBLAS_VARIANT} == openblas_openmp
+BENCHMARK_ENV= OMP_NUM_THREADS=${BENCHMARK_MAXTHREADS}
+MAKE_FLAGS+= LIBNAMESUFFIX=openmp USE_OPENMP=1 NO_AFFINITY=1
+.endif
+
+SUBST_CLASSES+= arch
+SUBST_STAGE.arch= pre-build
+SUBST_SED.arch+= -e "s+(ARCH)+(ARCH_)+"
+SUBST_FILES.arch+= Makefile.tail
+SUBST_FILES.arch+= driver/level3/Makefile
+SUBST_FILES.arch+= driver/others/Makefile
+SUBST_FILES.arch+= exports/Makefile
+SUBST_FILES.arch+= interface/Makefile
+SUBST_FILES.arch+= kernel/Makefile
+SUBST_FILES.arch+= kernel/Makefile.L3
+SUBST_FILES.arch+= lapack/laswp/Makefile
+SUBST_FILES.arch+= lapack-netlib/SRC/Makefile
+SUBST_FILES.arch+= lapack-netlib/SRC/VARIANTS/Makefile
+SUBST_FILES.arch+= lapack-netlib/TESTING/MATGEN/Makefile
+SUBST_FILES.arch+= lapack-netlib/LAPACKE/src/Makefile
+SUBST_FILES.arch+= lapack-netlib/LAPACKE/utils/Makefile
+SUBST_FILES.arch+= reference/Makefile
+SUBST_FILES.arch+= Makefile.system
+
+SUBST_CLASSES+= threads
+SUBST_STAGE.threads= pre-build
+SUBST_SED.threads+= -e "s+OPENBLAS_NUM_THREADS+OMP_NUM_THREADS+g"
+SUBST_FILES.threads+= test/Makefile
+SUBST_FILES.threads+= ctest/Makefile
+
+# Fix up pkgconfig file installation.
+SUBST_CLASSES+= pc
+SUBST_STAGE.pc= pre-build
+SUBST_SED.pc+= -e 's+-lopenblas+-l${OPENBLAS_VARIANT}+'
+SUBST_SED.pc+= -e 's+openblas.pc"+${OPENBLAS_VARIANT}.pc"+'
+SUBST_FILES.pc+= Makefile.install openblas.pc.in
+
+PLIST_SRC= ${.CURDIR}/../../math/openblas/PLIST
+PLIST_SUBST+= OPENBLAS_VARIANT=${OPENBLAS_VARIANT}
+
+post-extract:
+ (cd ${DISTDIR}/${DIST_SUBDIR} && \
+ ${CP} ${LARGE_FILE} ${TIMING_FILE} ${WRKSRC})
+
+# This builds some benchmark programs you can call from ${WRKSRC} afterwards.
+.PHONY: benchmark
+benchmark: build
+ (cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${BENCHMARK_ENV} \
+ ${MAKE_PROGRAM} ${MAKE_FLAGS} hpl)
+ (cd ${WRKSRC}/benchmark && ${SETENV} ${MAKE_ENV} \
+ ${BENCHMARK_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS})
+
+.include "../../math/openblas/version.mk"
+
+.include "options.mk"
diff --git a/math/openblas/PLIST b/math/openblas/PLIST
new file mode 100644
index 00000000000..3c5f04ea45e
--- /dev/null
+++ b/math/openblas/PLIST
@@ -0,0 +1,9 @@
+@comment $NetBSD: PLIST,v 1.1 2020/11/05 16:31:45 bacon Exp $
+lib/lib${OPENBLAS_VARIANT}.a
+lib/lib${OPENBLAS_VARIANT}.so
+lib/lib${OPENBLAS_VARIANT}.so.0
+lib/pkgconfig/${OPENBLAS_VARIANT}.pc
+lib/cmake/${OPENBLAS_VARIANT}/OpenBLASConfig.cmake
+lib/cmake/${OPENBLAS_VARIANT}/OpenBLASConfigVersion.cmake
+include/${OPENBLAS_VARIANT}/openblas_config.h
+include/${OPENBLAS_VARIANT}/f77blas.h
diff --git a/math/openblas/buildlink3.mk b/math/openblas/buildlink3.mk
new file mode 100644
index 00000000000..fefc50fa46a
--- /dev/null
+++ b/math/openblas/buildlink3.mk
@@ -0,0 +1,12 @@
+# $NetBSD: buildlink3.mk,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+BUILDLINK_TREE+= openblas
+
+.if !defined(OPENBLAS_BUILDLINK3_MK)
+OPENBLAS_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.openblas+= openblas>=0.3.5
+BUILDLINK_PKGSRCDIR.openblas?= ../../math/openblas
+.endif # OPENBLAS_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -openblas
diff --git a/math/openblas/distinfo b/math/openblas/distinfo
new file mode 100644
index 00000000000..ad6ee266258
--- /dev/null
+++ b/math/openblas/distinfo
@@ -0,0 +1,27 @@
+$NetBSD: distinfo,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+SHA1 (openblas-0.3.7/OpenBLAS-0.3.7.tar.gz) = 6a79b36d1bf73584a513139806d226f9189d621e
+RMD160 (openblas-0.3.7/OpenBLAS-0.3.7.tar.gz) = 72103fa62efaa9ab77f80f9ae70b1417fa6f2122
+SHA512 (openblas-0.3.7/OpenBLAS-0.3.7.tar.gz) = 9c4898301c675471bbce2bb99b6bbe7c90724784fac06504416d4bd5da3cd4488f727b0a118c9a38ea342daac2af9e32597a847004241cc57de693b58b856262
+Size (openblas-0.3.7/OpenBLAS-0.3.7.tar.gz) = 11986592 bytes
+SHA1 (openblas-0.3.7/large.tgz) = a689e5b180595b40c5719b0f358b31b15b57a2db
+RMD160 (openblas-0.3.7/large.tgz) = 8010ff4002ef42cf22a9ee9345011d68fc27d855
+SHA512 (openblas-0.3.7/large.tgz) = e24db2b8a4253ccff9ca196815901c1fefd55e882f4fe1085715ac84b8f318e1842a91072130c17fdd144344ffc80233a77500da9349acb54e504b3935825965
+Size (openblas-0.3.7/large.tgz) = 2595 bytes
+SHA1 (openblas-0.3.7/timing.tgz) = fd47fc3f26d142a791df51e4a422a49662507252
+RMD160 (openblas-0.3.7/timing.tgz) = f0fe220e7ab611d4db8d8cab960361955e2ab093
+SHA512 (openblas-0.3.7/timing.tgz) = be0abfcfffdf0e118ed7e25a8451639833cf0ad6bb04d101bbe194c16f656b6ce509b2f76acf4ad626d1fb5b126bd5498cfea262f2946c2d077751112a2906af
+Size (openblas-0.3.7/timing.tgz) = 1059485 bytes
+SHA1 (patch-Makefile) = 6029076c34765e53a26617fb4bd36b56ba413f1b
+SHA1 (patch-Makefile.install) = 08c80677f8040623eaf5277cf92b5f5969fb4a07
+SHA1 (patch-Makefile.system) = d9dec776fb0d2919850506f682f3623b68751c90
+SHA1 (patch-c_check) = c5990809434a259399c75e660aad5abe83899548
+SHA1 (patch-common__arm.h) = f08ec61bee8317daac267e90a79f46097b3431c9
+SHA1 (patch-cpuid__arm.c) = 20f95cede90cbe548c0cd09ed2e3d37d1d4aeabd
+SHA1 (patch-cpuid__arm64.c) = bbeb7222b32ec821511a6798fc27ff7269700662
+SHA1 (patch-cpuid_ia64.c) = 39649319b8c0a37b8d494e3c03b1ddb6fb616603
+SHA1 (patch-exports+Makefile) = 973016eae339d014d9f6f146e1e934793eb76145
+SHA1 (patch-f_check) = 9162d6a31f96c6af5aada82f6e78cf0385384215
+SHA1 (patch-getarch.c) = 3d0ea5b989c6402d9e2f03a6cc2de848f06ca16d
+SHA1 (patch-interface__ztrmv.c) = 6038946f8fb9542e680178ece2bd0d0d5853baad
+SHA1 (patch-utest_Makefile) = e6f816dfd5b905db93a1a963d86ae3afbeed81d3
diff --git a/math/openblas/options.mk b/math/openblas/options.mk
new file mode 100644
index 00000000000..f43c5db6f17
--- /dev/null
+++ b/math/openblas/options.mk
@@ -0,0 +1,18 @@
+# $NetBSD: options.mk,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.openblas
+# Auto-detect CPU features at runtime or use static features from build host
+PKG_SUPPORTED_OPTIONS= dynamic-arch
+PKG_SUGGESTED_OPTIONS= dynamic-arch
+
+.include "../../mk/bsd.prefs.mk"
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mdynamic-arch)
+MAKE_FLAGS+= DYNAMIC_ARCH=1
+.else
+MAKE_FLAGS+= DYNAMIC_ARCH=0
+.endif
+
+# Other options create variants of the library, not configurations of one.
+# Especially INTERFACE64, which changes the API!
diff --git a/math/openblas/patches/patch-Makefile b/math/openblas/patches/patch-Makefile
new file mode 100644
index 00000000000..d2c4ccfb03e
--- /dev/null
+++ b/math/openblas/patches/patch-Makefile
@@ -0,0 +1,72 @@
+$NetBSD: patch-Makefile,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+Remove special library names.
+
+--- Makefile.orig 2019-08-11 21:23:27.000000000 +0000
++++ Makefile
+@@ -100,7 +100,6 @@ ifneq ($(NO_SHARED), 1)
+ ifeq ($(OSNAME), $(filter $(OSNAME),Linux SunOS Android Haiku))
+ @$(MAKE) -C exports so
+ @ln -fs $(LIBSONAME) $(LIBPREFIX).so
+- @ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION)
+ endif
+ ifeq ($(OSNAME), $(filter $(OSNAME),FreeBSD OpenBSD NetBSD DragonFly))
+ @$(MAKE) -C exports so
+@@ -108,8 +107,6 @@ ifeq ($(OSNAME), $(filter $(OSNAME),Free
+ endif
+ ifeq ($(OSNAME), Darwin)
+ @$(MAKE) -C exports dyn
+- @ln -fs $(LIBDYNNAME) $(LIBPREFIX).dylib
+- @ln -fs $(LIBDYNNAME) $(LIBPREFIX).$(MAJOR_VERSION).dylib
+ endif
+ ifeq ($(OSNAME), WINNT)
+ @$(MAKE) -C exports dll
+@@ -146,7 +143,6 @@ ifeq ($(NO_SHARED), 1)
+ $(error OpenBLAS: neither static nor shared are enabled.)
+ endif
+ endif
+- @-ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
+ @for d in $(SUBDIRS) ; \
+ do if test -d $$d; then \
+ $(MAKE) -C $$d $(@F) || exit 1 ; \
+@@ -180,7 +176,6 @@ endif
+ prof : prof_blas prof_lapack
+
+ prof_blas :
+- ln -fs $(LIBNAME_P) $(LIBPREFIX)_p.$(LIBSUFFIX)
+ for d in $(SUBDIRS) ; \
+ do if test -d $$d; then \
+ $(MAKE) -C $$d prof || exit 1 ; \
+@@ -191,7 +186,6 @@ ifeq ($(DYNAMIC_ARCH), 1)
+ endif
+
+ blas :
+- ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
+ for d in $(BLASDIRS) ; \
+ do if test -d $$d; then \
+ $(MAKE) -C $$d libs || exit 1 ; \
+@@ -199,7 +193,6 @@ blas :
+ done
+
+ hpl :
+- ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
+ for d in $(BLASDIRS) ../laswp exports ; \
+ do if test -d $$d; then \
+ $(MAKE) -C $$d $(@F) || exit 1 ; \
+@@ -213,7 +206,6 @@ ifeq ($(DYNAMIC_ARCH), 1)
+ endif
+
+ hpl_p :
+- ln -fs $(LIBNAME_P) $(LIBPREFIX)_p.$(LIBSUFFIX)
+ for d in $(SUBDIRS) ../laswp exports ; \
+ do if test -d $$d; then \
+ $(MAKE) -C $$d $(@F) || exit 1 ; \
+@@ -255,7 +247,7 @@ ifeq ($(NOFORTRAN), $(filter 0,$(NOFORTR
+ -@echo "LOADOPTS = $(FFLAGS) $(EXTRALIB)" >> $(NETLIB_LAPACK_DIR)/make.inc
+ -@echo "CC = $(CC)" >> $(NETLIB_LAPACK_DIR)/make.inc
+ -@echo "override CFLAGS = $(LAPACK_CFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc
+- -@echo "override ARCH = $(AR)" >> $(NETLIB_LAPACK_DIR)/make.inc
++ -@echo "override ARCH_ = $(AR)" >> $(NETLIB_LAPACK_DIR)/make.inc
+ -@echo "ARCHFLAGS = $(ARFLAGS) -ru" >> $(NETLIB_LAPACK_DIR)/make.inc
+ -@echo "RANLIB = $(RANLIB)" >> $(NETLIB_LAPACK_DIR)/make.inc
+ -@echo "LAPACKLIB = ../$(LIBNAME)" >> $(NETLIB_LAPACK_DIR)/make.inc
diff --git a/math/openblas/patches/patch-Makefile.install b/math/openblas/patches/patch-Makefile.install
new file mode 100644
index 00000000000..79755dccbab
--- /dev/null
+++ b/math/openblas/patches/patch-Makefile.install
@@ -0,0 +1,43 @@
+$NetBSD: patch-Makefile.install,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+Second part of removing the special library names.
+
+--- Makefile.install.orig 2019-08-11 21:23:27.000000000 +0000
++++ Makefile.install
+@@ -61,8 +61,6 @@ endif
+ ifneq ($(NO_STATIC),1)
+ @echo Copying the static library to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
+ @install -pm644 $(LIBNAME) "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)"
+- @cd "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)" ; \
+- ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
+ endif
+ #for install shared library
+ ifneq ($(NO_SHARED),1)
+@@ -70,8 +68,7 @@ ifneq ($(NO_SHARED),1)
+ ifeq ($(OSNAME), $(filter $(OSNAME),Linux SunOS Android Haiku))
+ @install -pm755 $(LIBSONAME) "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)"
+ @cd "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)" ; \
+- ln -fs $(LIBSONAME) $(LIBPREFIX).so ; \
+- ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION)
++ ln -fs $(LIBSONAME) $(LIBPREFIX).so
+ endif
+
+ ifeq ($(OSNAME), $(filter $(OSNAME),FreeBSD OpenBSD NetBSD DragonFly))
+@@ -110,16 +107,13 @@ endif
+ ifneq ($(NO_STATIC),1)
+ @echo Copying the static library to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
+ @installbsd -c -m 644 $(LIBNAME) "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)"
+- @cd "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)" ; \
+- ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
+ endif
+ #for install shared library
+ ifneq ($(NO_SHARED),1)
+ @echo Copying the shared library to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
+ @installbsd -c -m 755 $(LIBSONAME) "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)"
+ @cd "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)" ; \
+- ln -fs $(LIBSONAME) $(LIBPREFIX).so ; \
+- ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION)
++ ln -fs $(LIBSONAME) $(LIBPREFIX).so
+ endif
+
+ endif
diff --git a/math/openblas/patches/patch-Makefile.system b/math/openblas/patches/patch-Makefile.system
new file mode 100644
index 00000000000..26df829620b
--- /dev/null
+++ b/math/openblas/patches/patch-Makefile.system
@@ -0,0 +1,52 @@
+$NetBSD: patch-Makefile.system,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+Fully control the library name via LIBNAMESUFFIX
+And a bit of ARCH_
+
+--- Makefile.system.orig 2019-08-11 21:23:27.000000000 +0000
++++ Makefile.system
+@@ -1242,31 +1242,15 @@ ifndef LIBSUFFIX
+ LIBSUFFIX = a
+ endif
+
+-ifneq ($(DYNAMIC_ARCH), 1)
+-ifndef SMP
+-LIBNAME = $(LIBPREFIX)_$(LIBCORE)$(REVISION).$(LIBSUFFIX)
+-LIBNAME_P = $(LIBPREFIX)_$(LIBCORE)$(REVISION)_p.$(LIBSUFFIX)
+-else
+-LIBNAME = $(LIBPREFIX)_$(LIBCORE)p$(REVISION).$(LIBSUFFIX)
+-LIBNAME_P = $(LIBPREFIX)_$(LIBCORE)p$(REVISION)_p.$(LIBSUFFIX)
+-endif
+-else
+-ifndef SMP
+-LIBNAME = $(LIBPREFIX)$(REVISION).$(LIBSUFFIX)
+-LIBNAME_P = $(LIBPREFIX)$(REVISION)_p.$(LIBSUFFIX)
+-else
+-LIBNAME = $(LIBPREFIX)p$(REVISION).$(LIBSUFFIX)
+-LIBNAME_P = $(LIBPREFIX)p$(REVISION)_p.$(LIBSUFFIX)
+-endif
+-endif
+-
++LIBNAME = $(LIBPREFIX).$(LIBSUFFIX)
++LIBNAME_P = $(LIBPREFIX)_p.$(LIBSUFFIX)
+
+ LIBDLLNAME = $(LIBPREFIX).dll
+ IMPLIBNAME = lib$(LIBNAMEBASE).dll.a
+ ifneq ($(OSNAME), AIX)
+-LIBSONAME = $(LIBNAME:.$(LIBSUFFIX)=.so)
++LIBSONAME = $(LIBNAME:.$(LIBSUFFIX)=.so).$(MAJOR_VERSION)
+ else
+-LIBSONAME = $(LIBNAME:.$(LIBSUFFIX)=.a)
++LIBSONAME = $(LIBNAME:.$(LIBSUFFIX)=.a).$(MAJOR_VERSION)
+ endif
+ LIBDYNNAME = $(LIBNAME:.$(LIBSUFFIX)=.dylib)
+ LIBDEFNAME = $(LIBNAME:.$(LIBSUFFIX)=.def)
+@@ -1297,7 +1281,7 @@ LIB_COMPONENTS = CBLAS
+ endif
+
+ export OSNAME
+-export ARCH
++export ARCH_
+ export CORE
+ export LIBCORE
+ export PGCPATH
diff --git a/math/openblas/patches/patch-c_check b/math/openblas/patches/patch-c_check
new file mode 100644
index 00000000000..271ea082cdb
--- /dev/null
+++ b/math/openblas/patches/patch-c_check
@@ -0,0 +1,15 @@
+$NetBSD: patch-c_check,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+Avoid name collision on ARCH
+
+--- c_check.orig 2015-10-27 20:44:50 UTC
++++ c_check
+@@ -235,7 +235,7 @@ open(CONFFILE, "> $config" ) || die "Ca
+ # print $data, "\n";
+
+ print MAKEFILE "OSNAME=$os\n";
+-print MAKEFILE "ARCH=$architecture\n";
++print MAKEFILE "ARCH_=$architecture\n";
+ print MAKEFILE "C_COMPILER=$compiler\n";
+ print MAKEFILE "BINARY32=\n" if $binformat ne bin32;
+ print MAKEFILE "BINARY64=\n" if $binformat ne bin64;
diff --git a/math/openblas/patches/patch-common__arm.h b/math/openblas/patches/patch-common__arm.h
new file mode 100644
index 00000000000..4da6de12336
--- /dev/null
+++ b/math/openblas/patches/patch-common__arm.h
@@ -0,0 +1,20 @@
+$NetBSD: patch-common__arm.h,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+Add clang support
+
+--- common_arm.h.orig 2016-09-01 03:58:42 UTC
++++ common_arm.h
+@@ -93,6 +93,13 @@ static inline int blas_quickdivide(blasi
+
+ #endif
+
++/* Translate pre-UAL asm to UAL equivalents */
++#if defined(__clang__)
++#define fnmacs vmls.f32
++#define fnmacd vmls.f64
++#define fnmuls vnmul.f32
++#define fnmuld vnmul.f64
++#endif
+
+ #ifndef F_INTERFACE
+ #define REALNAME ASMNAME
diff --git a/math/openblas/patches/patch-cpuid__arm.c b/math/openblas/patches/patch-cpuid__arm.c
new file mode 100644
index 00000000000..a3e4a8d8333
--- /dev/null
+++ b/math/openblas/patches/patch-cpuid__arm.c
@@ -0,0 +1,16 @@
+$NetBSD: patch-cpuid__arm.c,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+Add default arm processor type
+
+--- cpuid_arm.c.orig 2016-09-01 03:58:42 UTC
++++ cpuid_arm.c
+@@ -181,7 +181,8 @@ int detect(void)
+ }
+
+ }
+-
++#else
++ return CPU_ARMV6;
+ #endif
+
+ return CPU_UNKNOWN;
diff --git a/math/openblas/patches/patch-cpuid__arm64.c b/math/openblas/patches/patch-cpuid__arm64.c
new file mode 100644
index 00000000000..35ec85dc4a6
--- /dev/null
+++ b/math/openblas/patches/patch-cpuid__arm64.c
@@ -0,0 +1,15 @@
+$NetBSD: patch-cpuid__arm64.c,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+Add default arm processor type
+
+--- cpuid_arm64.c.orig 2016-09-01 03:58:42 UTC
++++ cpuid_arm64.c
+@@ -132,6 +132,8 @@ int detect(void)
+
+
+ }
++#else
++ return CPU_ARMV8;
+ #endif
+
+ return CPU_UNKNOWN;
diff --git a/math/openblas/patches/patch-cpuid_ia64.c b/math/openblas/patches/patch-cpuid_ia64.c
new file mode 100644
index 00000000000..578b8ff7a2e
--- /dev/null
+++ b/math/openblas/patches/patch-cpuid_ia64.c
@@ -0,0 +1,16 @@
+$NetBSD: patch-cpuid_ia64.c,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+FreeBSD does not have sysinfo in base
+
+--- cpuid_ia64.c.orig 2015-10-27 20:44:50 UTC
++++ cpuid_ia64.c
+@@ -38,7 +38,9 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#ifdef linux
+ #include <sys/sysinfo.h>
++#endif
+ #include "cpuid.h"
+
+ #ifdef __ECC
diff --git a/math/openblas/patches/patch-exports+Makefile b/math/openblas/patches/patch-exports+Makefile
new file mode 100644
index 00000000000..27d621e916c
--- /dev/null
+++ b/math/openblas/patches/patch-exports+Makefile
@@ -0,0 +1,22 @@
+$NetBSD: patch-exports+Makefile,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+Improve dynamic lib naming
+
+--- exports/Makefile.orig 2019-08-11 21:23:27.000000000 +0000
++++ exports/Makefile
+@@ -173,6 +173,7 @@ endif
+ #http://stackoverflow.com/questions/7656425/makefile-ifeq-logical-or
+ ifeq ($(OSNAME), $(filter $(OSNAME),FreeBSD OpenBSD NetBSD DragonFly))
+
++EXTRALIB += -lgfortran
+ so : ../$(LIBSONAME)
+
+ ifeq (, $(SYMBOLPREFIX)$(SYMBOLSUFFIX))
+@@ -184,6 +185,7 @@ else
+ endif
+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o ../$(LIBSONAME) \
+ -Wl,--whole-archive $< -Wl,--no-whole-archive \
++ -Wl,-soname,$(LIBPREFIX).so.$(MAJOR_VERSION) \
+ $(FEXTRALIB) $(EXTRALIB)
+ $(CC) $(CFLAGS) $(LDFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) $(FEXTRALIB) && echo OK.
+ rm -f linktest
diff --git a/math/openblas/patches/patch-f_check b/math/openblas/patches/patch-f_check
new file mode 100644
index 00000000000..f78a7bc636e
--- /dev/null
+++ b/math/openblas/patches/patch-f_check
@@ -0,0 +1,24 @@
+$NetBSD: patch-f_check,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+Clean up link flags
+
+--- f_check.orig 2015-10-27 20:44:50 UTC
++++ f_check
+@@ -261,7 +261,7 @@ if ($link ne "") {
+
+ foreach $flags (@flags) {
+ if (
+- ($flags =~ /^\-L/)
++ ($flags =~ /^\-L\S/)
+ && ($flags !~ /^-LIST:/)
+ && ($flags !~ /^-LANG:/)
+ ) {
+@@ -292,7 +292,7 @@ if ($link ne "") {
+ }
+
+ if (
+- ($flags =~ /^\-l/)
++ ($flags =~ /^\-l\S/)
+ && ($flags !~ /gfortranbegin/)
+ && ($flags !~ /frtbegin/)
+ && ($flags !~ /pathfstart/)
diff --git a/math/openblas/patches/patch-getarch.c b/math/openblas/patches/patch-getarch.c
new file mode 100644
index 00000000000..c00e7ce8d44
--- /dev/null
+++ b/math/openblas/patches/patch-getarch.c
@@ -0,0 +1,26 @@
+$NetBSD: patch-getarch.c,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+Do not override our parallel make choice.
+
+--- getarch.c.orig 2018-12-31 23:09:59.000000000 +0100
++++ getarch.c 2019-03-22 17:24:40.477260427 +0100
+@@ -1236,19 +1236,6 @@
+ #endif
+ #endif
+
+-#ifdef MAKE_NB_JOBS
+- #if MAKE_NB_JOBS > 0
+- printf("MAKE += -j %d\n", MAKE_NB_JOBS);
+- #else
+- // Let make use parent -j argument or -j1 if there
+- // is no make parent
+- #endif
+-#elif NO_PARALLEL_MAKE==1
+- printf("MAKE += -j 1\n");
+-#else
+- printf("MAKE += -j %d\n", get_num_cores());
+-#endif
+-
+ break;
+
+ case '1' : /* For config.h */
diff --git a/math/openblas/patches/patch-interface__ztrmv.c b/math/openblas/patches/patch-interface__ztrmv.c
new file mode 100644
index 00000000000..7ee1f487287
--- /dev/null
+++ b/math/openblas/patches/patch-interface__ztrmv.c
@@ -0,0 +1,15 @@
+$NetBSD: patch-interface__ztrmv.c,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+Avoid buffer overflow
+
+--- interface/ztrmv.c.orig 2016-09-01 03:58:42 UTC
++++ interface/ztrmv.c
+@@ -242,7 +242,7 @@ void CNAME(enum CBLAS_ORDER order, enum
+ else
+ #endif
+ {
+- buffer_size = ((n - 1) / DTB_ENTRIES) * 2 * DTB_ENTRIES + 32 / sizeof(FLOAT);
++ buffer_size = (((n - 1) / DTB_ENTRIES) * 2 * DTB_ENTRIES + 32 / sizeof(FLOAT)) + 8;
+ // It seems to be required for some K8 or Barcelona CPU
+ buffer_size += 8;
+ if(incx != 1)
diff --git a/math/openblas/patches/patch-utest_Makefile b/math/openblas/patches/patch-utest_Makefile
new file mode 100644
index 00000000000..0f5c69487b2
--- /dev/null
+++ b/math/openblas/patches/patch-utest_Makefile
@@ -0,0 +1,19 @@
+$NetBSD: patch-utest_Makefile,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+Limit regression tests to working configs
+
+--- utest/Makefile.orig 2020-01-08 19:47:09.730906975 +0000
++++ utest/Makefile
+@@ -16,8 +16,12 @@ OBJS=utest_main.o test_amax.o test_rotmg
+
+ ifneq ($(NO_LAPACK), 1)
+ OBJS += test_potrs.o
++ifneq ($(NO_LAPACKE), 1)
++ifneq ($(NO_CBLAS), 1)
+ OBJS += test_kernel_regress.o
+ endif
++endif
++endif
+
+ #this does not work with OpenMP nor with native Windows or Android threads
+ # FIXME TBD if this works on OSX, SunOS, POWER and zarch
diff --git a/math/openblas/version.mk b/math/openblas/version.mk
new file mode 100644
index 00000000000..996dcb000cf
--- /dev/null
+++ b/math/openblas/version.mk
@@ -0,0 +1,3 @@
+# $NetBSD: version.mk,v 1.1 2020/11/05 16:31:45 bacon Exp $
+
+OPENBLAS_VERSION= 0.3.7