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