Gentoo Archives: gentoo-commits

From: Benda XU <heroxbd@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-eselect/eselect-blas/files/, app-eselect/eselect-blas/, ...
Date: Tue, 25 Jun 2019 10:58:50
Message-Id: 1561460279.111f0de1c6a774430837161b1bca64747bb0b58c.heroxbd@gentoo
1 commit: 111f0de1c6a774430837161b1bca64747bb0b58c
2 Author: Mo Zhou <cdluminate <AT> gmail <DOT> com>
3 AuthorDate: Tue Jun 25 09:05:15 2019 +0000
4 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 25 10:57:59 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=111f0de1
7
8 app-eselect/eselect-{blas,lapack}: new design for BLAS/LAPACK switch.
9
10 As discussed in the gentoo-dev, it is decided to adopt the runtime
11 switching of BLAS/CBLAS that has been proved by the experience of
12 Debian. The Gentoo libgcc-style ld.so.conf runtime switching has
13 been adopted as well, so as to avoid changing symlinks in /usr
14 ignoring package manager.
15
16 This design solves all the remaining problems regarding BLAS/LAPACK,
17 thus making alternative-2.eclass (runtime switching of build
18 options) and proposed USE_EXPAND (PYTHON_TARGET like eclass)
19 obsolete.
20
21 Finally we are at it. Thanks to all for years of ideas, debates and
22 hard work.
23
24 Reference: https://archives.gentoo.org/gentoo-dev/message/0177fea10e3ee06d85713101d17fc8d6
25
26 Closes: https://bugs.gentoo.org/632624
27 Closes: https://bugs.gentoo.org/470908
28 Closes: https://bugs.gentoo.org/267691
29 Closes: https://github.com/gentoo/gentoo/pull/12316
30 Closes: https://github.com/gentoo/gentoo/pull/12318
31 Closes: https://github.com/gentoo/sci/pull/835
32 Closes: https://github.com/gentoo/sci/pull/837
33
34 Credit: Dominik Schmidt, TheChymera, kiwifb, lkraav, Alessandro-Barbieri
35 Signed-off-by: Mo Zhou <cdluminate <AT> gmail.com>
36 Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>
37
38 app-eselect/eselect-blas/eselect-blas-0.2.ebuild | 28 ++++
39 app-eselect/eselect-blas/files/blas.eselect-0.2 | 168 +++++++++++++++++++++
40 app-eselect/eselect-blas/files/blas.eselect.5 | 34 +++--
41 .../eselect-lapack/eselect-lapack-0.2.ebuild | 27 ++++
42 .../eselect-lapack/files/lapack.eselect-0.2 | 167 ++++++++++++++++++++
43 app-eselect/eselect-lapack/files/lapack.eselect.5 | 26 +++-
44 6 files changed, 434 insertions(+), 16 deletions(-)
45
46 diff --git a/app-eselect/eselect-blas/eselect-blas-0.2.ebuild b/app-eselect/eselect-blas/eselect-blas-0.2.ebuild
47 new file mode 100644
48 index 00000000000..083ca34022d
49 --- /dev/null
50 +++ b/app-eselect/eselect-blas/eselect-blas-0.2.ebuild
51 @@ -0,0 +1,28 @@
52 +# Copyright 1999-2019 Gentoo Authors
53 +# Distributed under the terms of the GNU General Public License v2
54 +
55 +EAPI=7
56 +
57 +DESCRIPTION="BLAS/CBLAS module for eselect"
58 +HOMEPAGE="https://www.gentoo.org"
59 +SRC_URI=""
60 +
61 +LICENSE="GPL-2"
62 +SLOT="0"
63 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris"
64 +IUSE=""
65 +
66 +# Need skel.bash lib
67 +RDEPEND=( ">=app-admin/eselect-1.0.5"
68 + "!app-eselect/eselect-cblas" )
69 +DEPEND="${RDEPEND}"
70 +
71 +S="${WORKDIR}"
72 +
73 +src_install() {
74 + local MODULEDIR="/usr/share/eselect/modules"
75 + local MODULE="blas"
76 + insinto ${MODULEDIR}
77 + newins "${FILESDIR}"/${MODULE}.eselect-${PVR} ${MODULE}.eselect
78 + doman "${FILESDIR}"/blas.eselect.5
79 +}
80
81 diff --git a/app-eselect/eselect-blas/files/blas.eselect-0.2 b/app-eselect/eselect-blas/files/blas.eselect-0.2
82 new file mode 100644
83 index 00000000000..001ddb941e8
84 --- /dev/null
85 +++ b/app-eselect/eselect-blas/files/blas.eselect-0.2
86 @@ -0,0 +1,168 @@
87 +# -*-eselect-*- vim: ft=eselect
88 +# Copyright 2019 Gentoo Foundation
89 +# Distributed under the terms of the GNU GPL version 2 or later
90 +
91 +inherit config tests multilib skel
92 +
93 +MODULE="BLAS/CBLAS"
94 +IFACE="blas"
95 +DESCRIPTION="Manage installed alternatives of $MODULE shared objects"
96 +MAINTAINER="lumin@××××××.org"
97 +VERSION="20190621"
98 +
99 +### helper utility to find all available BLAS/CBLAS implementations
100 +find_targets_in() {
101 + [[ $# -eq 1 ]] || die -q "in which libdir?"
102 +
103 + local cand
104 + for cand in ${EROOT}/etc/env.d/blas/$1/*; do
105 + [[ "config" = $(basename ${cand}) ]] && continue
106 + [[ -r ${cand} ]] && basename ${cand}
107 + done
108 +}
109 +
110 +### helper utility to validate a BLAS/CBLAS library directory
111 +validate_blaslibdir() {
112 + [[ -d $1 ]] || return 2 # dir doesn't exist
113 + [[ -r "${1}/libblas.so.3" ]] && [[ -r "${1}/libblas.so" ]] \
114 + && [[ -r "${1}/libcblas.so.3" ]] && [[ -r "${1}/libcblas.so" ]] \
115 + || return 1
116 +}
117 +
118 +### show action
119 +do_show() {
120 + # do_show -- show both lib64 and lib32 selection
121 + # do_show libxx -- show libxx selection
122 + local libdir cur libdirs=( $(list_libdirs) )
123 +
124 + # if manually specified libdirs
125 + if [[ ! $# -eq 0 ]]; then
126 + for libdir in $@; do
127 + has $libdir ${libdirs[@]} || die -q "invalid libdir '$libdir'!"
128 + done
129 + libdirs=( $@ )
130 + fi
131 +
132 + for libdir in ${libdirs[@]}; do
133 + [[ ! -d ${EROOT}/usr/$libdir ]] && continue
134 + [[ ! -r ${EROOT}/etc/env.d/blas/${libdir}/config ]] && continue
135 + cur=$(load_config ${EROOT}/etc/env.d/blas/${libdir}/config CURRENT)
136 + echo ${libdir}: $cur
137 + done
138 +}
139 +
140 +### list action
141 +do_list() {
142 + local i cur targets
143 + local libdir libdirs=( $(list_libdirs) )
144 +
145 + # if manually specified libdirs
146 + if [[ ! $# -eq 0 ]]; then
147 + for libdir in $@; do
148 + has $libdir ${libdirs[@]} || die -q "invalid libdir '$libdir'!"
149 + done
150 + libdirs=( $@ )
151 + fi
152 +
153 + for libdir in ${libdirs[@]}; do
154 + [[ ! -d ${EROOT}/usr/$libdir ]] || [[ -L ${EROOT}/usr/$libdir ]] && continue
155 + targets=( $(find_targets_in $libdir) )
156 + cur=$(load_config ${EROOT}/etc/env.d/blas/${libdir}/config CURRENT)
157 +
158 + write_list_start "Available BLAS/CBLAS ($libdir) candidates:"
159 + for (( i = 0; i < ${#targets[@]}; i++ )); do
160 + [[ ${targets[i]} = $cur ]] \
161 + && targets[i]=$(highlight_marker "${targets[i]}")
162 + done
163 + write_numbered_list -m "(none found)" "${targets[@]}"
164 + done
165 +}
166 +
167 +### validate action
168 +describe_validate() {
169 + echo "validate candidates and remove invalid ones"
170 +}
171 +
172 +do_validate() {
173 + local i ldpath targets target candidate
174 + local libdir libdirs=( $(list_libdirs) )
175 + for libdir in ${libdirs[@]}; do
176 + [[ ! -d ${EROOT}/usr/$libdir ]] || [[ -L ${EROOT}/usr/$libdir ]] && continue
177 + targets=( $(find_targets_in $libdir) )
178 + for target in ${targets[@]}; do
179 + candidate=${EROOT}/etc/env.d/blas/${libdir}/${target}
180 + ldpath=$(load_config $candidate LDPATH)
181 + if ! validate_blaslibdir $ldpath; then
182 + echo "Removing invalid BLAS/CBLAS candidate ($candidate) ..."
183 + rm -v $candidate
184 + fi
185 + done
186 + done
187 +}
188 +
189 +### set action
190 +
191 +describe_set() {
192 + echo "Activate one of the installed $MODULE implementations"
193 +}
194 +
195 +describe_set_parameters() {
196 + echo "[<libdir>] <implementation>"
197 +}
198 +
199 +describe_set_options() {
200 + echo "libdir: lib64 or lib32. Will use the native one when omitted."
201 + echo "implementation : implementation name or number (from 'list' action)"
202 +}
203 +
204 +do_set() {
205 + local libdirs=( $(list_libdirs) )
206 + local targets libdir ldconf libpath impl
207 +
208 + # check argument existence
209 + [[ $# -eq 1 ]] || [[ $# -eq 2 ]] || \
210 + die -q "Please specify [<libdir>] <impl> to activate!"
211 + # read argumenets
212 + if [[ $# -eq 2 ]]; then libdir="$1"; else libdir="$(get_libdir)"; fi
213 + if [[ $# -eq 2 ]]; then impl="$2"; else impl="$1"; fi
214 + # validate arguments
215 + has "$libdir" "${libdirs[@]}" || die -q "Invalid libdir ($libdir) !"
216 + targets=( $(find_targets_in $libdir) )
217 + if ! has "$impl" "${targets[@]}"; then
218 + if [[ ${impl} -gt 0 ]] && [[ ${impl} -le ${#targets[@]} ]]; then
219 + impl=${targets[(${impl} - 1)]}
220 + else
221 + die -q "Invalid impl ($impl) !"
222 + fi
223 + fi
224 + # store the configuration to env.d
225 + store_config ${EROOT}/etc/env.d/blas/${libdir}/config CURRENT "${impl}"
226 + # generate ld.so.conf file
227 + ldconf="${EROOT}/etc/ld.so.conf.d/81-blas-${libdir}.conf"
228 + libpath=$(load_config ${EROOT}/etc/env.d/blas/${libdir}/${impl} LDPATH)
229 + truncate -s0 $ldconf
230 + echo "# Auto-generated by eselect::blas. DON'T EDIT." >> $ldconf
231 + echo "$libpath" >> $ldconf
232 +
233 + # refresh cache. env-update will call ldconfig (see
234 + # portage::env_update.py) so we don't need to call it explicitly.
235 + env-update
236 +}
237 +
238 +### add action
239 +describe_add_parameters() {
240 + echo "<libdir> <dir> <impl>"
241 +}
242 +
243 +describe_add_options() {
244 + echo "libdir : library directory where $MODULE implementation is installed (lib, lib64, etc.)"
245 + echo "dir : directory containing lib{,c}blas.so{.3}"
246 + echo "impl : name of the $MODULE implementation"
247 +}
248 +
249 +do_add() {
250 + [[ $# -eq 3 ]] \
251 + || die -q "Please specify <libdir> <dir> <impl> to activate!"
252 + validate_blaslibdir $2 || die -q "invalid blas libdir!"
253 + store_config ${EROOT}/etc/env.d/blas/$1/$3 LDPATH $2
254 +}
255
256 diff --git a/app-eselect/eselect-blas/files/blas.eselect.5 b/app-eselect/eselect-blas/files/blas.eselect.5
257 index c9df9fde8d7..9779268bc65 100644
258 --- a/app-eselect/eselect-blas/files/blas.eselect.5
259 +++ b/app-eselect/eselect-blas/files/blas.eselect.5
260 @@ -1,22 +1,22 @@
261 -.TH "ESELECT" "5" "June 2006" "Gentoo Linux" "eselect"
262 +.TH "ESELECT" "5" "June 2019" "Gentoo Linux" "eselect"
263 .SH "NAME"
264 blas.eselect \- The BLAS management module for Gentoo's eselect
265 .SH "SYNOPSIS"
266 \fBeselect blas\fR [\fBhelp\fR|\fBusage\fR]
267 .br
268 -\fBeselect blas\fR \fBlist\fR [\fIoptions\fR]
269 +\fBeselect blas\fR \fBlist\fR [\fIlibdir\fR]
270 .br
271 \fBeselect blas\fR \fBadd\fR
272 .br
273 -\fBeselect blas\fR \fBset\fR \fIimplementation\fR [\fIoptions\fR]
274 +\fBeselect blas\fR \fBset\fR [\fIlibdir\fR] \fIimplementation\fR
275 .br
276 -\fBeselect blas\fR \fBshow\fR [\fIoptions\fR]
277 +\fBeselect blas\fR \fBshow\fR [\fIlibdir\fR]
278
279 .SH "DESCRIPTION"
280 \fBeselect\fR is Gentoo's configuration and management tool. It features
281 modules that care for the individual administrative tasks.
282 .SH "ACTION: LIST"
283 -\fBeselect blas list\fR [\fIoptions\fR]
284 +\fBeselect blas list\fR [\fIlibdir\fR]
285 .br
286 Displays an ordered list of installed BLAS implementations. It distinguishes between versions with different
287 Application Binary Interfaces (e.g. x86/AMD64). Furthermore, it also distinguishes
288 @@ -31,7 +31,7 @@ Installed BLAS for libdir \fBlib\fR
289 [1] atlas *
290 [2] reference
291
292 -Possible \fIoptions\fR to the \fBlist\fR action are restrictions to
293 +Possible \fIlibdir\fR to the \fBlist\fR action are restrictions to
294 handle only certain ABI\-specific library directories. For example,
295
296 \fBeselect blas list lib64\fR
297 @@ -39,7 +39,7 @@ handle only certain ABI\-specific library directories. For example,
298 lists only BLAS implementations found in \fB/usr/lib64\fR.
299
300 .SH "ACTION: SHOW"
301 -\fBeselect blas show\fR [\fIoptions\fR]
302 +\fBeselect blas show\fR [\fIlibdir\fR]
303 .br
304 Shows your system's currently active BLAS implementations.
305
306 @@ -49,17 +49,31 @@ lib: atlas
307 .br
308 lib64: reference
309
310 -The same \fIoptions\fR that apply to the \fBlist\fR action can be used
311 +The same \fIlibdir\fR that apply to the \fBlist\fR action can be used
312 with the \fBshow\fR action to restrict it to given ABIs.
313 .SH "ACTION: SET"
314 -\fBeselect blas set\fR \fIimplementation\fR [\fIoptions\fR]
315 +\fBeselect blas set\fR [\fIlibdir\fR] \fIimplementation\fR
316 .br
317 Sets your system's currently active BLAS implementations to \fIimplementation\fR.
318 -The same \fIoptions\fR that apply to the \fBlist\fR action can be used
319 +The same \fIlibdir\fR that apply to the \fBlist\fR action can be used
320 with the \fBset\fR action to restrict it to given ABIs.
321
322 phi / # eselect blas set atlas
323 +
324 +.SH "ACTION: VALIDATE"
325 +\fBeselect blas validate\fR
326 +.br
327 +Validates BLAS/CBLAS candidates under the /etc/env.d directory and automatically
328 +remove the invalid ones.
329 +
330 +.SH "ACTION: ADD"
331 +\fBeselect blas add\fR \fIlibdir\fR \fIdir\fR \fIimpl\fR
332 +.br
333 +Add a new BLAS/CBLAS implementation.
334 +
335 .SH "AUTHOR"
336 Danny van Dyk <kugelfang@g.o>
337 .br
338 Donnie Berkholz <spyderous@g.o>
339 +.br
340 +Mo Zhou <lumin@××××××.org>
341
342 diff --git a/app-eselect/eselect-lapack/eselect-lapack-0.2.ebuild b/app-eselect/eselect-lapack/eselect-lapack-0.2.ebuild
343 new file mode 100644
344 index 00000000000..5fcf3f21f41
345 --- /dev/null
346 +++ b/app-eselect/eselect-lapack/eselect-lapack-0.2.ebuild
347 @@ -0,0 +1,27 @@
348 +# Copyright 1999-2019 Gentoo Authors
349 +# Distributed under the terms of the GNU General Public License v2
350 +
351 +EAPI=7
352 +
353 +DESCRIPTION="LAPACK module for eselect"
354 +HOMEPAGE="https://www.gentoo.org"
355 +SRC_URI=""
356 +
357 +LICENSE="GPL-2"
358 +SLOT="0"
359 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris"
360 +IUSE=""
361 +
362 +# Need skel.bash lib
363 +RDEPEND=( ">=app-admin/eselect-1.0.5" )
364 +DEPEND="${RDEPEND}"
365 +
366 +S="${WORKDIR}"
367 +
368 +src_install() {
369 + local MODULEDIR="/usr/share/eselect/modules"
370 + local MODULE="lapack"
371 + insinto ${MODULEDIR}
372 + newins "${FILESDIR}"/${MODULE}.eselect-${PVR} ${MODULE}.eselect
373 + doman "${FILESDIR}"/lapack.eselect.5
374 +}
375
376 diff --git a/app-eselect/eselect-lapack/files/lapack.eselect-0.2 b/app-eselect/eselect-lapack/files/lapack.eselect-0.2
377 new file mode 100644
378 index 00000000000..76c038e13f8
379 --- /dev/null
380 +++ b/app-eselect/eselect-lapack/files/lapack.eselect-0.2
381 @@ -0,0 +1,167 @@
382 +# -*-eselect-*- vim: ft=eselect
383 +# Copyright 2019 Gentoo Foundation
384 +# Distributed under the terms of the GNU GPL version 2 or later
385 +
386 +inherit config tests multilib skel
387 +
388 +MODULE="LAPACK"
389 +IFACE="lapack"
390 +DESCRIPTION="Manage installed alternatives of $MODULE shared objects"
391 +MAINTAINER="lumin@××××××.org"
392 +VERSION="20190621"
393 +
394 +### helper utility to find all available LAPACK implementations
395 +find_targets_in() {
396 + [[ $# -eq 1 ]] || die -q "in which libdir?"
397 +
398 + local cand
399 + for cand in ${EROOT}/etc/env.d/lapack/$1/*; do
400 + [[ "config" = $(basename ${cand}) ]] && continue
401 + [[ -r ${cand} ]] && basename ${cand}
402 + done
403 +}
404 +
405 +### helper utility to validate a LAPACK library directory
406 +validate_lapacklibdir() {
407 + [[ -d $1 ]] || return 2 # dir doesn't exist
408 + [[ -r "${1}/liblapack.so.3" ]] && [[ -r "${1}/liblapack.so" ]] \
409 + || return 1
410 +}
411 +
412 +### show action
413 +do_show() {
414 + # do_show -- show both lib64 and lib32 selection
415 + # do_show libxx -- show libxx selection
416 + local libdir cur libdirs=( $(list_libdirs) )
417 +
418 + # if manually specified libdirs
419 + if [[ ! $# -eq 0 ]]; then
420 + for libdir in $@; do
421 + has $libdir ${libdirs[@]} || die -q "invalid libdir '$libdir'!"
422 + done
423 + libdirs=( $@ )
424 + fi
425 +
426 + for libdir in ${libdirs[@]}; do
427 + [[ ! -d ${EROOT}/usr/$libdir ]] && continue
428 + [[ ! -r ${EROOT}/etc/env.d/lapack/${libdir}/config ]] && continue
429 + cur=$(load_config ${EROOT}/etc/env.d/lapack/${libdir}/config CURRENT)
430 + echo ${libdir}: $cur
431 + done
432 +}
433 +
434 +### list action
435 +do_list() {
436 + local i cur targets
437 + local libdir libdirs=( $(list_libdirs) )
438 +
439 + # if manually specified libdirs
440 + if [[ ! $# -eq 0 ]]; then
441 + for libdir in $@; do
442 + has $libdir ${libdirs[@]} || die -q "invalid libdir '$libdir'!"
443 + done
444 + libdirs=( $@ )
445 + fi
446 +
447 + for libdir in ${libdirs[@]}; do
448 + [[ ! -d ${EROOT}/usr/$libdir ]] || [[ -L ${EROOT}/usr/$libdir ]] && continue
449 + targets=( $(find_targets_in $libdir) )
450 + cur=$(load_config ${EROOT}/etc/env.d/lapack/${libdir}/config CURRENT)
451 +
452 + write_list_start "Available LAPACK ($libdir) candidates:"
453 + for (( i = 0; i < ${#targets[@]}; i++ )); do
454 + [[ ${targets[i]} = $cur ]] \
455 + && targets[i]=$(highlight_marker "${targets[i]}")
456 + done
457 + write_numbered_list -m "(none found)" "${targets[@]}"
458 + done
459 +}
460 +
461 +### validate action
462 +describe_validate() {
463 + echo "validate candidates and remove invalid ones"
464 +}
465 +
466 +do_validate() {
467 + local i ldpath targets target candidate
468 + local libdir libdirs=( $(list_libdirs) )
469 + for libdir in ${libdirs[@]}; do
470 + [[ ! -d ${EROOT}/usr/$libdir ]] || [[ -L ${EROOT}/usr/$libdir ]] && continue
471 + targets=( $(find_targets_in $libdir) )
472 + for target in ${targets[@]}; do
473 + candidate=${EROOT}/etc/env.d/lapack/${libdir}/${target}
474 + ldpath=$(load_config $candidate LDPATH)
475 + if ! validate_lapacklibdir $ldpath; then
476 + echo "Removing invalid LAPACK candidate ($candidate) ..."
477 + rm -v $candidate
478 + fi
479 + done
480 + done
481 +}
482 +
483 +### set action
484 +
485 +describe_set() {
486 + echo "Activate one of the installed $MODULE implementations"
487 +}
488 +
489 +describe_set_parameters() {
490 + echo "[<libdir>] <implementation>"
491 +}
492 +
493 +describe_set_options() {
494 + echo "libdir: lib64 or lib32. Will use the native one when omitted."
495 + echo "implementation : implementation name or number (from 'list' action)"
496 +}
497 +
498 +do_set() {
499 + local libdirs=( $(list_libdirs) )
500 + local targets libdir ldconf libpath impl
501 +
502 + # check argument existence
503 + [[ $# -eq 1 ]] || [[ $# -eq 2 ]] || \
504 + die -q "Please specify [<libdir>] <impl> to activate!"
505 + # read argumenets
506 + if [[ $# -eq 2 ]]; then libdir="$1"; else libdir="$(get_libdir)"; fi
507 + if [[ $# -eq 2 ]]; then impl="$2"; else impl="$1"; fi
508 + # validate arguments
509 + has "$libdir" "${libdirs[@]}" || die -q "Invalid libdir ($libdir) !"
510 + targets=( $(find_targets_in $libdir) )
511 + if ! has "$impl" "${targets[@]}"; then
512 + if [[ ${impl} -gt 0 ]] && [[ ${impl} -le ${#targets[@]} ]]; then
513 + impl=${targets[(${impl} - 1)]}
514 + else
515 + die -q "Invalid impl ($impl) !"
516 + fi
517 + fi
518 + # store the configuration to env.d
519 + store_config ${EROOT}/etc/env.d/lapack/${libdir}/config CURRENT "${impl}"
520 + # generate ld.so.conf file
521 + ldconf="${EROOT}/etc/ld.so.conf.d/82-lapack-${libdir}.conf"
522 + libpath=$(load_config ${EROOT}/etc/env.d/lapack/${libdir}/${impl} LDPATH)
523 + truncate -s0 $ldconf
524 + echo "# Auto-generated by eselect::lapack. DON'T EDIT." >> $ldconf
525 + echo "$libpath" >> $ldconf
526 +
527 + # refresh cache. env-update will call ldconfig (see
528 + # portage::env_update.py) so we don't need to call it explicitly.
529 + env-update
530 +}
531 +
532 +### add action
533 +describe_add_parameters() {
534 + echo "<libdir> <dir> <impl>"
535 +}
536 +
537 +describe_add_options() {
538 + echo "libdir : library directory where $MODULE implementation is installed (lib, lib64, etc.)"
539 + echo "dir : directory containing liblapack.so{.3}"
540 + echo "impl : name of the $MODULE implementation"
541 +}
542 +
543 +do_add() {
544 + [[ $# -eq 3 ]] \
545 + || die -q "Please specify <libdir> <dir> <impl> to activate!"
546 + validate_lapacklibdir $2 || die -q "invalid lapack libdir!"
547 + store_config ${EROOT}/etc/env.d/lapack/$1/$3 LDPATH $2
548 +}
549
550 diff --git a/app-eselect/eselect-lapack/files/lapack.eselect.5 b/app-eselect/eselect-lapack/files/lapack.eselect.5
551 index 92730a7ac85..4a9b7bda213 100644
552 --- a/app-eselect/eselect-lapack/files/lapack.eselect.5
553 +++ b/app-eselect/eselect-lapack/files/lapack.eselect.5
554 @@ -1,22 +1,22 @@
555 -.TH "ESELECT" "5" "June 2006" "Gentoo Linux" "eselect"
556 +.TH "ESELECT" "5" "June 2019" "Gentoo Linux" "eselect"
557 .SH "NAME"
558 lapack.eselect \- The LAPACK management module for Gentoo's eselect
559 .SH "SYNOPSIS"
560 \fBeselect lapack\fR [\fBhelp\fR|\fBusage\fR]
561 .br
562 -\fBeselect lapack\fR \fBlist\fR [\fIoptions\fR]
563 +\fBeselect lapack\fR \fBlist\fR [\fIlibdir\fR]
564 .br
565 \fBeselect lapack\fR \fBadd\fR
566 .br
567 -\fBeselect lapack\fR \fBset\fR \fIimplementation\fR [\fIoptions\fR]
568 +\fBeselect lapack\fR \fBset\fR [\fIoptions\fR] \fIimplementation\fR
569 .br
570 -\fBeselect lapack\fR \fBshow\fR [\fIoptions\fR]
571 +\fBeselect lapack\fR \fBshow\fR [\fIlibdir\fR]
572
573 .SH "DESCRIPTION"
574 \fBeselect\fR is Gentoo's configuration and management tool. It features
575 modules that care for the individual administrative tasks.
576 .SH "ACTION: LIST"
577 -\fBeselect lapack list\fR [\fIoptions\fR]
578 +\fBeselect lapack list\fR [\fIlibdir\fR]
579 .br
580 Displays an ordered list of installed LAPACK implementations. It distinguishes between versions with different
581 Application Binary Interfaces (e.g. x86/AMD64). Furthermore, it also distinguishes
582 @@ -39,7 +39,7 @@ handle only certain ABI\-specific library directories. For example,
583 lists only LAPACK implementations found in \fB/usr/lib64\fR.
584
585 .SH "ACTION: SHOW"
586 -\fBeselect lapack show\fR [\fIoptions\fR]
587 +\fBeselect lapack show\fR [\fIlibdir\fR]
588 .br
589 Shows your system's currently active LAPACK implementations.
590
591 @@ -59,7 +59,21 @@ The same \fIoptions\fR that apply to the \fBlist\fR action can be used
592 with the \fBset\fR action to restrict it to given ABIs.
593
594 phi / # eselect lapack set atlas
595 +
596 +.SH "ACTION: VALIDATE"
597 +\fBeselect lapack validate\fR
598 +.br
599 +Validates LAPACK candidates under the /etc/env.d directory and automatically
600 +remove the invalid ones.
601 +
602 +.SH "ACTION: ADD"
603 +\fBeselect lapack add\fR \fIlibdir\fR \fIdir\fR \fIimpl\fR
604 +.br
605 +Add a new LAPACK implementation.
606 +
607 .SH "AUTHOR"
608 Danny van Dyk <kugelfang@g.o>
609 .br
610 Donnie Berkholz <spyderous@g.o>
611 +.br
612 +Mo Zhou <lumin@××××××.org>