diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-03-19 00:32:54 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-03-19 00:32:54 +0000 |
commit | 434fbe89e81a1fe06d92676be72ab7f862cc3f53 (patch) | |
tree | 7ed0f70fded2af7cbc43e42097f4cd2cebd8c845 /app-eselect/eselect-blas | |
parent | cd0d9000770337b445051f1852fe3971ceb7a6e2 (diff) |
gentoo auto-resync : 19:03:2023 - 00:32:54
Diffstat (limited to 'app-eselect/eselect-blas')
-rw-r--r-- | app-eselect/eselect-blas/Manifest | 2 | ||||
-rw-r--r-- | app-eselect/eselect-blas/eselect-blas-0.3.ebuild | 28 | ||||
-rw-r--r-- | app-eselect/eselect-blas/files/blas.eselect-0.3 | 168 |
3 files changed, 198 insertions, 0 deletions
diff --git a/app-eselect/eselect-blas/Manifest b/app-eselect/eselect-blas/Manifest index 3f6a32640919..df97f51acd23 100644 --- a/app-eselect/eselect-blas/Manifest +++ b/app-eselect/eselect-blas/Manifest @@ -1,6 +1,8 @@ AUX blas.eselect-0.1 350 BLAKE2B a21d38edf3188c2f26d384010d070048c0df19dcf87338ecfa1c08b9667ae97bb2875d6ae9958d797a416524de28540a4a95597c36d25df340bbe956ed95d342 SHA512 25f9250c3fae6d31871ca08260f1cd6597d9263fe51d3d696dd55c8648b604ea52b705dc5d128c7d9677cc1cd63f9aa1e31e124bdf52374eaf02f991db0045f2 AUX blas.eselect-0.2 4948 BLAKE2B 1d96b09958669a85b6276ebe29f146cd592c141b11454c0c981c24e6a93f17779399300bfe540aa89c11f2399ef6a716728e3e2297e0cab8a1652b96a0c5ca94 SHA512 f312bb665fd70ec479fcd1e2fe11b50ccf8b6e80b8513e41a648328f521e7fc0639e83bc615afa177f780d3ec3d37ebee0c4755d2d03a3a604d71562791b4b11 +AUX blas.eselect-0.3 4990 BLAKE2B 16ae6d336c4c19e92c3b2db9c2fd5d23721921e7141cb3eeab96975da88fb07d034444f1cbc623d5b597b078d9af1783ee21b7d7e76dfc6f7a8c577692871216 SHA512 0eca72ca526015fccf3285d8f715a61aa208c293e38bb2b25afc7723e75a0469cb5f711de186b779034567a31dddb8f6f31f4d5b5b83edb9c9fd03ea377fd1ee AUX blas.eselect.5 2368 BLAKE2B 8545c10ff73bafc4b9abdaab6410e0cba4d543ebcb7615f96357c72b63253c48158b08f85693005e8793982e86fa1e47c518d90a9302eb15cab6da84e584bf87 SHA512 46a423dc25d6f44769f92babcd8c98a8fa6f19bd64717fc894b9be1984e5f7ea4e00a458d9dd25724fd40377fa633b7f9c513878000a653b386f6be75532f531 EBUILD eselect-blas-0.1.ebuild 689 BLAKE2B 23bbb495d1f9342c175b3ecc140826651ec58e023651956134a34a60f2a314d050ad347bad30ec148162df420a905dd176723e4722b5ee771cbc9fcc62ba4fbb SHA512 5755c6c01cad17e28223072a16277f9dd98fbec7e90eefb8056b5f18b213d68aa474a28419b4104b5a94d2e8f5ff7623808c65d45ea22d1196cc0af3008caded EBUILD eselect-blas-0.2.ebuild 685 BLAKE2B a4dc30df8aeae2485487faaa03d870e3883af90dc02fb6d81cb00e03d0aca47488411361ca8a4f3ee2b649b7f259247b289bcd94369763e675d0f1b0cfd2bfd9 SHA512 636e633f7db1492622119bd34c8c231f0629525f5eafba8808b4dcd4a8d8848fe43867883ac80037b4dd7c20484e1ba4cea89870764476384db84fd8fcbe1670 +EBUILD eselect-blas-0.3.ebuild 693 BLAKE2B 0a2d22dfa89899ec47e3850e49812943b1fb9905a7250fce355075e9aaf78b41afadcc53265cb610f4b4d993772b79da02e5734bd3d70d39f3b606452209422b SHA512 9c0f69a02694e8ee9d7b5f9971e1e7ec58262ec5cc1e2db578001e7fc672c0350255a6ed46245724fac58a2a585694823ce7c98f9b77aae255dfabc7fa181900 MISC metadata.xml 278 BLAKE2B ec2d276da53ec73b30c5f3c1a592d84055592026a448ffdc152835499337f7470cf92d3343f3eca3ec55b44c307878a295a55af0c3d142ef98b1cc892594f187 SHA512 e3ef5c31e448eb600e79d31d402e0822589f5ed22e61df0b45b7a656b6bb0db16d353249debcc480cf6fa0bdcf5f81b360a6e28c796a3dcf432f42f03ab75e71 diff --git a/app-eselect/eselect-blas/eselect-blas-0.3.ebuild b/app-eselect/eselect-blas/eselect-blas-0.3.ebuild new file mode 100644 index 000000000000..2dfac934a3c7 --- /dev/null +++ b/app-eselect/eselect-blas/eselect-blas-0.3.ebuild @@ -0,0 +1,28 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +DESCRIPTION="BLAS/CBLAS 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" + "!app-eselect/eselect-cblas" ) +DEPEND="${RDEPEND}" + +S="${WORKDIR}" + +src_install() { + local MODULEDIR="/usr/share/eselect/modules" + local MODULE="blas" + insinto ${MODULEDIR} + newins "${FILESDIR}"/${MODULE}.eselect-${PVR} ${MODULE}.eselect + doman "${FILESDIR}"/blas.eselect.5 +} diff --git a/app-eselect/eselect-blas/files/blas.eselect-0.3 b/app-eselect/eselect-blas/files/blas.eselect-0.3 new file mode 100644 index 000000000000..8941f720054f --- /dev/null +++ b/app-eselect/eselect-blas/files/blas.eselect-0.3 @@ -0,0 +1,168 @@ +# -*-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="BLAS/CBLAS" +IFACE="blas" +DESCRIPTION="Manage installed alternatives of $MODULE shared objects" +MAINTAINER="lumin@debian.org" +VERSION="0.3" + +### helper utility to find all available BLAS/CBLAS implementations +find_targets_in() { + [[ $# -eq 1 ]] || die -q "in which libdir?" + + local cand + for cand in "${EROOT}/etc/env.d/blas/$1"/*; do + [[ "config" = $(basename ${cand}) ]] && continue + [[ -r ${cand} ]] && basename ${cand} + done +} + +### helper utility to validate a BLAS/CBLAS library directory +validate_blaslibdir() { + [[ -d $1 ]] || return 2 # dir doesn't exist + [[ -r "${1}/libblas.so.3" ]] && [[ -r "${1}/libblas.so" ]] \ + && [[ -r "${1}/libcblas.so.3" ]] && [[ -r "${1}/libcblas.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/blas/${libdir}/config ]] && continue + cur=$(load_config "${EROOT}"/etc/env.d/blas/${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/blas/${libdir}/config CURRENT) + + write_list_start "Available BLAS/CBLAS ($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/blas/${libdir}/${target} + ldpath=$(load_config "$candidate" LDPATH) + if ! validate_blaslibdir "${ROOT}/$ldpath"; then + echo "Removing invalid BLAS/CBLAS 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/blas/${libdir}/config CURRENT "${impl}" + # generate ld.so.conf file + ldconf="${EROOT}/etc/ld.so.conf.d/81-blas-${libdir}.conf" + libpath=$(load_config ${EROOT}/etc/env.d/blas/${libdir}/${impl} LDPATH) + truncate -s0 "$ldconf" + echo "# Auto-generated by eselect::blas. 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 lib{,c}blas.so{.3}" + echo "impl : name of the $MODULE implementation" +} + +do_add() { + [[ $# -eq 3 ]] \ + || die -q "Please specify <libdir> <dir> <impl> to activate!" + validate_blaslibdir "${ROOT}/$2" || die -q "invalid blas libdir!" + store_config "${EROOT}/etc/env.d/blas/$1/$3" LDPATH "$2" +} |