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/
Date: Sun, 03 Oct 2021 04:32:47
Message-Id: 1633235556.b09c120dec769abe7e10aa81bb327a55aaa1668e.sam@gentoo
1 commit: b09c120dec769abe7e10aa81bb327a55aaa1668e
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 3 04:32:19 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 3 04:32:36 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b09c120d
7
8 sci-libs/openblas: add 0.3.18
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 sci-libs/openblas/Manifest | 1 +
13 sci-libs/openblas/openblas-0.3.18.ebuild | 197 +++++++++++++++++++++++++++++++
14 2 files changed, 198 insertions(+)
15
16 diff --git a/sci-libs/openblas/Manifest b/sci-libs/openblas/Manifest
17 index 43e59153feb..f25ea9b5b2b 100644
18 --- a/sci-libs/openblas/Manifest
19 +++ b/sci-libs/openblas/Manifest
20 @@ -2,3 +2,4 @@ DIST openblas-0.3.12.tar.gz 12325103 BLAKE2B 3d6706e59e83f87dd58b287753bf697de99
21 DIST openblas-0.3.13.tar.gz 12437434 BLAKE2B d8f9d3296506c6148cd506278f0b6a2a4fe50975a7fd3f54108e98e88a13002b1035f5697322ba73df7c6397faee6d0772c1d4d46b66db8e862f17b980dbdf97 SHA512 86e7f496587cc35d7feede99cbe3cf627ef690dd7489bb03b95f7d15ed758e32baf17d79f17b1de187184394233f60a8249a64dd53c3d59a9540db92269b7ee4
22 DIST openblas-0.3.14.tar.gz 12460465 BLAKE2B 9505ff6e132581ecc86159fb84192c6bbce0f2974293eaf1b4aca6b96b5da85823bfc1bced65a96930674fd4781ea3e375aed09cbdc9930cef26694c9f8e1c80 SHA512 c7d5947ada525a32bc6e97ff94272df9730fa5fb06102e06e80472baedc1a9119d82050cdaede192db15f816ae7143784d7801b61b64fab5b5cf97cdbd5e625e
23 DIST openblas-0.3.17.tar.gz 12513037 BLAKE2B bb3a89500f242613a6bed73519702995cf1e82dcfec49f9469ecfd6647121260a4364582dbc257a75212320b5690ba93e75a0f2762dce7f398ef6443b169b4e4 SHA512 a97745c1f050ea44fce5f1722810de469612d374a29796a874d12673d6ad189872160cc2b5d0885790e6562d9d7ade629144c86f2649e668b0d4def36aa74495
24 +DIST openblas-0.3.18.tar.gz 12619822 BLAKE2B 38a5e7b861eb0063a4494c1cfb6f7f5723741437ecdd5cb1fb42645eb73bceb472b3a8c11eec3d0ba4f676981ac89de4ff1ee0d7ea42d1e234746f34ce8fb6b8 SHA512 df9a14026a61bdc5285636bfd7a52dce244d24fcf4a0c870ef4e58b8b50e412849828ca5aeac2a2435f635e78e60559762e8bae22ea7bc5dff2e865a96d81152
25
26 diff --git a/sci-libs/openblas/openblas-0.3.18.ebuild b/sci-libs/openblas/openblas-0.3.18.ebuild
27 new file mode 100644
28 index 00000000000..7d76564474c
29 --- /dev/null
30 +++ b/sci-libs/openblas/openblas-0.3.18.ebuild
31 @@ -0,0 +1,197 @@
32 +# Copyright 1999-2021 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=7
36 +
37 +inherit flag-o-matic fortran-2 toolchain-funcs
38 +
39 +DESCRIPTION="Optimized BLAS library based on GotoBLAS2"
40 +HOMEPAGE="http://xianyi.github.com/OpenBLAS/"
41 +SRC_URI="https://github.com/xianyi/OpenBLAS/archive/v${PV}.tar.gz -> ${P}.tar.gz"
42 +S="${WORKDIR}"/OpenBLAS-${PV}
43 +
44 +LICENSE="BSD"
45 +SLOT="0"
46 +KEYWORDS="~amd64 ~arm ~arm64 ~x86 ~amd64-linux ~x86-linux ~x64-macos"
47 +IUSE="dynamic eselect-ldso index-64bit openmp pthread relapack test"
48 +REQUIRED_USE="?? ( openmp pthread )"
49 +RESTRICT="!test? ( test )"
50 +
51 +RDEPEND="
52 + eselect-ldso? (
53 + >=app-eselect/eselect-blas-0.2
54 + >=app-eselect/eselect-lapack-0.2
55 + )
56 +"
57 +BDEPEND="virtual/pkgconfig"
58 +
59 +PATCHES=(
60 + "${FILESDIR}/${PN}-0.3.12-shared-blas-lapack.patch"
61 +)
62 +
63 +pkg_pretend() {
64 + elog "This software has a massive number of options that"
65 + elog "are configurable and it is *impossible* for all of"
66 + elog "those to fit inside any manageable ebuild."
67 + elog "The Gentoo provided package has enough to build"
68 + elog "a fully optimized library for your targeted CPU."
69 + elog "You can set the CPU target using the environment"
70 + elog "variable - OPENBLAS_TARGET or it will be detected"
71 + elog "automatically from the target toolchain (supports"
72 + elog "cross compilation toolchains)."
73 + elog "You can control the maximum number of threads"
74 + elog "using OPENBLAS_NTHREAD, default=64 and number of "
75 + elog "parallel calls to allow before further calls wait"
76 + elog "using OPENBLAS_NPARALLEL, default=8."
77 +}
78 +
79 +pkg_setup() {
80 + fortran-2_pkg_setup
81 +
82 + # List of most configurable options - Makefile.rule
83 +
84 + # https://github.com/xianyi/OpenBLAS/pull/2663
85 + tc-export CC FC LD AR AS RANLIB
86 +
87 + # HOSTCC is used for scripting
88 + export HOSTCC=$(tc-getBUILD_CC)
89 +
90 + # threading options
91 + use openmp && tc-check-openmp
92 + USE_THREAD=0
93 + if use openmp; then
94 + USE_THREAD=1; USE_OPENMP=1;
95 + elif use pthread; then
96 + USE_THREAD=1; USE_OPENMP=0;
97 + fi
98 + export USE_THREAD USE_OPENMP
99 +
100 + # We need to filter these while building the library, and not just
101 + # while building the test suite. Will hopefully get fixed upstream:
102 + # https://github.com/xianyi/OpenBLAS/issues/2657
103 + use test && filter-flags "-fbounds-check" "-fcheck=bounds" "-fcheck=all"
104 +
105 + # disable submake with -j and default optimization flags
106 + # in Makefile.system
107 + # Makefile.rule says to not modify COMMON_OPT/FCOMMON_OPT...
108 + export MAKE_NB_JOBS=-1 \
109 + COMMON_OPT=" " \
110 + FCOMMON_OPT=" "
111 +
112 + # Target CPU ARCH options
113 + # generally detected automatically from cross toolchain
114 + use dynamic && \
115 + export DYNAMIC_ARCH=1 \
116 + NO_AFFINITY=1 \
117 + TARGET=GENERIC
118 +
119 + export NUM_PARALLEL=${OPENBLAS_NPARALLEL:-8} \
120 + NUM_THREADS=${OPENBLAS_NTHREAD:-64}
121 +
122 + # setting OPENBLAS_TARGET to override auto detection
123 + # in case the toolchain is not enough to detect
124 + # https://github.com/xianyi/OpenBLAS/blob/develop/TargetList.txt
125 + if ! use dynamic && [[ ! -z "${OPENBLAS_TARGET}" ]] ; then
126 + export TARGET="${OPENBLAS_TARGET}"
127 + fi
128 +
129 + export NO_STATIC=1
130 +
131 + BUILD_RELAPACK=1
132 + if ! use relapack; then
133 + BUILD_RELAPACK=0
134 + fi
135 +
136 + export PREFIX="${EPREFIX}/usr" BUILD_RELAPACK
137 +}
138 +
139 +src_prepare() {
140 + default
141 +
142 + # Disable tests by default
143 + sed -e "/^all ::/s/tests //" -i Makefile || die
144 +
145 + # if 64bit-index is needed, create second library
146 + # with LIBPREFIX=libopenblas64
147 + if use index-64bit; then
148 + cp -aL "${S}" "${S}-index-64bit" || die
149 + fi
150 +}
151 +
152 +src_compile() {
153 + default
154 + cd interface || die
155 + emake shared-blas-lapack
156 +
157 + if use index-64bit; then
158 + emake -C"${S}-index-64bit" \
159 + INTERFACE64=1 \
160 + LIBPREFIX=libopenblas64
161 + fi
162 +}
163 +
164 +src_test() {
165 + emake tests
166 +}
167 +
168 +src_install() {
169 + emake install DESTDIR="${D}" \
170 + OPENBLAS_INCLUDE_DIR='$(PREFIX)'/include/${PN} \
171 + OPENBLAS_LIBRARY_DIR='$(PREFIX)'/$(get_libdir)
172 +
173 + dodoc GotoBLAS_*.txt *.md Changelog.txt
174 +
175 + if use index-64bit; then
176 + dolib.so "${S}-index-64bit"/libopenblas64*.so*
177 + fi
178 +
179 + if use eselect-ldso; then
180 + insinto /usr/$(get_libdir)/blas/openblas/
181 + doins interface/libblas.so.3
182 + dosym libblas.so.3 usr/$(get_libdir)/blas/openblas/libblas.so
183 + doins interface/libcblas.so.3
184 + dosym libcblas.so.3 usr/$(get_libdir)/blas/openblas/libcblas.so
185 +
186 + insinto /usr/$(get_libdir)/lapack/openblas/
187 + doins interface/liblapack.so.3
188 + dosym liblapack.so.3 usr/$(get_libdir)/lapack/openblas/liblapack.so
189 + doins interface/liblapacke.so.3
190 + dosym liblapacke.so.3 usr/$(get_libdir)/lapack/openblas/liblapacke.so
191 + fi
192 +}
193 +
194 +pkg_postinst() {
195 + use eselect-ldso || return
196 + local libdir=$(get_libdir) me="openblas"
197 +
198 + # check blas
199 + eselect blas add ${libdir} "${EROOT}"/usr/${libdir}/blas/${me} ${me}
200 + local current_blas=$(eselect blas show ${libdir} | cut -d' ' -f2)
201 + if [[ ${current_blas} == "${me}" || -z ${current_blas} ]]; then
202 + eselect blas set ${libdir} ${me}
203 + elog "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
204 + else
205 + elog "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
206 + elog "To use blas [${me}] implementation, you have to issue (as root):"
207 + elog "\t eselect blas set ${libdir} ${me}"
208 + fi
209 +
210 + # check lapack
211 + eselect lapack add ${libdir} "${EROOT}"/usr/${libdir}/lapack/${me} ${me}
212 + local current_lapack=$(eselect lapack show ${libdir} | cut -d' ' -f2)
213 + if [[ ${current_lapack} == "${me}" || -z ${current_lapack} ]]; then
214 + eselect lapack set ${libdir} ${me}
215 + elog "Current eselect: LAPACK ($libdir) -> [${current_lapack}]."
216 + else
217 + elog "Current eselect: LAPACK ($libdir) -> [${current_lapack}]."
218 + elog "To use lapack [${me}] implementation, you have to issue (as root):"
219 + elog "\t eselect lapack set ${libdir} ${me}"
220 + fi
221 +}
222 +
223 +pkg_postrm() {
224 + if use eselect-ldso; then
225 + eselect blas validate
226 + eselect lapack validate
227 + fi
228 +}