Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/openblas/files/, sci-libs/openblas/
Date: Thu, 29 Oct 2020 20:16:59
Message-Id: 1604001779.bb8882671371c6fe665f279a4f41fd0199d28903.sam@gentoo
1 commit: bb8882671371c6fe665f279a4f41fd0199d28903
2 Author: Aisha Tammy <gentoo <AT> aisha <DOT> cc>
3 AuthorDate: Wed Oct 21 21:17:02 2020 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 29 20:02:59 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bb888267
7
8 sci-libs/openblas: version bump to 0.3.12
9
10 fix export of toolchain variables
11 fix using BUILDCC for doing local scripting work
12 fix building of tests on cross compile
13 add options to manipulate threading and parallel calls
14 fix up patch to latest
15 add building of lapacke library
16 add option to build relapack extension
17
18 Closes: https://bugs.gentoo.org/749921
19
20 Package-Manager: Portage-3.0.8, Repoman-3.0.1
21 Signed-off-by: Aisha Tammy <gentoo <AT> aisha.cc>
22 Closes: https://github.com/gentoo/gentoo/pull/17993
23 Signed-off-by: Sam James <sam <AT> gentoo.org>
24
25 sci-libs/openblas/Manifest | 1 +
26 .../files/openblas-0.3.12-shared-blas-lapack.patch | 36 ++++
27 sci-libs/openblas/metadata.xml | 3 +
28 sci-libs/openblas/openblas-0.3.12.ebuild | 196 +++++++++++++++++++++
29 4 files changed, 236 insertions(+)
30
31 diff --git a/sci-libs/openblas/Manifest b/sci-libs/openblas/Manifest
32 index e9163333248..13a601adbee 100644
33 --- a/sci-libs/openblas/Manifest
34 +++ b/sci-libs/openblas/Manifest
35 @@ -1,2 +1,3 @@
36 DIST openblas-0.3.10.tar.gz 12246979 BLAKE2B 507aa3f058b841f477720cff98480afda5c3e236b688fb1a12ff45ce20c42c6e84c786d62a5db7e6de6d133d40286e58777fcb51d6542b7030629d55ba12086f SHA512 64a5f983b2f6e02cdb6e0f14433498cc5daa1ccfb49246f7a2dcd38f9982fa608f2abea069fe0e35012af8c1441c43d1f6418eaccd40795f5002fed1c36ce05d
37 +DIST openblas-0.3.12.tar.gz 12325103 BLAKE2B 3d6706e59e83f87dd58b287753bf697de99e83c8a4484453f120d8f8c9c69ea5b481a143db04342a1dcb1779ce548a49618cf4941d08d636e12ed481305e8fb5 SHA512 1ff5a065c41f7e460857f8428fc77900b189f051fa8129eea9ae93237f234d387cc1c6e627c2c95636164f512d4d721d4229729f04a04e8d5f655abbf5463d98
38 DIST openblas-0.3.9.tar.gz 12189745 BLAKE2B 3cc4c6a403d6a52845cf4ff8cef254f57587e17e3d09bfb6ed7c02ad06a6002e50b340177c73a944c2a621c12b7f494c516025751c194d019662c0b4db17f4dc SHA512 c6b8ee465f1cf53b37f21ec3ff9a28d5cafe20fec59d8c1bff5923a9e1989dfa5ae8c032a5d43988fe7722ed08c64c7957a3d30e6ae917e2e7aa2977a91e67a3
39
40 diff --git a/sci-libs/openblas/files/openblas-0.3.12-shared-blas-lapack.patch b/sci-libs/openblas/files/openblas-0.3.12-shared-blas-lapack.patch
41 new file mode 100644
42 index 00000000000..68a54cf1505
43 --- /dev/null
44 +++ b/sci-libs/openblas/files/openblas-0.3.12-shared-blas-lapack.patch
45 @@ -0,0 +1,36 @@
46 +diff --git a/interface/Makefile b/interface/Makefile
47 +index 6b247b4..1297c73 100644
48 +--- a/interface/Makefile
49 ++++ b/interface/Makefile
50 +@@ -330,7 +330,7 @@ CCBLAS3OBJS = \
51 + cblas_chemm.$(SUFFIX) cblas_cherk.$(SUFFIX) cblas_cher2k.$(SUFFIX) \
52 + cblas_comatcopy.$(SUFFIX) cblas_cimatcopy.$(SUFFIX)\
53 + cblas_cgeadd.$(SUFFIX)
54 +-
55 ++
56 + CXERBLAOBJ = \
57 + cblas_xerbla.$(SUFFIX)
58 +
59 +@@ -2310,3 +2310,22 @@ cblas_zgeadd.$(SUFFIX) cblas_zgeadd.$(PSUFFIX) : zgeadd.c
60 + cblas_xerbla.$(SUFFIX) cblas_xerbla.$(PSUFFIX) : xerbla.c
61 + $(CC) -c $(CFLAGS) -DCBLAS $< -o $(@F)
62 +
63 ++#####
64 ++shared-blas-lapack: libblas.so.3 libcblas.so.3 liblapack.so.3 liblapacke.so.3
65 ++
66 ++# The list of prerequisite is created by comparing with NETLIB BLAS public API.
67 ++libblas.so.3: $(SBLAS1OBJS) $(SBLAS2OBJS) $(SBLAS3OBJS) $(DBLAS1OBJS) $(DBLAS2OBJS) $(DBLAS3OBJS) $(CBLAS1OBJS) $(CBLAS2OBJS) $(CBLAS3OBJS) $(ZBLAS1OBJS) $(ZBLAS2OBJS) $(ZBLAS3OBJS) ../kernel/lsame.o ../kernel/scabs1.o ../kernel/dcabs1.o ../driver/others/xerbla.o
68 ++ $(CC) $(LDFLAGS) -shared -o $@ $^ -Wl,-soname,libblas.so.3 -L.. -lopenblas $(EXTRALIB)
69 ++
70 ++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
71 ++ $(CC) $(LDFLAGS) -shared -o $@ $^ -Wl,-soname,libblas.so.3 -L.. -lopenblas $(EXTRALIB)
72 ++
73 ++# The prerequisites must match the symbols deleted in target delete-duplicate-lapack-objects
74 ++liblapack.so.3: $(SLAPACKOBJS) $(DLAPACKOBJS) $(CLAPACKOBJS) $(ZLAPACKOBJS) ../kernel/lsame.o ../driver/others/xerbla.o
75 ++ $(CC) $(LDFLAGS) -shared -o $@ $^ ../lapack-netlib/SRC/*.o -Wl,-soname,liblapack.so.3 -L.. -lopenblas $(EXTRALIB)
76 ++
77 ++liblapacke.so.3: liblapack.so.3
78 ++ $(CC) $(LDFLAGS) -shared -o $@ `find ../lapack-netlib/LAPACKE -name "*.o"` -Wl,-soname,liblapacke.so.3 -L.. -lopenblas $(EXTRALIB)
79 ++
80 ++clean::
81 ++ rm -f libblas.so.3 libcblas.so.3 liblapack.so.3
82
83 diff --git a/sci-libs/openblas/metadata.xml b/sci-libs/openblas/metadata.xml
84 index 0661dad2eee..0f6a98c1f26 100644
85 --- a/sci-libs/openblas/metadata.xml
86 +++ b/sci-libs/openblas/metadata.xml
87 @@ -33,6 +33,9 @@
88 <flag name="pthread">
89 Build with pthread threading model
90 </flag>
91 + <flag name="relapack">
92 + Build the ReLAPACK extension to OpenBLAS
93 + </flag>
94 </use>
95 <upstream>
96 <remote-id type="github">xianyi/OpenBLAS</remote-id>
97
98 diff --git a/sci-libs/openblas/openblas-0.3.12.ebuild b/sci-libs/openblas/openblas-0.3.12.ebuild
99 new file mode 100644
100 index 00000000000..b9d0d023fb5
101 --- /dev/null
102 +++ b/sci-libs/openblas/openblas-0.3.12.ebuild
103 @@ -0,0 +1,196 @@
104 +# Copyright 1999-2020 Gentoo Authors
105 +# Distributed under the terms of the GNU General Public License v2
106 +
107 +EAPI=7
108 +
109 +inherit flag-o-matic fortran-2 toolchain-funcs
110 +
111 +DESCRIPTION="Optimized BLAS library based on GotoBLAS2"
112 +HOMEPAGE="http://xianyi.github.com/OpenBLAS/"
113 +SRC_URI="https://github.com/xianyi/OpenBLAS/archive/v${PV}.tar.gz -> ${P}.tar.gz"
114 +S="${WORKDIR}"/OpenBLAS-${PV}
115 +
116 +LICENSE="BSD"
117 +SLOT="0"
118 +KEYWORDS="~amd64 ~arm ~arm64 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos"
119 +IUSE="dynamic eselect-ldso index-64bit openmp pthread +relapack test"
120 +REQUIRED_USE="?? ( openmp pthread )"
121 +RESTRICT="!test? ( test )"
122 +
123 +RDEPEND="
124 + eselect-ldso? (
125 + >=app-eselect/eselect-blas-0.2
126 + >=app-eselect/eselect-lapack-0.2
127 + )
128 +"
129 +BDEPEND="virtual/pkgconfig"
130 +
131 +PATCHES=(
132 + "${FILESDIR}/${PN}-0.3.12-shared-blas-lapack.patch"
133 + "${FILESDIR}/${PN}-0.3.10-dont-clobber-fflags.patch"
134 +)
135 +
136 +pkg_pretend() {
137 + elog "This software has a massive number of options that"
138 + elog "are configurable and it is *impossible* for all of"
139 + elog "those to fit inside any manageable ebuild."
140 + elog "The Gentoo provided package has enough to build"
141 + elog "a fully optimized library for your targeted CPU."
142 + elog "You can set the CPU target using the environment"
143 + elog "variable - OPENBLAS_TARGET or it will be detected"
144 + elog "automatically from the target toolchain (supports"
145 + elog "cross compilation toolchains)."
146 + elog "You can control the maximum number of threads"
147 + elog "using OPENBLAS_NTHREAD, default=64 and number of "
148 + elog "parallel calls to allow before further calls wait"
149 + elog "using OPENBLAS_NPARALLEL, default=8."
150 +}
151 +
152 +pkg_setup() {
153 + fortran-2_pkg_setup
154 +
155 + # List of most configurable options - Makefile.rule
156 +
157 + # https://github.com/xianyi/OpenBLAS/pull/2663
158 + tc-export CC FC LD AR AS RANLIB
159 +
160 + # HOSTCC is used for scripting
161 + export HOSTCC=$(tc-getBUILD_CC)
162 +
163 + # threading options
164 + use openmp && tc-check-openmp
165 + USE_THREAD=0
166 + if use openmp; then
167 + USE_THREAD=1; USE_OPENMP=1;
168 + elif use pthread; then
169 + USE_THREAD=1; USE_OPENMP=0;
170 + fi
171 + export USE_THREAD USE_OPENMP
172 +
173 + # We need to filter these while building the library, and not just
174 + # while building the test suite. Will hopefully get fixed upstream:
175 + # https://github.com/xianyi/OpenBLAS/issues/2657
176 + use test && filter-flags "-fbounds-check" "-fcheck=bounds" "-fcheck=all"
177 +
178 + # disable submake with -j and default optimization flags
179 + # in Makefile.system
180 + # Makefile.rule says to not modify COMMON_OPT/FCOMMON_OPT...
181 + export MAKE_NB_JOBS=-1 \
182 + COMMON_OPT=" " \
183 + FCOMMON_OPT=" "
184 +
185 + # Target CPU ARCH options
186 + # generally detected automatically from cross toolchain
187 + use dynamic && \
188 + export DYNAMIC_ARCH=1 \
189 + NO_AFFINITY=1 \
190 + TARGET=GENERIC
191 +
192 + export NUM_PARALLEL=${OPENBLAS_NPARALLEL:-8} \
193 + NUM_THREADS=${OPENBLAS_NTHREAD:-64}
194 +
195 + # setting OPENBLAS_TARGET to override auto detection
196 + # in case the toolchain is not enough to detect
197 + # https://github.com/xianyi/OpenBLAS/blob/develop/TargetList.txt
198 + if ! use dynamic && [[ ! -z "${OPENBLAS_TARGET}" ]] ; then
199 + export TARGET="${OPENBLAS_TARGET}"
200 + fi
201 +
202 + export NO_STATIC=1
203 +
204 + BUILD_RELAPACK=1
205 + if ! use relapack; then
206 + BUILD_RELAPACK=0
207 + fi
208 +
209 + export PREFIX="${EPREFIX}/usr" BUILD_RELAPACK
210 +}
211 +
212 +src_prepare() {
213 + default
214 + # disable tests by default
215 + sed -e "/^all ::/s/tests //" -i Makefile || die
216 + # if 64bit-index is needed, create second library
217 + # with LIBPREFIX=libopenblas64
218 + if use index-64bit; then
219 + cp -aL "${S}" "${S}-index-64bit" || die
220 + fi
221 +}
222 +
223 +src_compile() {
224 + default
225 + cd interface
226 + emake shared-blas-lapack
227 +
228 + if use index-64bit; then
229 + emake -C"${S}-index-64bit" \
230 + INTERFACE64=1 \
231 + LIBPREFIX=libopenblas64
232 + fi
233 +}
234 +
235 +src_test() {
236 + emake tests
237 +}
238 +
239 +src_install() {
240 + emake install DESTDIR="${D}" \
241 + OPENBLAS_INCLUDE_DIR='$(PREFIX)'/include/${PN} \
242 + OPENBLAS_LIBRARY_DIR='$(PREFIX)'/$(get_libdir)
243 +
244 + dodoc GotoBLAS_*.txt *.md Changelog.txt
245 +
246 + if use index-64bit; then
247 + dolib.so "${S}-index-64bit"/libopenblas64*.so*
248 + fi
249 +
250 + if use eselect-ldso; then
251 + insinto /usr/$(get_libdir)/blas/openblas/
252 + doins interface/libblas.so.3
253 + dosym libblas.so.3 usr/$(get_libdir)/blas/openblas/libblas.so
254 + doins interface/libcblas.so.3
255 + dosym libcblas.so.3 usr/$(get_libdir)/blas/openblas/libcblas.so
256 +
257 + insinto /usr/$(get_libdir)/lapack/openblas/
258 + doins interface/liblapack.so.3
259 + dosym liblapack.so.3 usr/$(get_libdir)/lapack/openblas/liblapack.so
260 + doins interface/liblapacke.so.3
261 + dosym liblapacke.so.3 usr/$(get_libdir)/lapack/openblas/liblapacke.so
262 + fi
263 +}
264 +
265 +pkg_postinst() {
266 + use eselect-ldso || return
267 + local libdir=$(get_libdir) me="openblas"
268 +
269 + # check blas
270 + eselect blas add ${libdir} "${EROOT}"/usr/${libdir}/blas/${me} ${me}
271 + local current_blas=$(eselect blas show ${libdir} | cut -d' ' -f2)
272 + if [[ ${current_blas} == "${me}" || -z ${current_blas} ]]; then
273 + eselect blas set ${libdir} ${me}
274 + elog "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
275 + else
276 + elog "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
277 + elog "To use blas [${me}] implementation, you have to issue (as root):"
278 + elog "\t eselect blas set ${libdir} ${me}"
279 + fi
280 +
281 + # check lapack
282 + eselect lapack add ${libdir} "${EROOT}"/usr/${libdir}/lapack/${me} ${me}
283 + local current_lapack=$(eselect lapack show ${libdir} | cut -d' ' -f2)
284 + if [[ ${current_lapack} == "${me}" || -z ${current_lapack} ]]; then
285 + eselect lapack set ${libdir} ${me}
286 + elog "Current eselect: LAPACK ($libdir) -> [${current_lapack}]."
287 + else
288 + elog "Current eselect: LAPACK ($libdir) -> [${current_lapack}]."
289 + elog "To use lapack [${me}] implementation, you have to issue (as root):"
290 + elog "\t eselect lapack set ${libdir} ${me}"
291 + fi
292 +}
293 +
294 +pkg_postrm() {
295 + if use eselect-ldso; then
296 + eselect blas validate
297 + eselect lapack validate
298 + fi
299 +}