diff options
author | Mo Zhou <cdluminate@gmail.com> | 2019-07-06 05:05:54 +0000 |
---|---|---|
committer | Benda Xu <heroxbd@gentoo.org> | 2019-07-06 23:47:42 +0800 |
commit | 62f95abf6b504a047c22500f5e95364ddc594010 (patch) | |
tree | 2f92133c545dd2d451d94667a9c079adee5019ba /sci-libs/openblas | |
parent | profiles: Remove obsolete package.mask entries for lxde packages. (diff) | |
download | gentoo-62f95abf6b504a047c22500f5e95364ddc594010.tar.gz gentoo-62f95abf6b504a047c22500f5e95364ddc594010.tar.bz2 gentoo-62f95abf6b504a047c22500f5e95364ddc594010.zip |
sci-libs/openblas: new package with eselect-ldso feature integrated.
Closes: https://bugs.gentoo.org/584534
Closes: https://bugs.gentoo.org/658034
Closes: https://github.com/gentoo/gentoo/pull/12357
Signed-off-by: Mo Zhou <cdluminate@gmail.com>
Signed-off-by: Benda Xu <heroxbd@gentoo.org>
Diffstat (limited to 'sci-libs/openblas')
-rw-r--r-- | sci-libs/openblas/Manifest | 1 | ||||
-rw-r--r-- | sci-libs/openblas/files/shared-blas-lapack.patch | 137 | ||||
-rw-r--r-- | sci-libs/openblas/metadata.xml | 20 | ||||
-rw-r--r-- | sci-libs/openblas/openblas-0.3.5.ebuild | 85 |
4 files changed, 243 insertions, 0 deletions
diff --git a/sci-libs/openblas/Manifest b/sci-libs/openblas/Manifest new file mode 100644 index 000000000000..8ebcf20cda70 --- /dev/null +++ b/sci-libs/openblas/Manifest @@ -0,0 +1 @@ +DIST openblas-0.3.5.tar.gz 11853101 BLAKE2B a9b249bc397fcb1d80401d1c60c6985803016e4fd0908649fe6386ae84a09a53569814b3af65fd8fbfa92f2cdd5d4af313ba91a80f7daa7e481a7941cbb9af2c SHA512 15520c3eca79b002f1afbee64257afa24705dec667a89bd46acfcdae426e29342816fb586db98ff256fcc9d0fd744b14b347fed23995958e7646a5e3e7310cf4 diff --git a/sci-libs/openblas/files/shared-blas-lapack.patch b/sci-libs/openblas/files/shared-blas-lapack.patch new file mode 100644 index 000000000000..fc77427362c1 --- /dev/null +++ b/sci-libs/openblas/files/shared-blas-lapack.patch @@ -0,0 +1,137 @@ +diff --git a/sci-libs/openblas/files/Makefile b/sci-libs/openblas/files/Makefile +index 20ec74e..87e842f 100644 +--- a/interface/Makefile ++++ b/interface/Makefile +@@ -2151,3 +2151,132 @@ cblas_zgeadd.$(SUFFIX) cblas_zgeadd.$(PSUFFIX) : zgeadd.c + + cblas_xerbla.$(SUFFIX) cblas_xerbla.$(PSUFFIX) : xerbla.c + $(CC) -c $(CFLAGS) -DCBLAS $< -o $(@F) ++ ++############################################################################# ++# Customized shared objects ++ ++FSBLAS1OBJS = \ ++ saxpy.$(SUFFIX) sswap.$(SUFFIX) \ ++ scopy.$(SUFFIX) sscal.$(SUFFIX) \ ++ sdot.$(SUFFIX) sdsdot.$(SUFFIX) dsdot.$(SUFFIX) \ ++ sasum.$(SUFFIX) snrm2.$(SUFFIX) \ ++ smax.$(SUFFIX) samax.$(SUFFIX) ismax.$(SUFFIX) isamax.$(SUFFIX) \ ++ smin.$(SUFFIX) samin.$(SUFFIX) ismin.$(SUFFIX) isamin.$(SUFFIX) \ ++ srot.$(SUFFIX) srotg.$(SUFFIX) srotm.$(SUFFIX) srotmg.$(SUFFIX) \ ++ saxpby.$(SUFFIX) ++ ++FSBLAS2OBJS = \ ++ sgemv.$(SUFFIX) sger.$(SUFFIX) \ ++ strsv.$(SUFFIX) strmv.$(SUFFIX) ssymv.$(SUFFIX) \ ++ ssyr.$(SUFFIX) ssyr2.$(SUFFIX) sgbmv.$(SUFFIX) \ ++ ssbmv.$(SUFFIX) sspmv.$(SUFFIX) \ ++ sspr.$(SUFFIX) sspr2.$(SUFFIX) \ ++ stbsv.$(SUFFIX) stbmv.$(SUFFIX) \ ++ stpsv.$(SUFFIX) stpmv.$(SUFFIX) ++ ++FSBLAS3OBJS = \ ++ sgemm.$(SUFFIX) ssymm.$(SUFFIX) strmm.$(SUFFIX) \ ++ strsm.$(SUFFIX) ssyrk.$(SUFFIX) ssyr2k.$(SUFFIX) \ ++ somatcopy.$(SUFFIX) simatcopy.$(SUFFIX)\ ++ sgeadd.$(SUFFIX) ++ ++ ++FDBLAS1OBJS = \ ++ daxpy.$(SUFFIX) dswap.$(SUFFIX) \ ++ dcopy.$(SUFFIX) dscal.$(SUFFIX) \ ++ ddot.$(SUFFIX) \ ++ dasum.$(SUFFIX) dnrm2.$(SUFFIX) \ ++ dmax.$(SUFFIX) damax.$(SUFFIX) idmax.$(SUFFIX) idamax.$(SUFFIX) \ ++ dmin.$(SUFFIX) damin.$(SUFFIX) idmin.$(SUFFIX) idamin.$(SUFFIX) \ ++ drot.$(SUFFIX) drotg.$(SUFFIX) drotm.$(SUFFIX) drotmg.$(SUFFIX) \ ++ daxpby.$(SUFFIX) ++ ++FDBLAS2OBJS = \ ++ dgemv.$(SUFFIX) dger.$(SUFFIX) \ ++ dtrsv.$(SUFFIX) dtrmv.$(SUFFIX) dsymv.$(SUFFIX) \ ++ dsyr.$(SUFFIX) dsyr2.$(SUFFIX) dgbmv.$(SUFFIX) \ ++ dsbmv.$(SUFFIX) dspmv.$(SUFFIX) \ ++ dspr.$(SUFFIX) dspr2.$(SUFFIX) \ ++ dtbsv.$(SUFFIX) dtbmv.$(SUFFIX) \ ++ dtpsv.$(SUFFIX) dtpmv.$(SUFFIX) ++ ++FDBLAS3OBJS = \ ++ dgemm.$(SUFFIX) dsymm.$(SUFFIX) dtrmm.$(SUFFIX) \ ++ dtrsm.$(SUFFIX) dsyrk.$(SUFFIX) dsyr2k.$(SUFFIX) \ ++ domatcopy.$(SUFFIX) dimatcopy.$(SUFFIX)\ ++ dgeadd.$(SUFFIX) ++ ++FCBLAS1OBJS = \ ++ caxpy.$(SUFFIX) caxpyc.$(SUFFIX) cswap.$(SUFFIX) \ ++ ccopy.$(SUFFIX) cscal.$(SUFFIX) csscal.$(SUFFIX) \ ++ cdotc.$(SUFFIX) cdotu.$(SUFFIX) \ ++ scasum.$(SUFFIX) scnrm2.$(SUFFIX) \ ++ scamax.$(SUFFIX) icamax.$(SUFFIX) \ ++ scamin.$(SUFFIX) icamin.$(SUFFIX) \ ++ csrot.$(SUFFIX) crotg.$(SUFFIX) \ ++ caxpby.$(SUFFIX) ++ ++FCBLAS2OBJS = \ ++ cgemv.$(SUFFIX) cgeru.$(SUFFIX) cgerc.$(SUFFIX) \ ++ ctrsv.$(SUFFIX) ctrmv.$(SUFFIX) \ ++ csyr2.$(SUFFIX) cgbmv.$(SUFFIX) \ ++ csbmv.$(SUFFIX) \ ++ cspr2.$(SUFFIX) \ ++ ctbsv.$(SUFFIX) ctbmv.$(SUFFIX) \ ++ ctpsv.$(SUFFIX) ctpmv.$(SUFFIX) \ ++ chemv.$(SUFFIX) chbmv.$(SUFFIX) \ ++ cher.$(SUFFIX) cher2.$(SUFFIX) \ ++ chpmv.$(SUFFIX) chpr.$(SUFFIX) chpr2.$(SUFFIX) ++ ++FCBLAS3OBJS = \ ++ cgemm.$(SUFFIX) csymm.$(SUFFIX) ctrmm.$(SUFFIX) \ ++ ctrsm.$(SUFFIX) csyrk.$(SUFFIX) csyr2k.$(SUFFIX) \ ++ chemm.$(SUFFIX) cherk.$(SUFFIX) cher2k.$(SUFFIX) \ ++ comatcopy.$(SUFFIX) cimatcopy.$(SUFFIX)\ ++ cgeadd.$(SUFFIX) ++ ++FZBLAS1OBJS = \ ++ zaxpy.$(SUFFIX) zaxpyc.$(SUFFIX) zswap.$(SUFFIX) \ ++ zcopy.$(SUFFIX) zscal.$(SUFFIX) zdscal.$(SUFFIX) \ ++ zdotc.$(SUFFIX) zdotu.$(SUFFIX) \ ++ dzasum.$(SUFFIX) dznrm2.$(SUFFIX) \ ++ dzamax.$(SUFFIX) izamax.$(SUFFIX) \ ++ dzamin.$(SUFFIX) izamin.$(SUFFIX) \ ++ zdrot.$(SUFFIX) zrotg.$(SUFFIX) \ ++ zaxpby.$(SUFFIX) ++ ++FZBLAS2OBJS = \ ++ zgemv.$(SUFFIX) zgeru.$(SUFFIX) zgerc.$(SUFFIX) \ ++ ztrsv.$(SUFFIX) ztrmv.$(SUFFIX) \ ++ zsyr2.$(SUFFIX) zgbmv.$(SUFFIX) \ ++ zsbmv.$(SUFFIX) \ ++ zspr2.$(SUFFIX) \ ++ ztbsv.$(SUFFIX) ztbmv.$(SUFFIX) \ ++ ztpsv.$(SUFFIX) ztpmv.$(SUFFIX) \ ++ zhemv.$(SUFFIX) zhbmv.$(SUFFIX) \ ++ zher.$(SUFFIX) zher2.$(SUFFIX) \ ++ zhpmv.$(SUFFIX) zhpr.$(SUFFIX) zhpr2.$(SUFFIX) ++ ++FZBLAS3OBJS = \ ++ zgemm.$(SUFFIX) zsymm.$(SUFFIX) ztrmm.$(SUFFIX) \ ++ ztrsm.$(SUFFIX) zsyrk.$(SUFFIX) zsyr2k.$(SUFFIX) \ ++ zhemm.$(SUFFIX) zherk.$(SUFFIX) zher2k.$(SUFFIX) \ ++ zomatcopy.$(SUFFIX) zimatcopy.$(SUFFIX)\ ++ zgeadd.$(SUFFIX) ++ ++shared-blas-lapack: libblas.so.3 libcblas.so.3 liblapack.so.3 ++ ++# The list of prerequisite is created by comparing with NETLIB BLAS public API. ++# The symbol cblas_xerbla is missing here, but it does not seem to be provided ++# by libopenblas.so.0 either. ++libblas.so.3: $(FSBLAS1OBJS) $(FSBLAS2OBJS) $(FSBLAS3OBJS) $(FDBLAS1OBJS) $(FDBLAS2OBJS) $(FDBLAS3OBJS) $(FCBLAS1OBJS) $(FCBLAS2OBJS) $(FCBLAS3OBJS) $(FZBLAS1OBJS) $(FZBLAS2OBJS) $(FZBLAS3OBJS) ../kernel/lsame.o ../kernel/scabs1.o ../kernel/dcabs1.o ../driver/others/xerbla.o ++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -Wl,-soname,libblas.so.3 -L.. -lopenblas $(EXTRALIB) ++ ++libcblas.so.3: $(CSBLAS1OBJS) $(CSBLAS2OBJS) $(CSBLAS3OBJS) $(CDBLAS1OBJS) $(CDBLAS2OBJS) $(CDBLAS3OBJS) $(CCBLAS1OBJS) $(CCBLAS2OBJS) $(CCBLAS3OBJS) $(CZBLAS1OBJS) $(CZBLAS2OBJS) $(CZBLAS3OBJS) ../kernel/lsame.o ../kernel/scabs1.o ../kernel/dcabs1.o ../driver/others/xerbla.o ++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -Wl,-soname,libcblas.so.3 -L.. -lopenblas $(EXTRALIB) ++ ++liblapack.so.3: $(SLAPACKOBJS) $(DLAPACKOBJS) $(CLAPACKOBJS) $(ZLAPACKOBJS) ../kernel/lsame.o ../driver/others/xerbla.o ++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ ../lapack-netlib/SRC/*.o -Wl,-soname,liblapack.so.3 -L.. -lopenblas $(EXTRALIB) ++ ++clean:: ++ rm -f libblas.so.3 libcblas.so.3 liblapack.so.3 diff --git a/sci-libs/openblas/metadata.xml b/sci-libs/openblas/metadata.xml new file mode 100644 index 000000000000..a5e019212f0d --- /dev/null +++ b/sci-libs/openblas/metadata.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>sci@gentoo.org</email> + <name>Gentoo Science Project</name> + </maintainer> + <longdescription lang="en"> + OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. + </longdescription> + <use> + <flag name="dynamic">Build dynamic architecture detection at run time (for multi targets)</flag> + <flag name="pthread">Build with pthread threadding model</flag> + <flag name="serial">Build without multi-thraedding</flag> + <flag name="eselect-ldso">Enable BLAS/LAPACK runtime switching</flag> + </use> + <upstream> + <remote-id type="github">xianyi/OpenBLAS</remote-id> + </upstream> +</pkgmetadata> diff --git a/sci-libs/openblas/openblas-0.3.5.ebuild b/sci-libs/openblas/openblas-0.3.5.ebuild new file mode 100644 index 000000000000..b41803760ae9 --- /dev/null +++ b/sci-libs/openblas/openblas-0.3.5.ebuild @@ -0,0 +1,85 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +DESCRIPTION="Optimized BLAS library based on GotoBLAS2" +HOMEPAGE="http://xianyi.github.com/OpenBLAS/" +SRC_URI="https://github.com/xianyi/OpenBLAS/tarball/v${PV} -> ${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos" +IUSE="dynamic openmp pthread serial static-libs eselect-ldso" +REQUIRED_USE="?? ( openmp pthread serial )" + +RDEPEND=" +>=app-eselect/eselect-blas-0.2 +>=app-eselect/eselect-lapack-0.2 +" +DEPEND="${RDEPEND} + virtual/pkgconfig" + +PATCHES=( "${FILESDIR}/shared-blas-lapack.patch" ) + +openblas_flags() { + local flags=() + use dynamic && \ + flags+=( DYNAMIC_ARCH=1 TARGET=GENERIC NUM_THREADS=64 NO_AFFINITY=1 ) + if use openmp; then + flags+=( USE_THREAD=1 USE_OPENMP=1 ) + elif use pthread; then + flags+=( USE_THREAD=1 USE_OPENMP=0 ) + else + flags+=( USE_THREAD=0 ) # serial + fi + flags+=( DESTDIR="${D}" PREFIX="${EPREFIX}/usr" ) + flags+=( OPENBLAS_INCLUDE_DIR='$(PREFIX)'/include/${PN} ) + flags+=( OPENBLAS_LIBRARY_DIR='$(PREFIX)'/$(get_libdir) ) + echo "${flags[@]}" +} + +src_unpack () { + default + find "${WORKDIR}" -maxdepth 1 -type d -name \*OpenBLAS\* && \ + mv "${WORKDIR}"/*OpenBLAS* "${S}" || die +} + +src_compile () { + emake $(openblas_flags) + emake -Cinterface shared-blas-lapack $(openblas_flags) +} + +src_install () { + emake install $(openblas_flags) + + if use eselect-ldso; then + dodir /usr/$(get_libdir)/blas/openblas/ + insinto /usr/$(get_libdir)/blas/openblas/ + doins interface/libblas.so.3 + dosym libblas.so.3 usr/$(get_libdir)/blas/openblas/libblas.so + doins interface/libcblas.so.3 + dosym libcblas.so.3 usr/$(get_libdir)/blas/openblas/libcblas.so + + dodir /usr/$(get_libdir)/lapack/openblas/ + insinto /usr/$(get_libdir)/lapack/openblas/ + doins interface/liblapack.so.3 + dosym liblapack.so.3 usr/$(get_libdir)/lapack/openblas/liblapack.so + fi +} + +pkg_postinst () { + if use eselect-ldso; then + eselect blas add $(get_libdir) \ + "${EROOT}"/usr/$(get_libdir)/blas/openblas openblas + eselect lapack add $(get_libdir) \ + "${EROOT}"/usr/$(get_libdir)/lapack/openblas openblas + fi +} + +pkg_postrm () { + if use eselect-ldso; then + eselect blas validate + eselect lapack validate + fi +} |