summaryrefslogtreecommitdiff
path: root/app-eselect/eselect-lapack
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-03-19 00:32:54 +0000
committerV3n3RiX <venerix@koprulu.sector>2023-03-19 00:32:54 +0000
commit434fbe89e81a1fe06d92676be72ab7f862cc3f53 (patch)
tree7ed0f70fded2af7cbc43e42097f4cd2cebd8c845 /app-eselect/eselect-lapack
parentcd0d9000770337b445051f1852fe3971ceb7a6e2 (diff)
gentoo auto-resync : 19:03:2023 - 00:32:54
Diffstat (limited to 'app-eselect/eselect-lapack')
-rw-r--r--app-eselect/eselect-lapack/Manifest2
-rw-r--r--app-eselect/eselect-lapack/eselect-lapack-0.3.ebuild27
-rw-r--r--app-eselect/eselect-lapack/files/lapack.eselect-0.3167
3 files changed, 196 insertions, 0 deletions
diff --git a/app-eselect/eselect-lapack/Manifest b/app-eselect/eselect-lapack/Manifest
index 7c1d1803de09..6335e1e39d54 100644
--- a/app-eselect/eselect-lapack/Manifest
+++ b/app-eselect/eselect-lapack/Manifest
@@ -1,4 +1,6 @@
AUX lapack.eselect-0.2 4893 BLAKE2B 45fe2cd27bc259d406e06900dd36cff0071f2221a6dcbf2b7772e625fd9b58b492720ae73395ca199b30ecde6a8da55f71534c4f4a117c1f5d5ca9b03166898e SHA512 eb974937b9e2b67abdd618aece834bb8fc32f15b0d943dace66dd982dfd39e66a3a05bc6f71fc0aa7e4e6e595deeee601370cbc0b812996ded938e47784415cc
+AUX lapack.eselect-0.3 4935 BLAKE2B 393418247b0ce003253de31246f051cef6fb285ea26d31639c621bf671cc52ed4f129d58bb3dbe7d0508cf617c9031e365f43eab7d8677b6154bdad4a15bc90e SHA512 b216333b6ef5dd7beee0bdc001e6a5732f2a76235c5fd9fe54fb54d8bf06cddcacfb7033eea2a6b6beb72a19e6c6704ae808cb97c8afe2348c124af543409c9d
AUX lapack.eselect.5 2406 BLAKE2B 12da8dafd86ee178455de3476bfd6f4b2f24318244c4b387b46e45ea7a0b3ed4f33b05207f3f1201f17af4bea2a01798d6de0eb579db3503d27ed3d90f8edec7 SHA512 8659833ef7ff6e78d0592bb2ea34f04647fda68b388d60f7a39f0cd21dc2c5d198b369aae14f2d742d6c6a77cb3da9a46d1ea34a2ee8d403d5faab537dd7b940
EBUILD eselect-lapack-0.2.ebuild 652 BLAKE2B 7b80b7ccd2b86df8d57c24e65187a849a70b8f8660a6e2dce2a8f28f31d5beeb6271c9a23e169b74f3ac3d1ff78252d11eab0ddd7adf14c90195b631bee5a2f9 SHA512 7191db8ed3c6b96d189e4ea8c52e5e730f3bd019ee4968920c629428408c5164bcb64572c8b6fb1b84dba8dba2f5ed553b8f8c022cd028b440abf4cab3900412
+EBUILD eselect-lapack-0.3.ebuild 660 BLAKE2B f4ead98a8a71c68ab105ff008f9b2d3db429d21499fee27c032089bf64bb00181bdede6e719628625981d2b0be2684d6903ace2fdc53bfb11b843add0bba08dd SHA512 77292ac98a1a26aaf47887b36a77d7f159f5fac9a1e9bde6000e5099b524307530f812d6de11529121931b72056363c91b51cf11110d48427ea068c8a93968d6
MISC metadata.xml 278 BLAKE2B ec2d276da53ec73b30c5f3c1a592d84055592026a448ffdc152835499337f7470cf92d3343f3eca3ec55b44c307878a295a55af0c3d142ef98b1cc892594f187 SHA512 e3ef5c31e448eb600e79d31d402e0822589f5ed22e61df0b45b7a656b6bb0db16d353249debcc480cf6fa0bdcf5f81b360a6e28c796a3dcf432f42f03ab75e71
diff --git a/app-eselect/eselect-lapack/eselect-lapack-0.3.ebuild b/app-eselect/eselect-lapack/eselect-lapack-0.3.ebuild
new file mode 100644
index 000000000000..ace0c922c6fa
--- /dev/null
+++ b/app-eselect/eselect-lapack/eselect-lapack-0.3.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="LAPACK module for eselect"
+HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+IUSE=""
+
+# Need skel.bash lib
+RDEPEND=( ">=app-admin/eselect-1.0.5" )
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+src_install() {
+ local MODULEDIR="/usr/share/eselect/modules"
+ local MODULE="lapack"
+ insinto ${MODULEDIR}
+ newins "${FILESDIR}"/${MODULE}.eselect-${PVR} ${MODULE}.eselect
+ doman "${FILESDIR}"/lapack.eselect.5
+}
diff --git a/app-eselect/eselect-lapack/files/lapack.eselect-0.3 b/app-eselect/eselect-lapack/files/lapack.eselect-0.3
new file mode 100644
index 000000000000..f3fd6619f22f
--- /dev/null
+++ b/app-eselect/eselect-lapack/files/lapack.eselect-0.3
@@ -0,0 +1,167 @@
+# -*-eselect-*- vim: ft=eselect
+# Copyright 2019-2023 Gentoo Authors
+# Distributed under the terms of the GNU GPL version 2 or later
+
+inherit config tests multilib skel
+
+MODULE="LAPACK"
+IFACE="lapack"
+DESCRIPTION="Manage installed alternatives of $MODULE shared objects"
+MAINTAINER="lumin@debian.org"
+VERSION="0.3"
+
+### helper utility to find all available LAPACK implementations
+find_targets_in() {
+ [[ $# -eq 1 ]] || die -q "in which libdir?"
+
+ local cand
+ for cand in "${EROOT}/etc/env.d/lapack/$1"/*; do
+ [[ "config" = $(basename ${cand}) ]] && continue
+ [[ -r ${cand} ]] && basename ${cand}
+ done
+}
+
+### helper utility to validate a LAPACK library directory
+validate_lapacklibdir() {
+ [[ -d $1 ]] || return 2 # dir doesn't exist
+ [[ -r "${1}/liblapack.so.3" ]] && [[ -r "${1}/liblapack.so" ]] \
+ || return 1
+}
+
+### show action
+do_show() {
+ # do_show -- show both lib64 and lib32 selection
+ # do_show libxx -- show libxx selection
+ local libdir cur libdirs=( $(list_libdirs) )
+
+ # if manually specified libdirs
+ if [[ ! $# -eq 0 ]]; then
+ for libdir in $@; do
+ has $libdir ${libdirs[@]} || die -q "invalid libdir '$libdir'!"
+ done
+ libdirs=( $@ )
+ fi
+
+ for libdir in ${libdirs[@]}; do
+ [[ ! -d ${EROOT}/usr/$libdir ]] && continue
+ [[ ! -r ${EROOT}/etc/env.d/lapack/${libdir}/config ]] && continue
+ cur=$(load_config "${EROOT}"/etc/env.d/lapack/${libdir}/config CURRENT)
+ echo ${libdir}: $cur
+ done
+}
+
+### list action
+do_list() {
+ local i cur targets
+ local libdir libdirs=( $(list_libdirs) )
+
+ # if manually specified libdirs
+ if [[ ! $# -eq 0 ]]; then
+ for libdir in $@; do
+ has $libdir ${libdirs[@]} || die -q "invalid libdir '$libdir'!"
+ done
+ libdirs=( $@ )
+ fi
+
+ for libdir in ${libdirs[@]}; do
+ [[ ! -d ${EROOT}/usr/$libdir ]] || [[ -L ${EROOT}/usr/$libdir ]] && continue
+ targets=( $(find_targets_in $libdir) )
+ cur=$(load_config "${EROOT}"/etc/env.d/lapack/${libdir}/config CURRENT)
+
+ write_list_start "Available LAPACK ($libdir) candidates:"
+ for (( i = 0; i < ${#targets[@]}; i++ )); do
+ [[ ${targets[i]} = $cur ]] \
+ && targets[i]=$(highlight_marker "${targets[i]}")
+ done
+ write_numbered_list -m "(none found)" "${targets[@]}"
+ done
+}
+
+### validate action
+describe_validate() {
+ echo "validate candidates and remove invalid ones"
+}
+
+do_validate() {
+ local i ldpath targets target candidate
+ local libdir libdirs=( $(list_libdirs) )
+ for libdir in ${libdirs[@]}; do
+ [[ ! -d ${EROOT}/usr/$libdir ]] || [[ -L ${EROOT}/usr/$libdir ]] && continue
+ targets=( $(find_targets_in $libdir) )
+ for target in ${targets[@]}; do
+ candidate=${EROOT}/etc/env.d/lapack/${libdir}/${target}
+ ldpath=$(load_config "$candidate" LDPATH)
+ if ! validate_lapacklibdir "${ROOT}/$ldpath"; then
+ echo "Removing invalid LAPACK candidate ($candidate) ..."
+ rm -v "$candidate"
+ fi
+ done
+ done
+}
+
+### set action
+
+describe_set() {
+ echo "Activate one of the installed $MODULE implementations"
+}
+
+describe_set_parameters() {
+ echo "[<libdir>] <implementation>"
+}
+
+describe_set_options() {
+ echo "libdir: lib64 or lib32. Will use the native one when omitted."
+ echo "implementation : implementation name or number (from 'list' action)"
+}
+
+do_set() {
+ local libdirs=( $(list_libdirs) )
+ local targets libdir ldconf libpath impl
+
+ # check argument existence
+ [[ $# -eq 1 ]] || [[ $# -eq 2 ]] || \
+ die -q "Please specify [<libdir>] <impl> to activate!"
+ # read argumenets
+ if [[ $# -eq 2 ]]; then libdir="$1"; else libdir="$(get_libdir)"; fi
+ if [[ $# -eq 2 ]]; then impl="$2"; else impl="$1"; fi
+ # validate arguments
+ has "$libdir" "${libdirs[@]}" || die -q "Invalid libdir ($libdir) !"
+ targets=( $(find_targets_in $libdir) )
+ if ! has "$impl" "${targets[@]}"; then
+ if [[ ${impl} -gt 0 ]] && [[ ${impl} -le ${#targets[@]} ]]; then
+ impl=${targets[(${impl} - 1)]}
+ else
+ die -q "Invalid impl ($impl) !"
+ fi
+ fi
+ # store the configuration to env.d
+ store_config "${EROOT}"/etc/env.d/lapack/${libdir}/config CURRENT "${impl}"
+ # generate ld.so.conf file
+ ldconf="${EROOT}/etc/ld.so.conf.d/82-lapack-${libdir}.conf"
+ libpath=$(load_config ${EROOT}/etc/env.d/lapack/${libdir}/${impl} LDPATH)
+ truncate -s0 "$ldconf"
+ echo "# Auto-generated by eselect::lapack. DON'T EDIT." >> "$ldconf"
+ echo "$libpath" >> "$ldconf"
+
+ # refresh cache. env-update will call ldconfig (see
+ # portage::env_update.py) so we don't need to call it explicitly.
+ env-update
+}
+
+### add action
+describe_add_parameters() {
+ echo "<libdir> <dir> <impl>"
+}
+
+describe_add_options() {
+ echo "libdir : library directory where $MODULE implementation is installed (lib, lib64, etc.)"
+ echo "dir : directory containing liblapack.so{.3}"
+ echo "impl : name of the $MODULE implementation"
+}
+
+do_add() {
+ [[ $# -eq 3 ]] \
+ || die -q "Please specify <libdir> <dir> <impl> to activate!"
+ validate_lapacklibdir "${ROOT}/$2" || die -q "invalid lapack libdir!"
+ store_config "${EROOT}/etc/env.d/lapack/$1/$3" LDPATH "$2"
+}