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