From 3538fd4133fc48ea0da93b43b9344c843dfb3ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B8=D1=80=D0=B5=D1=86=D0=BA=D0=B8=D0=B9=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=85=D0=B0=D0=B8=D0=BB?= Date: Tue, 19 Nov 2019 10:39:30 +0300 Subject: [PATCH] =?UTF-8?q?app-eselect/eselect-blas,app-eselect/eselect-la?= =?UTF-8?q?pack:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=20DEPEND=20=D0=B2=20ebuild=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0?= =?UTF-8?q?=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eselect-blas/eselect-blas-0.2-r1.ebuild | 28 +++ .../eselect-blas/files/blas.eselect-0.2 | 168 ++++++++++++++++++ app-eselect/eselect-blas/files/blas.eselect.5 | 79 ++++++++ app-eselect/eselect-blas/metadata.xml | 8 + .../eselect-lapack-0.2-r1.ebuild | 27 +++ .../eselect-lapack/files/lapack.eselect-0.2 | 167 +++++++++++++++++ .../eselect-lapack/files/lapack.eselect.5 | 79 ++++++++ app-eselect/eselect-lapack/metadata.xml | 8 + 8 files changed, 564 insertions(+) create mode 100644 app-eselect/eselect-blas/eselect-blas-0.2-r1.ebuild create mode 100644 app-eselect/eselect-blas/files/blas.eselect-0.2 create mode 100644 app-eselect/eselect-blas/files/blas.eselect.5 create mode 100644 app-eselect/eselect-blas/metadata.xml create mode 100644 app-eselect/eselect-lapack/eselect-lapack-0.2-r1.ebuild create mode 100644 app-eselect/eselect-lapack/files/lapack.eselect-0.2 create mode 100644 app-eselect/eselect-lapack/files/lapack.eselect.5 create mode 100644 app-eselect/eselect-lapack/metadata.xml diff --git a/app-eselect/eselect-blas/eselect-blas-0.2-r1.ebuild b/app-eselect/eselect-blas/eselect-blas-0.2-r1.ebuild new file mode 100644 index 000000000..f1b45b6aa --- /dev/null +++ b/app-eselect/eselect-blas/eselect-blas-0.2-r1.ebuild @@ -0,0 +1,28 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +DESCRIPTION="BLAS/CBLAS module for eselect" +HOMEPAGE="https://www.gentoo.org" +SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~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.2 b/app-eselect/eselect-blas/files/blas.eselect-0.2 new file mode 100644 index 000000000..001ddb941 --- /dev/null +++ b/app-eselect/eselect-blas/files/blas.eselect-0.2 @@ -0,0 +1,168 @@ +# -*-eselect-*- vim: ft=eselect +# Copyright 2019 Gentoo Foundation +# 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="20190621" + +### 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 $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 "[] " +} + +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 [] 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 " " +} + +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 to activate!" + validate_blaslibdir $2 || die -q "invalid blas libdir!" + store_config ${EROOT}/etc/env.d/blas/$1/$3 LDPATH $2 +} diff --git a/app-eselect/eselect-blas/files/blas.eselect.5 b/app-eselect/eselect-blas/files/blas.eselect.5 new file mode 100644 index 000000000..9779268bc --- /dev/null +++ b/app-eselect/eselect-blas/files/blas.eselect.5 @@ -0,0 +1,79 @@ +.TH "ESELECT" "5" "June 2019" "Gentoo Linux" "eselect" +.SH "NAME" +blas.eselect \- The BLAS management module for Gentoo's eselect +.SH "SYNOPSIS" +\fBeselect blas\fR [\fBhelp\fR|\fBusage\fR] +.br +\fBeselect blas\fR \fBlist\fR [\fIlibdir\fR] +.br +\fBeselect blas\fR \fBadd\fR +.br +\fBeselect blas\fR \fBset\fR [\fIlibdir\fR] \fIimplementation\fR +.br +\fBeselect blas\fR \fBshow\fR [\fIlibdir\fR] + +.SH "DESCRIPTION" +\fBeselect\fR is Gentoo's configuration and management tool. It features +modules that care for the individual administrative tasks. +.SH "ACTION: LIST" +\fBeselect blas list\fR [\fIlibdir\fR] +.br +Displays an ordered list of installed BLAS implementations. It distinguishes between versions with different +Application Binary Interfaces (e.g. x86/AMD64). Furthermore, it also distinguishes +between interfaces to high-level programming languages. Each line holds +a number and the implementation's name. An asterisk next to one of the list +elements denotes an active implementation. + +phi / # eselect blas list +.br +Installed BLAS for libdir \fBlib\fR +.br + [1] atlas * + [2] reference + +Possible \fIlibdir\fR to the \fBlist\fR action are restrictions to +handle only certain ABI\-specific library directories. For example, + +\fBeselect blas list lib64\fR + +lists only BLAS implementations found in \fB/usr/lib64\fR. + +.SH "ACTION: SHOW" +\fBeselect blas show\fR [\fIlibdir\fR] +.br +Shows your system's currently active BLAS implementations. + +phi / # eselect blas show +.br +lib: atlas +.br +lib64: reference + +The same \fIlibdir\fR that apply to the \fBlist\fR action can be used +with the \fBshow\fR action to restrict it to given ABIs. +.SH "ACTION: SET" +\fBeselect blas set\fR [\fIlibdir\fR] \fIimplementation\fR +.br +Sets your system's currently active BLAS implementations to \fIimplementation\fR. +The same \fIlibdir\fR that apply to the \fBlist\fR action can be used +with the \fBset\fR action to restrict it to given ABIs. + +phi / # eselect blas set atlas + +.SH "ACTION: VALIDATE" +\fBeselect blas validate\fR +.br +Validates BLAS/CBLAS candidates under the /etc/env.d directory and automatically +remove the invalid ones. + +.SH "ACTION: ADD" +\fBeselect blas add\fR \fIlibdir\fR \fIdir\fR \fIimpl\fR +.br +Add a new BLAS/CBLAS implementation. + +.SH "AUTHOR" +Danny van Dyk +.br +Donnie Berkholz +.br +Mo Zhou diff --git a/app-eselect/eselect-blas/metadata.xml b/app-eselect/eselect-blas/metadata.xml new file mode 100644 index 000000000..0c6991d79 --- /dev/null +++ b/app-eselect/eselect-blas/metadata.xml @@ -0,0 +1,8 @@ + + + + + sci@gentoo.org + Gentoo Science Project + + diff --git a/app-eselect/eselect-lapack/eselect-lapack-0.2-r1.ebuild b/app-eselect/eselect-lapack/eselect-lapack-0.2-r1.ebuild new file mode 100644 index 000000000..dcfb2bdd3 --- /dev/null +++ b/app-eselect/eselect-lapack/eselect-lapack-0.2-r1.ebuild @@ -0,0 +1,27 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +DESCRIPTION="LAPACK module for eselect" +HOMEPAGE="https://www.gentoo.org" +SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="alpha amd64 ~arm ~arm64 hppa ~ia64 ~mips ppc ppc64 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.2 b/app-eselect/eselect-lapack/files/lapack.eselect-0.2 new file mode 100644 index 000000000..76c038e13 --- /dev/null +++ b/app-eselect/eselect-lapack/files/lapack.eselect-0.2 @@ -0,0 +1,167 @@ +# -*-eselect-*- vim: ft=eselect +# Copyright 2019 Gentoo Foundation +# 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="20190621" + +### 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 $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 "[] " +} + +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 [] 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 " " +} + +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 to activate!" + validate_lapacklibdir $2 || die -q "invalid lapack libdir!" + store_config ${EROOT}/etc/env.d/lapack/$1/$3 LDPATH $2 +} diff --git a/app-eselect/eselect-lapack/files/lapack.eselect.5 b/app-eselect/eselect-lapack/files/lapack.eselect.5 new file mode 100644 index 000000000..4a9b7bda2 --- /dev/null +++ b/app-eselect/eselect-lapack/files/lapack.eselect.5 @@ -0,0 +1,79 @@ +.TH "ESELECT" "5" "June 2019" "Gentoo Linux" "eselect" +.SH "NAME" +lapack.eselect \- The LAPACK management module for Gentoo's eselect +.SH "SYNOPSIS" +\fBeselect lapack\fR [\fBhelp\fR|\fBusage\fR] +.br +\fBeselect lapack\fR \fBlist\fR [\fIlibdir\fR] +.br +\fBeselect lapack\fR \fBadd\fR +.br +\fBeselect lapack\fR \fBset\fR [\fIoptions\fR] \fIimplementation\fR +.br +\fBeselect lapack\fR \fBshow\fR [\fIlibdir\fR] + +.SH "DESCRIPTION" +\fBeselect\fR is Gentoo's configuration and management tool. It features +modules that care for the individual administrative tasks. +.SH "ACTION: LIST" +\fBeselect lapack list\fR [\fIlibdir\fR] +.br +Displays an ordered list of installed LAPACK implementations. It distinguishes between versions with different +Application Binary Interfaces (e.g. x86/AMD64). Furthermore, it also distinguishes +between interfaces to high-level programming languages. Each line holds +a number and the implementation's name. An asterisk next to one of the list +elements denotes an active implementation. + +phi / # eselect lapack list +.br +Installed LAPACK for libdir \fBlib\fR +.br + [1] atlas * + [2] reference + +Possible \fIoptions\fR to the \fBlist\fR action are restrictions to +handle only certain ABI\-specific library directories. For example, + +\fBeselect lapack list lib64\fR + +lists only LAPACK implementations found in \fB/usr/lib64\fR. + +.SH "ACTION: SHOW" +\fBeselect lapack show\fR [\fIlibdir\fR] +.br +Shows your system's currently active LAPACK implementations. + +phi / # eselect lapack show +.br +lib: atlas +.br +lib64: reference + +The same \fIoptions\fR that apply to the \fBlist\fR action can be used +with the \fBshow\fR action to restrict it to given ABIs. +.SH "ACTION: SET" +\fBeselect lapack set\fR \fIimplementation\fR [\fIoptions\fR] +.br +Sets your system's currently active LAPACK implementations to \fIimplementation\fR. +The same \fIoptions\fR that apply to the \fBlist\fR action can be used +with the \fBset\fR action to restrict it to given ABIs. + +phi / # eselect lapack set atlas + +.SH "ACTION: VALIDATE" +\fBeselect lapack validate\fR +.br +Validates LAPACK candidates under the /etc/env.d directory and automatically +remove the invalid ones. + +.SH "ACTION: ADD" +\fBeselect lapack add\fR \fIlibdir\fR \fIdir\fR \fIimpl\fR +.br +Add a new LAPACK implementation. + +.SH "AUTHOR" +Danny van Dyk +.br +Donnie Berkholz +.br +Mo Zhou diff --git a/app-eselect/eselect-lapack/metadata.xml b/app-eselect/eselect-lapack/metadata.xml new file mode 100644 index 000000000..0c6991d79 --- /dev/null +++ b/app-eselect/eselect-lapack/metadata.xml @@ -0,0 +1,8 @@ + + + + + sci@gentoo.org + Gentoo Science Project + +