pkgsrc-WIP-changes archive

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

Add openblas: Optimized BLAS library based on GotoBLAS2



Module Name:	pkgsrc-wip
Committed By:	Jason Bacon <bacon4000%gmail.com@localhost>
Pushed By:	outpaddling
Date:		Thu Sep 21 17:22:30 2017 -0500
Changeset:	aa298c5da3e5a811a48da4de442832980fae0367

Modified Files:
	Makefile
Added Files:
	openblas/DESCR
	openblas/Makefile
	openblas/PLIST
	openblas/TODO
	openblas/buildlink3.mk
	openblas/distinfo
	openblas/patches/patch-Makefile
	openblas/patches/patch-Makefile.rule
	openblas/patches/patch-Makefile.system
	openblas/patches/patch-c_check
	openblas/patches/patch-common__arm.h
	openblas/patches/patch-cpuid__arm.c
	openblas/patches/patch-cpuid__arm64.c
	openblas/patches/patch-cpuid_ia64.c
	openblas/patches/patch-cpuid_sparc.c
	openblas/patches/patch-driver_others_memory.c
	openblas/patches/patch-exports+Makefile
	openblas/patches/patch-f_check
	openblas/patches/patch-interface__ztrmv.c

Log Message:
Add openblas: 	Optimized BLAS library based on GotoBLAS2

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=aa298c5da3e5a811a48da4de442832980fae0367

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

diffstat:
 Makefile                                      |   1 +
 openblas/DESCR                                |   6 +
 openblas/Makefile                             | 172 ++++++++++++++++++++++++++
 openblas/PLIST                                |  12 ++
 openblas/TODO                                 |   3 +
 openblas/buildlink3.mk                        |  12 ++
 openblas/distinfo                             |  27 ++++
 openblas/patches/patch-Makefile               |  14 +++
 openblas/patches/patch-Makefile.rule          |  18 +++
 openblas/patches/patch-Makefile.system        |  65 ++++++++++
 openblas/patches/patch-c_check                |  14 +++
 openblas/patches/patch-common__arm.h          |  19 +++
 openblas/patches/patch-cpuid__arm.c           |  15 +++
 openblas/patches/patch-cpuid__arm64.c         |  14 +++
 openblas/patches/patch-cpuid_ia64.c           |  15 +++
 openblas/patches/patch-cpuid_sparc.c          |  13 ++
 openblas/patches/patch-driver_others_memory.c |  16 +++
 openblas/patches/patch-exports+Makefile       |  21 ++++
 openblas/patches/patch-f_check                |  23 ++++
 openblas/patches/patch-interface__ztrmv.c     |  14 +++
 20 files changed, 494 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 81f1dd5caa..6aa4523744 100644
--- a/Makefile
+++ b/Makefile
@@ -2248,6 +2248,7 @@ SUBDIR+=	open21xx
 SUBDIR+=	openaxiom-svn
 SUBDIR+=	openbgpd
 SUBDIR+=	openbgpd-as4byte
+SUBDIR+=	openblas
 SUBDIR+=	openbsc
 SUBDIR+=	openbsd-input-usbtablet
 SUBDIR+=	openca
diff --git a/openblas/DESCR b/openblas/DESCR
new file mode 100644
index 0000000000..ab6c5e9a9c
--- /dev/null
+++ b/openblas/DESCR
@@ -0,0 +1,6 @@
+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.
+NOTE: If you want to specify your CPU microarchitecture manually,
+please use TARGET_CPU_ARCH knob, e.g., "make TARGET_CPU_ARCH=NEHALEM".
+This value is set TARGET build flag.
diff --git a/openblas/Makefile b/openblas/Makefile
new file mode 100644
index 0000000000..7b60cb9942
--- /dev/null
+++ b/openblas/Makefile
@@ -0,0 +1,172 @@
+# $NetBSD$
+#
+###########################################################
+#                  Generated by fbsd2pkg                  #
+#              Thu Sep 21 12:36:18 CDT 2017               #
+###########################################################
+#
+# Build tested on: CentOS 6
+
+DISTNAME=	OpenBLAS-${PORTVERSION}
+PKGNAME=	openblas-${PORTVERSION}
+DIST_SUBDIR=	openblas
+CATEGORIES=	math
+MASTER_SITES=	${MASTER_SITE_GITHUB:=xianyi/} \
+		http://www.netlib.org/lapack/timing/
+DISTFILES=	${DISTNAME}.tar.gz large.tgz timing.tgz
+GITHUB_PROJECT=	OpenBLAS
+GITHUB_TAG=	v${PORTVERSION}
+
+MAINTAINER=	bacon4000%gmail.com@localhost
+HOMEPAGE=	https://github.com/xianyi/OpenBLAS
+COMMENT=	Optimized BLAS library based on GotoBLAS2
+# Check this
+LICENSE=	modified-bsd
+
+# Test and change if necessary.
+# MAKE_JOBS_SAFE=	no
+
+# Just assuming C and C++: Adjust this!
+USE_LANGUAGES=	c c++ fortran
+USE_TOOLS+=	gmake perl:build
+
+PORTVERSION=	0.2.20
+
+LARGE_FILE=	large.tgz
+TIMING_FILE=	timing.tgz
+OPENBLAS_SUFX=	r${PORTVERSION}
+OPENBLAS_LIBS=	libopenblas libopenblasp
+OPENBLAS_SVER=	0
+TEST_TARGET=	tests
+MAXTHREADS?=	8
+
+# No openmp for now
+BUILDFLAGS_THREAD+=	NUM_THREADS=${MAXTHREADS} USE_THREAD=1
+BENCHMARK_THREADS_FLAG=		OPENBLAS_NUM_THREADS=${BENCHMARK_MAXTHREADS}
+
+# CPU-agnostic build for now.  Provide option for CPU-optimized build later.
+BUILDFLAGS+=	DYNAMIC_ARCH=1
+BUILDFLAGS+=	NO_AVX=1
+BUILDFLAGS+=	NO_AVX2=1
+
+.if ${MACHINE_ARCH:M*64} == ""
+BUILDFLAGS+=	BINARY32=1
+.else
+BUILDFLAGS+=	BINARY64=1
+.endif
+
+# Not yet implemented, from FreeBSD port
+#.if ${PORT_OPTIONS:MINTERFACE64}
+#BUILDFLAGS+=	INTERFACE64=1
+#.endif
+#.if ${PORT_OPTIONS:MOPENMP}
+#BUILDFLAGS_THREAD+=	USE_OPENMP=1
+#CFLAGS+=	-fopenmp
+#CXXFLAGS+=	-fopenmp
+#FFLAGS+=	-fopenmp
+#.endif
+#.if ! ${PORT_OPTIONS:MAVX}
+#BUILDFLAGS+=	NO_AVX=1
+#.endif
+#.if ! ${PORT_OPTIONS:MAVX2}
+#BUILDFLAGS+=	NO_AVX2=1
+#.endif
+
+SUBST_CLASSES+=		find
+SUBST_STAGE.find=	post-patch
+SUBST_SED.find+=	-e "s+%%FIND%%+${FIND}+"
+SUBST_SED.find+=	-e "s+%%XARGS%%+${XARGS}+"
+SUBST_SED.find+=	-e "s+%%REINPLACE_CMD%%+${REINPLACE_CMD}+"
+SUBST_FILES.find+=	${WRKSRC}/Makefile
+
+SUBST_CLASSES+=		compiler
+SUBST_STAGE.compiler=	post-patch
+SUBST_SED.compiler+=	-e "s+%%FC%%+${FC}+"
+SUBST_SED.compiler+=	-e "s+%%CC%%+${CC}+"
+SUBST_FILES.compiler+=	${WRKSRC}/Makefile.rule
+
+SUBST_CLASSES+=		arch
+SUBST_STAGE.arch=	post-patch
+SUBST_SED.arch+=	-e "s+(ARCH)+(ARCH_)+"
+SUBST_FILES.arch+=	${WRKSRC}/Makefile.rule
+SUBST_FILES.arch+=	${WRKSRC}/Makefile.tail
+SUBST_FILES.arch+=	${WRKSRC}/driver/level3/Makefile
+SUBST_FILES.arch+=	${WRKSRC}/driver/others/Makefile
+SUBST_FILES.arch+=	${WRKSRC}/exports/Makefile
+SUBST_FILES.arch+=	${WRKSRC}/interface/Makefile
+SUBST_FILES.arch+=	${WRKSRC}/kernel/Makefile
+SUBST_FILES.arch+=	${WRKSRC}/kernel/Makefile.L3
+SUBST_FILES.arch+=	${WRKSRC}/lapack/laswp/Makefile
+SUBST_FILES.arch+=	${WRKSRC}/lapack-netlib/SRC/Makefile
+SUBST_FILES.arch+=	${WRKSRC}/lapack-netlib/SRC/VARIANTS/Makefile
+SUBST_FILES.arch+=	${WRKSRC}/lapack-netlib/TESTING/MATGEN/Makefile
+SUBST_FILES.arch+=	${WRKSRC}/lapack-netlib/LAPACKE/src/Makefile
+SUBST_FILES.arch+=	${WRKSRC}/lapack-netlib/LAPACKE/utils/Makefile
+SUBST_FILES.arch+=	${WRKSRC}/reference/Makefile
+
+SUBST_CLASSES+=		system
+SUBST_STAGE.system=	post-patch
+SUBST_SED.system+=	-e "s+(ARCH)+(ARCH_)+"
+SUBST_SED.system+=	-e 's+%%LDFLAGS%%+${LDFLAGS}+'
+SUBST_SED.system+=	-e 's+%%LOCALBASE%%+${PREFIX}+'
+SUBST_SED.system+=	-e 's+%%FIND%%+${FIND}+'
+SUBST_SED.system+=	-e 's+%%XARGS%%+${XARGS}+'
+SUBST_SED.system+=	-e 's+%%REINPLACE_CMD%%+${REINPLACE_CMD}+'
+SUBST_SED.system+=	-e 's+$${CROSS_SUFFIX}+${PREFIX}/bin/+'
+SUBST_SED.system+=	-e '/Clang.*OpenMP/g'
+SUBST_FILES.system+=	${WRKSRC}/Makefile.system
+
+SUBST_CLASSES+=		threads
+SUBST_STAGE.threads=	post-patch
+SUBST_SED.threads+=	-e "s+OPENBLAS_NUM_THREADS+OMP_NUM_THREADS+g"
+SUBST_FILES.threads+=	${WRKSRC}/test/Makefile
+SUBST_FILES.threads+=	${WRKSRC}/ctest/Makefile
+
+# Sets OPSYS, OS_VERSION, MACHINE_ARCH, etc..
+# .include "../../mk/bsd.prefs.mk"
+
+# Keep this if there are user-selectable options.
+# .include "options.mk"
+
+# Specify which directories to create before install.
+# You should only need this if using your own install target.
+INSTALLATION_DIRS=	bin include lib ${PKGMANDIR}/man1 share/doc share/examples
+
+post-extract:
+	cd ${DISTDIR}/${DIST_SUBDIR} ; \
+		${CP} ${LARGE_FILE} ${TIMING_FILE} ${WRKSRC}
+	${MKDIR} ${WRKDIR}/lib
+
+do-build:
+	cd ${WRKSRC} ; ${SETENV} ${BUILDFLAGS} NUM_THREADS=1 USE_THREAD=0 \
+		${MAKE_PROGRAM} ${MAKE_ARGS}
+	${CP} ${WRKSRC}/libopenblas-${OPENBLAS_SUFX}.a ${WRKDIR}/lib/libopenblas.a
+	${CP} ${WRKSRC}/libopenblas-${OPENBLAS_SUFX}.so ${WRKDIR}/lib/libopenblas.so.${OPENBLAS_SVER}
+	cd ${WRKSRC} ; ${MAKE_PROGRAM} ${MAKE_ARGS} clean
+	cd ${WRKSRC} ; ${SETENV} ${BUILDFLAGS} ${BUILDFLAGS_THREAD} \
+	${MAKE_PROGRAM} ${MAKE_ARGS}
+	${CP} ${WRKSRC}/libopenblasp-${OPENBLAS_SUFX}.a ${WRKDIR}/lib/libopenblasp.a
+	${CP} ${WRKSRC}/libopenblasp-${OPENBLAS_SUFX}.so ${WRKDIR}/lib/libopenblasp.so.${OPENBLAS_SVER}
+
+BENCHMARK_MAXTHREADS?=	${MAXTHREADS}
+#.if ${PORT_OPTIONS:MOPENMP}
+#BENCHMARK_THREADS_FLAG=		OMP_NUM_THREADS=${BENCHMARK_MAXTHREADS}
+#.else
+#BENCHMARK_THREADS_FLAG=		OPENBLAS_NUM_THREADS=${BENCHMARK_MAXTHREADS}
+#.endif
+
+.PHONY: benchmark
+benchmark: build
+	cd ${WRKSRC} ; ${SETENV} ${BUILDFLAGS} NUM_THREADS=${MAXTHREADS} \
+	USE_THREAD=1 ${MAKE_PROGRAM} ${MAKE_ARGS} hpl
+	cd ${WRKSRC}/benchmark ; ${SETENV} ${BUILDFLAGS} NUM_THREADS=${MAXTHREADS} \
+	USE_THREAD=1 ${BENCHMARK_THREADS_FLAG} ${MAKE_PROGRAM} ${MAKE_ARGS}
+
+do-install:
+.for l in ${OPENBLAS_LIBS}
+	${INSTALL_DATA} ${WRKDIR}/lib/${l}.a ${DESTDIR}${PREFIX}/lib
+	${INSTALL_LIB} ${WRKDIR}/lib/${l}.so.${OPENBLAS_SVER} ${DESTDIR}${PREFIX}/lib
+	${LN} -sf ${l}.so.${OPENBLAS_SVER} ${DESTDIR}${PREFIX}/lib/${l}.so
+.endfor
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/openblas/PLIST b/openblas/PLIST
new file mode 100644
index 0000000000..7afd687f5f
--- /dev/null
+++ b/openblas/PLIST
@@ -0,0 +1,12 @@
+@comment $NetBSD$
+lib/libopenblas.a
+lib/libopenblas.so
+lib/libopenblas.so.0
+lib/libopenblasp.a
+lib/libopenblasp.so
+lib/libopenblasp.so.0
+@pkgdir share/examples
+@pkgdir share/doc
+@pkgdir man/man1
+@pkgdir include
+@pkgdir bin
diff --git a/openblas/TODO b/openblas/TODO
new file mode 100644
index 0000000000..4c5916b2e3
--- /dev/null
+++ b/openblas/TODO
@@ -0,0 +1,3 @@
+Implement INTERFACE64, OPENMP options
+Disable DYNAMIC_ARCH if not package-building
+Implement AVX, AVX2 for x86
diff --git a/openblas/buildlink3.mk b/openblas/buildlink3.mk
new file mode 100644
index 0000000000..1b3c5bb6c4
--- /dev/null
+++ b/openblas/buildlink3.mk
@@ -0,0 +1,12 @@
+# $NetBSD$
+
+BUILDLINK_TREE+=	openblas
+
+.if !defined(OPENBLAS_BUILDLINK3_MK)
+OPENBLAS_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.openblas+=	openblas>=0.2.20
+BUILDLINK_PKGSRCDIR.openblas?=	../../wip/openblas
+.endif	# OPENBLAS_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-openblas
diff --git a/openblas/distinfo b/openblas/distinfo
new file mode 100644
index 0000000000..6a9ce83b2e
--- /dev/null
+++ b/openblas/distinfo
@@ -0,0 +1,27 @@
+$NetBSD$
+
+SHA1 (openblas/OpenBLAS-0.2.20.tar.gz) = a186074145a24823e82c65672dad1cd1ca6fe89c
+RMD160 (openblas/OpenBLAS-0.2.20.tar.gz) = 2b9728cd227894d7378b0f3686b90d0e7e7975d9
+SHA512 (openblas/OpenBLAS-0.2.20.tar.gz) = 8dfc8e8c8d456b834d2e9544c8eadd9f4770e30db8b8dd76af601ec0735fd86c9cf63dd6a03ccd23fc02ec2e05069a09875b9073dfe29f99aadab3a958ae2634
+Size (openblas/OpenBLAS-0.2.20.tar.gz) = 11637301 bytes
+SHA1 (openblas/large.tgz) = a689e5b180595b40c5719b0f358b31b15b57a2db
+RMD160 (openblas/large.tgz) = 8010ff4002ef42cf22a9ee9345011d68fc27d855
+SHA512 (openblas/large.tgz) = e24db2b8a4253ccff9ca196815901c1fefd55e882f4fe1085715ac84b8f318e1842a91072130c17fdd144344ffc80233a77500da9349acb54e504b3935825965
+Size (openblas/large.tgz) = 2595 bytes
+SHA1 (openblas/timing.tgz) = fd47fc3f26d142a791df51e4a422a49662507252
+RMD160 (openblas/timing.tgz) = f0fe220e7ab611d4db8d8cab960361955e2ab093
+SHA512 (openblas/timing.tgz) = be0abfcfffdf0e118ed7e25a8451639833cf0ad6bb04d101bbe194c16f656b6ce509b2f76acf4ad626d1fb5b126bd5498cfea262f2946c2d077751112a2906af
+Size (openblas/timing.tgz) = 1059485 bytes
+SHA1 (patch-Makefile) = 421b8e8d322edc7801e8cc9b0ccf57644018ccde
+SHA1 (patch-Makefile.rule) = 72108fa4d1e8279f78c01606d21b9149947afdaa
+SHA1 (patch-Makefile.system) = eb5bfb5a2f5308ad6ac6f4d7e4b0c2eeaa049200
+SHA1 (patch-c_check) = 32af951c38db716e3ec81b8c7d4c985368561b8e
+SHA1 (patch-common__arm.h) = 1cc14adb8441d3282d57f1b44d69251f86f51392
+SHA1 (patch-cpuid__arm.c) = b1890daa38f15ad122b3f151563836349c00e9b3
+SHA1 (patch-cpuid__arm64.c) = eb2f5cb73f365c5cdc35c6dd2f3244e5082e26a0
+SHA1 (patch-cpuid_ia64.c) = f33294230098a7fb1ef49dd1557b2a07ed11a3a9
+SHA1 (patch-cpuid_sparc.c) = 709647898b963b6afaa7ab91147dc9f261e3da02
+SHA1 (patch-driver_others_memory.c) = 76d7ef5cfcf2a322182ed454a7416a8323329417
+SHA1 (patch-exports+Makefile) = 2429badefe7f379739c41ae142da0cffd41f46cf
+SHA1 (patch-f_check) = 11751e7e779790a47f80f825555bb24d072d0f30
+SHA1 (patch-interface__ztrmv.c) = fefab5887bfc735fb5050df051f39b03201cee2c
diff --git a/openblas/patches/patch-Makefile b/openblas/patches/patch-Makefile
new file mode 100644
index 0000000000..3087d7e117
--- /dev/null
+++ b/openblas/patches/patch-Makefile
@@ -0,0 +1,14 @@
+$NetBSD$
+
+# Avoid name collision on ARCH
+--- Makefile.orig	2015-10-27 20:44:50 UTC
++++ Makefile
+@@ -238,7 +238,7 @@ ifndef NOFORTRAN
+ 	-@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 "ARCH        = $(AR)" >> $(NETLIB_LAPACK_DIR)/make.inc
++	-@echo "ARCH_       = $(AR)" >> $(NETLIB_LAPACK_DIR)/make.inc
+ 	-@echo "ARCHFLAGS   = -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/openblas/patches/patch-Makefile.rule b/openblas/patches/patch-Makefile.rule
new file mode 100644
index 0000000000..d2a24961a1
--- /dev/null
+++ b/openblas/patches/patch-Makefile.rule
@@ -0,0 +1,18 @@
+$NetBSD$
+
+# Respect env
+--- Makefile.rule.orig	2015-10-27 20:44:50 UTC
++++ Makefile.rule
+@@ -19,10 +19,10 @@ VERSION = 0.2.15
+ 
+ # C compiler including binary type(32bit / 64bit). Default is gcc.
+ # Don't use Intel Compiler or PGI, it won't generate right codes as I expect.
+-# CC = gcc
++CC = %%CC%%
+ 
+ # Fortran compiler. Default is g77.
+-# FC = gfortran
++FC = %%FC%%
+ 
+ # Even you can specify cross compiler. Meanwhile, please set HOSTCC.
+ 
diff --git a/openblas/patches/patch-Makefile.system b/openblas/patches/patch-Makefile.system
new file mode 100644
index 0000000000..7bc8d6339f
--- /dev/null
+++ b/openblas/patches/patch-Makefile.system
@@ -0,0 +1,65 @@
+$NetBSD$
+
+# Allow serial and parallel libs to coexist
+--- Makefile.system.orig	2015-10-27 20:44:50 UTC
++++ Makefile.system
+@@ -218,6 +218,7 @@ MD5SUM = md5 -r
+ endif
+ 
+ ifeq ($(OSNAME), FreeBSD)
++EXTRALIB	+= -lm %%LDFLAGS%%
+ MD5SUM = md5 -r
+ endif
+ 
+@@ -889,9 +890,17 @@ SYMBOLSUFFIX =
+ endif
+ 
+ ifndef LIBNAMESUFFIX
++ifndef SMP
+ LIBPREFIX = lib$(SYMBOLPREFIX)openblas$(SYMBOLSUFFIX)
+ else
++LIBPREFIX = lib$(SYMBOLPREFIX)openblasp$(SYMBOLSUFFIX)
++endif
++else
++ifndef SMP
+ LIBPREFIX = lib$(SYMBOLPREFIX)openblas$(SYMBOLSUFFIX)_$(LIBNAMESUFFIX)
++else
++LIBPREFIX = lib$(SYMBOLPREFIX)openblasp$(SYMBOLSUFFIX)_$(LIBNAMESUFFIX)
++endif
+ endif
+ 
+ KERNELDIR	= $(TOPDIR)/kernel/$(ARCH)
+@@ -1020,24 +1029,8 @@ 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
+-
+ 
+ LIBDLLNAME   = $(LIBPREFIX).dll
+ LIBSONAME    = $(LIBNAME:.$(LIBSUFFIX)=.so)
+@@ -1067,7 +1060,7 @@ LIB_COMPONENTS = CBLAS
+ endif
+ 
+ export OSNAME
+-export ARCH
++export ARCH_
+ export CORE
+ export LIBCORE
+ export PGCPATH
diff --git a/openblas/patches/patch-c_check b/openblas/patches/patch-c_check
new file mode 100644
index 0000000000..8993dcb9e9
--- /dev/null
+++ b/openblas/patches/patch-c_check
@@ -0,0 +1,14 @@
+$NetBSD$
+
+# 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/openblas/patches/patch-common__arm.h b/openblas/patches/patch-common__arm.h
new file mode 100644
index 0000000000..a8c49440be
--- /dev/null
+++ b/openblas/patches/patch-common__arm.h
@@ -0,0 +1,19 @@
+$NetBSD$
+
+# 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/openblas/patches/patch-cpuid__arm.c b/openblas/patches/patch-cpuid__arm.c
new file mode 100644
index 0000000000..4d6d357e14
--- /dev/null
+++ b/openblas/patches/patch-cpuid__arm.c
@@ -0,0 +1,15 @@
+$NetBSD$
+
+# 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/openblas/patches/patch-cpuid__arm64.c b/openblas/patches/patch-cpuid__arm64.c
new file mode 100644
index 0000000000..bcbd67c8ba
--- /dev/null
+++ b/openblas/patches/patch-cpuid__arm64.c
@@ -0,0 +1,14 @@
+$NetBSD$
+
+# 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/openblas/patches/patch-cpuid_ia64.c b/openblas/patches/patch-cpuid_ia64.c
new file mode 100644
index 0000000000..c6d9fbd685
--- /dev/null
+++ b/openblas/patches/patch-cpuid_ia64.c
@@ -0,0 +1,15 @@
+$NetBSD$
+
+# 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/openblas/patches/patch-cpuid_sparc.c b/openblas/patches/patch-cpuid_sparc.c
new file mode 100644
index 0000000000..bc6f502590
--- /dev/null
+++ b/openblas/patches/patch-cpuid_sparc.c
@@ -0,0 +1,13 @@
+$NetBSD$
+
+# Add sparc support
+--- cpuid_sparc.c.orig	2015-10-27 20:44:50 UTC
++++ cpuid_sparc.c
+@@ -49,6 +49,7 @@ void get_subdirname(void){
+ }
+ 
+ void get_cpuconfig(void){
++  printf("#define SPARC\n");
+   printf("#define V9\n");
+   printf("#define DTB_DEFAULT_ENTRIES 32\n");
+ }
diff --git a/openblas/patches/patch-driver_others_memory.c b/openblas/patches/patch-driver_others_memory.c
new file mode 100644
index 0000000000..f77bbc85f5
--- /dev/null
+++ b/openblas/patches/patch-driver_others_memory.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+# Check for old GCC
+Passing a priority level to constructor/destructor only works on GCC >= 4.3.0;
+improve the upstream check so that the build works with base GCC.
+--- driver/others/memory.c.orig	2016-04-12 19:29:19 UTC
++++ driver/others/memory.c
+@@ -144,7 +144,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ #if defined(_MSC_VER) && !defined(__clang__)
+ #define CONSTRUCTOR __cdecl
+ #define DESTRUCTOR __cdecl
+-#elif (defined(OS_DARWIN) || defined(OS_SUNOS)) && defined(C_GCC)
++#elif (defined(OS_DARWIN) || defined(OS_SUNOS)) || (defined(C_GCC) && ((__GNUC__ == 4) && (__GNUC_MINOR__ < 3)))
+ #define CONSTRUCTOR	__attribute__ ((constructor))
+ #define DESTRUCTOR	__attribute__ ((destructor))
+ #else
diff --git a/openblas/patches/patch-exports+Makefile b/openblas/patches/patch-exports+Makefile
new file mode 100644
index 0000000000..4299ac8e07
--- /dev/null
+++ b/openblas/patches/patch-exports+Makefile
@@ -0,0 +1,21 @@
+$NetBSD$
+
+# Improve dynamic lib naming
+--- exports/Makefile.orig	2015-10-27 20:44:50 UTC
++++ exports/Makefile
+@@ -140,6 +140,7 @@ endif
+ #http://stackoverflow.com/questions/7656425/makefile-ifeq-logical-or
+ ifeq ($(OSNAME), $(filter $(OSNAME),FreeBSD NetBSD))
+ 
++EXTRALIB += -lgfortran
+ so : ../$(LIBSONAME)
+ 
+ ifeq (, $(SYMBOLPREFIX)$(SYMBOLSUFFIX))
+@@ -151,6 +152,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/openblas/patches/patch-f_check b/openblas/patches/patch-f_check
new file mode 100644
index 0000000000..120f7179f5
--- /dev/null
+++ b/openblas/patches/patch-f_check
@@ -0,0 +1,23 @@
+$NetBSD$
+
+# 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/openblas/patches/patch-interface__ztrmv.c b/openblas/patches/patch-interface__ztrmv.c
new file mode 100644
index 0000000000..06e02caa9e
--- /dev/null
+++ b/openblas/patches/patch-interface__ztrmv.c
@@ -0,0 +1,14 @@
+$NetBSD$
+
+# 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)


Home | Main Index | Thread Index | Old Index