pkgsrc-WIP-changes archive

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

openblas: first go at the definite OpenBLAS package



Module Name:	pkgsrc-wip
Committed By:	Dr. Thomas Orgis <thomas.orgis%uni-hamburg.de@localhost>
Pushed By:	thor
Date:		Thu Mar 29 23:45:12 2018 +0200
Changeset:	7c731e82ee1e5030c80c800707ed7045d99b1f3f

Added Files:
	openblas/DESCR
	openblas/Makefile
	openblas/Makefile.common
	openblas/PLIST
	openblas/TODO
	openblas/buildlink3.mk
	openblas/distinfo
	openblas/options.mk
	openblas/patches/patch-Makefile
	openblas/patches/patch-Makefile.install
	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-getarch.c
	openblas/patches/patch-interface__ztrmv.c
	openblas_openmp/DESCR
	openblas_openmp/Makefile
	openblas_openmp/buildlink3.mk
	openblas_pthread/DESCR
	openblas_pthread/Makefile
	openblas_pthread/buildlink3.mk

Log Message:
openblas: first go at the definite OpenBLAS package

This merges our earlier approaches in wip/OpenBLAS and wip/openblas-devel.
We get multiple variants of the library via separate packages that
use a Makefile.common.

Next step: Fix up wip/cblas to work again and correctly link to
differing BLAS. My old installs of wip/OpenBLAS provide cblas
directly. The new openblas only provides BLAS and LAPACK.

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

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

diffstat:
 openblas/DESCR                                |   5 +
 openblas/Makefile                             |   4 +
 openblas/Makefile.common                      | 160 ++++++++++++++++++++++++++
 openblas/PLIST                                |   9 ++
 openblas/TODO                                 |   3 +
 openblas/buildlink3.mk                        |  12 ++
 openblas/distinfo                             |  29 +++++
 openblas/options.mk                           |  19 +++
 openblas/patches/patch-Makefile               |  71 ++++++++++++
 openblas/patches/patch-Makefile.install       |  24 ++++
 openblas/patches/patch-Makefile.rule          |  18 +++
 openblas/patches/patch-Makefile.system        |  55 +++++++++
 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-getarch.c              |  27 +++++
 openblas/patches/patch-interface__ztrmv.c     |  14 +++
 openblas_openmp/DESCR                         |   5 +
 openblas_openmp/Makefile                      |   4 +
 openblas_openmp/buildlink3.mk                 |  12 ++
 openblas_pthread/DESCR                        |   5 +
 openblas_pthread/Makefile                     |   4 +
 openblas_pthread/buildlink3.mk                |  12 ++
 29 files changed, 642 insertions(+)

diffs:
diff --git a/openblas/DESCR b/openblas/DESCR
new file mode 100644
index 0000000000..5f86d758e4
--- /dev/null
+++ b/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/openblas/Makefile b/openblas/Makefile
new file mode 100644
index 0000000000..0736b72a99
--- /dev/null
+++ b/openblas/Makefile
@@ -0,0 +1,4 @@
+# $NetBSD$
+
+OPENBLAS_VARIANT = openblas
+.include "../openblas/Makefile.common"
diff --git a/openblas/Makefile.common b/openblas/Makefile.common
new file mode 100644
index 0000000000..c83b099387
--- /dev/null
+++ b/openblas/Makefile.common
@@ -0,0 +1,160 @@
+# $NetBSD$
+#
+# This is the common Makefile for OpenBLAS builds. It depends on
+# OPENBLAS_VARIANT = (openblas|openblas_pthread|openblas_openmp)
+# being set.
+
+PORTVERSION=	0.2.20
+DISTNAME=	OpenBLAS-${PORTVERSION}
+PKGNAME=	${OPENBLAS_VARIANT}-${PORTVERSION}
+# ThOr: I do not like that. Can we rather rename the benchmark files
+# to be unique?
+DIST_SUBDIR=	openblas
+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${PORTVERSION}
+
+DISTINFO_FILE=	${.CURDIR}/../../wip/openblas/distinfo
+PATCHDIR=	${.CURDIR}/../../wip/openblas/patches
+PLIST_SRC=	${.CURDIR}/../../wip/openblas/PLIST
+PLIST_SUBST+=	OPENBLAS_VARIANT=${OPENBLAS_VARIANT}        
+
+# NetBSD: Cannot find -lssp*
+PKGSRC_USE_SSP=	no
+
+MAINTAINER=	thomas.orgis%uni-hamburg.de@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
+
+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}
+
+# You may override the autodetected thread count limit.
+# Default is detected from build host.
+BUILD_DEFS+=    OPENBLAS_THREAD_LIMIT
+
+# Default checks number of cores of build host.
+# Do we want a pkgsrc-wide default?
+.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
+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+=		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
+
+# Fix up pkgconfig file installation.
+SUBST_CLASSES+=		pc
+SUBST_STAGE.pc=	post-patch
+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
+
+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 "options.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/openblas/PLIST b/openblas/PLIST
new file mode 100644
index 0000000000..7c08aaaf3e
--- /dev/null
+++ b/openblas/PLIST
@@ -0,0 +1,9 @@
+@comment $NetBSD$
+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/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..6e4679d997
--- /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..03946a073c
--- /dev/null
+++ b/openblas/distinfo
@@ -0,0 +1,29 @@
+$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) = d533eab4e8cdbe465e4051208b388015ebc16115
+SHA1 (patch-Makefile.install) = 8461553ff8a89e482928f379e639c9bc0d9e061a
+SHA1 (patch-Makefile.rule) = 72108fa4d1e8279f78c01606d21b9149947afdaa
+SHA1 (patch-Makefile.system) = c4a8ba678b95bff90c50fbb3d4bf6eba61eaebfd
+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-getarch.c) = e9c56fcaf243def96f9fc8728ff65108e81fd977
+SHA1 (patch-interface__ztrmv.c) = fefab5887bfc735fb5050df051f39b03201cee2c
diff --git a/openblas/options.mk b/openblas/options.mk
new file mode 100644
index 0000000000..8bf386f14a
--- /dev/null
+++ b/openblas/options.mk
@@ -0,0 +1,19 @@
+PKG_OPTIONS_VAR=		PKG_OPTIONS.openblas
+# Choose dynamic target/processor choice at runtime or
+# fixed build with build host CPU.
+PKG_OPTIONS_GROUP.target=	dynamic fixed
+PKG_OPTIONS_REQUIRED_GROUPS=	target
+PKG_SUGGESTED_OPTIONS=		dynamic
+
+.include "../../mk/bsd.prefs.mk"
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mdynamic)
+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, wich
+# changes the API!
diff --git a/openblas/patches/patch-Makefile b/openblas/patches/patch-Makefile
new file mode 100644
index 0000000000..07c188d8b1
--- /dev/null
+++ b/openblas/patches/patch-Makefile
@@ -0,0 +1,71 @@
+$NetBSD$
+
+# Avoid name collision on ARCH
+# Also remove special library names.
+--- Makefile.orig	2015-10-27 20:44:50 UTC
++++ Makefile
+@@ -89,7 +89,6 @@
+ ifeq ($(OSNAME), $(filter $(OSNAME),Linux SunOS Android))
+ 	@$(MAKE) -C exports so
+ 	@ln -fs $(LIBSONAME) $(LIBPREFIX).so
+-	@ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION)
+ endif
+ ifeq ($(OSNAME), FreeBSD)
+ 	@$(MAKE) -C exports so
+@@ -101,7 +100,6 @@
+ endif
+ ifeq ($(OSNAME), Darwin)
+ 	@$(MAKE) -C exports dyn
+-	@ln -fs $(LIBDYNNAME) $(LIBPREFIX).dylib
+ endif
+ ifeq ($(OSNAME), WINNT)
+ 	@$(MAKE) -C exports dll
+@@ -135,7 +133,6 @@
+ 	$(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 ; \
+@@ -166,7 +163,6 @@
+ 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 ; \
+@@ -177,7 +173,6 @@
+ endif
+ 
+ blas :
+-	ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
+ 	for d in $(BLASDIRS) ; \
+ 	do if test -d $$d; then \
+ 	  $(MAKE) -C $$d libs || exit 1 ; \
+@@ -185,7 +180,6 @@
+ 	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 ; \
+@@ -199,7 +193,6 @@
+ 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 ; \
+@@ -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.install b/openblas/patches/patch-Makefile.install
new file mode 100644
index 0000000000..2e0e58b41c
--- /dev/null
+++ b/openblas/patches/patch-Makefile.install
@@ -0,0 +1,24 @@
+@NetBSD@
+
+Second part of removing the special library names.
+--- Makefile.install.orig	2018-03-29 21:56:08.931407291 +0200
++++ Makefile.install	2018-03-29 21:59:19.864394270 +0200
+@@ -60,8 +60,6 @@
+ ifndef NO_STATIC
+ 	@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
+ ifndef NO_SHARED
+@@ -69,8 +67,7 @@
+ ifeq ($(OSNAME), $(filter $(OSNAME),Linux SunOS Android))
+ 	@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), FreeBSD)
+ 	@cp $(LIBSONAME) "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)"
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..fbccf89959
--- /dev/null
+++ b/openblas/patches/patch-Makefile.system
@@ -0,0 +1,55 @@
+$NetBSD$
+
+Fully control the library name via LIBNAMESUFFIX
+And the ARCH_ thing.
+--- Makefile.system.orig	
+2017-07-24 06:03:35.000000000 +0200
++++ Makefile.system	2018-03-29 23:01:57.894137990 +0200
+@@ -230,6 +230,7 @@
+ endif
+ 
+ ifeq ($(OSNAME), FreeBSD)
++EXTRALIB	+= -lm %%LDFLAGS%%
+ MD5SUM = md5 -r
+ endif
+ 
+@@ -1089,27 +1090,11 @@
+ 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
+-LIBSONAME    = $(LIBNAME:.$(LIBSUFFIX)=.so)
++LIBSONAME    = $(LIBNAME:.$(LIBSUFFIX)=.so).$(MAJOR_VERSION)
+ LIBDYNNAME   = $(LIBNAME:.$(LIBSUFFIX)=.dylib)
+ LIBDEFNAME   = $(LIBNAME:.$(LIBSUFFIX)=.def)
+ LIBEXPNAME   = $(LIBNAME:.$(LIBSUFFIX)=.exp)
+@@ -1139,7 +1124,7 @@
+ 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-getarch.c b/openblas/patches/patch-getarch.c
new file mode 100644
index 0000000000..875bce4275
--- /dev/null
+++ b/openblas/patches/patch-getarch.c
@@ -0,0 +1,27 @@
+@NetBSD@
+
+Do not override our parallel make choice.
+--- getarch.c.orig	2018-04-03 12:56:19.322128443 +0200
++++ getarch.c	2018-04-03 12:57:42.424122776 +0200
+@@ -1134,21 +1134,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
+-#ifndef OS_WINDOWS
+-    printf("MAKE += -j %d\n", get_num_cores());
+-#endif
+-#endif
+-
+     break;
+ 
+   case '1' : /* For config.h */
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)
diff --git a/openblas_openmp/DESCR b/openblas_openmp/DESCR
new file mode 100644
index 0000000000..a9b009e75e
--- /dev/null
+++ b/openblas_openmp/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 parallel library using OpenMP.
diff --git a/openblas_openmp/Makefile b/openblas_openmp/Makefile
new file mode 100644
index 0000000000..43c6aab4b8
--- /dev/null
+++ b/openblas_openmp/Makefile
@@ -0,0 +1,4 @@
+# $NetBSD$
+
+OPENBLAS_VARIANT = openblas_openmp
+.include "../openblas/Makefile.common"
diff --git a/openblas_openmp/buildlink3.mk b/openblas_openmp/buildlink3.mk
new file mode 100644
index 0000000000..8894717bde
--- /dev/null
+++ b/openblas_openmp/buildlink3.mk
@@ -0,0 +1,12 @@
+# $NetBSD$
+
+BUILDLINK_TREE+=	openblas_openmp
+
+.if !defined(OPENBLAS_OPENMP_BUILDLINK3_MK)
+OPENBLAS_OPENMP_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.openblas_openmp+=	openblas_openmp>=0.2.20
+BUILDLINK_PKGSRCDIR.openblas_openmp?=		../../wip/openblas_openmp
+.endif	# OPENBLAS_OPENMP_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-openblas_openmp
diff --git a/openblas_pthread/DESCR b/openblas_pthread/DESCR
new file mode 100644
index 0000000000..7382cc614a
--- /dev/null
+++ b/openblas_pthread/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 parallel library using pthreads.
diff --git a/openblas_pthread/Makefile b/openblas_pthread/Makefile
new file mode 100644
index 0000000000..78b362a980
--- /dev/null
+++ b/openblas_pthread/Makefile
@@ -0,0 +1,4 @@
+# $NetBSD$
+
+OPENBLAS_VARIANT = openblas_pthread
+.include "../openblas/Makefile.common"
diff --git a/openblas_pthread/buildlink3.mk b/openblas_pthread/buildlink3.mk
new file mode 100644
index 0000000000..6c449a731e
--- /dev/null
+++ b/openblas_pthread/buildlink3.mk
@@ -0,0 +1,12 @@
+# $NetBSD$
+
+BUILDLINK_TREE+=	openblas_pthread
+
+.if !defined(OPENBLAS_PTHREAD_BUILDLINK3_MK)
+OPENBLAS_PTHREAD_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.openblas_pthread+=	openblas_pthread>=0.2.20
+BUILDLINK_PKGSRCDIR.openblas_pthread?=		../../wip/openblas_pthread
+.endif	# OPENBLAS_PTHREAD_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-openblas_pthread


Home | Main Index | Thread Index | Old Index