From bf6776b135bd1dace71468d9efbdbeb9c4397164 Mon Sep 17 00:00:00 2001 From: Martin Väth Date: Mon, 1 Jul 2019 22:01:20 +0200 Subject: sci-libs/gsl: Safe eselect-cblas functionality from removal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Väth --- metadata/pkg_desc_index | 1 + profiles/use.local.desc | 2 + sci-libs/gsl/Manifest | 2 + sci-libs/gsl/files/cblas.pc.in | 12 ++++ sci-libs/gsl/files/eselect.cblas.gsl | 5 ++ sci-libs/gsl/gsl-2.5-r1.ebuild | 111 +++++++++++++++++++++++++++++++++++ sci-libs/gsl/metadata.xml | 26 ++++++++ 7 files changed, 159 insertions(+) create mode 100644 sci-libs/gsl/Manifest create mode 100644 sci-libs/gsl/files/cblas.pc.in create mode 100644 sci-libs/gsl/files/eselect.cblas.gsl create mode 100644 sci-libs/gsl/gsl-2.5-r1.ebuild create mode 100644 sci-libs/gsl/metadata.xml diff --git a/metadata/pkg_desc_index b/metadata/pkg_desc_index index d685bc74..a29356eb 100644 --- a/metadata/pkg_desc_index +++ b/metadata/pkg_desc_index @@ -94,6 +94,7 @@ net-misc/openrdate 1.2: use TCP or UDP to retrieve the current time of another m net-misc/sshstart 4.7: Start ssh-agent/ssh-add only if you really use ssh or friends net-print/foo2zjs 20160722: Support for printing to ZjStream-based printers sci-geosciences/googleearth 7.1.8.3036-r3 7.3.0.3832-r3 7.3.2-r2: A 3D interface to the planet +sci-libs/gsl 2.5-r1: The GNU Scientific Library sci-mathematics/genius 1.0.21: Genius Mathematics Tool and the GEL Language sci-mathematics/reduce 20141130-r2: A general-purpose computer algebra system sys-apps/cpi 3.1: A wrapper for cp -i -a, making use of diff diff --git a/profiles/use.local.desc b/profiles/use.local.desc index 5147aa8f..886451ba 100644 --- a/profiles/use.local.desc +++ b/profiles/use.local.desc @@ -244,6 +244,8 @@ net-print/foo2zjs:foo2zjs_devices_xp6115 - Xerox Phaser 6115MFP ICM net-print/foo2zjs:foomaticdb - Add support for the foomatic printing driver database sci-geosciences/googleearth:bundled-libs - Use bundled libraries. sci-geosciences/googleearth:bundled-qt - Use bundled qt. +sci-libs/gsl:cblas-external - Link gsl with external cblas provided by (virtual/cblas) instead of shipped internal version +sci-libs/gsl:deprecated - Enable deprecated functions sys-apps/less:less-select - Add the less-select feature (additional options and a binary helper). sys-apps/less:lesspipe - Default to lesspipe.sh from app-text/lesspipe instead of the gentoo specific lesspipe. sys-apps/less:original-gentoo - Use the gentoo default for the LESS variable. diff --git a/sci-libs/gsl/Manifest b/sci-libs/gsl/Manifest new file mode 100644 index 00000000..27173134 --- /dev/null +++ b/sci-libs/gsl/Manifest @@ -0,0 +1,2 @@ +DIST gsl-2.3-cblas.patch.bz2 12036 SHA512 37b867a21e60cd96c453ae24139bcf16c00c85bb6d5a3dcece81185fd9af5870c5167d2fa3c74cffce55bfb84f72be34d28ea94e0889904f8dda8687f66b4d23 +DIST gsl-2.5.tar.gz 7303881 SHA512 5b4c5c023f9029ce220f4e09aa4d0234fed94d42ac224d58fda095fe0532d54237a7c33278f8b5d0ba051f6004486edb38d0adb4fcb49337a8c1d8a18cf4a24a diff --git a/sci-libs/gsl/files/cblas.pc.in b/sci-libs/gsl/files/cblas.pc.in new file mode 100644 index 00000000..a2580f85 --- /dev/null +++ b/sci-libs/gsl/files/cblas.pc.in @@ -0,0 +1,12 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=/usr/@LIBDIR@ +includedir=${prefix}/include + +Name: cblas +Description: GSL C Implementation of the Basic Linear Algebra Subprograms +Version: @PV@ +URL: http://www.gnu.org/software/gsl +Libs: -L${libdir} -lcblas +Libs.private: -lm +Cflags: -I${includedir} diff --git a/sci-libs/gsl/files/eselect.cblas.gsl b/sci-libs/gsl/files/eselect.cblas.gsl new file mode 100644 index 00000000..af6fee51 --- /dev/null +++ b/sci-libs/gsl/files/eselect.cblas.gsl @@ -0,0 +1,5 @@ +libgslcblas.so /usr/@LIBDIR@/libcblas.so +libgslcblas.so.0 /usr/@LIBDIR@/libcblas.so.0 +libgslcblas.a /usr/@LIBDIR@/libcblas.a +../blas/gsl/cblas.pc /usr/@LIBDIR@/pkgconfig/cblas.pc +gsl/gsl_cblas.h /usr/include/cblas.h diff --git a/sci-libs/gsl/gsl-2.5-r1.ebuild b/sci-libs/gsl/gsl-2.5-r1.ebuild new file mode 100644 index 00000000..9864d40d --- /dev/null +++ b/sci-libs/gsl/gsl-2.5-r1.ebuild @@ -0,0 +1,111 @@ +# Copyright 1999-2019 Gentoo Authors and Martin V\"ath +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools flag-o-matic toolchain-funcs + +DESCRIPTION="The GNU Scientific Library" +HOMEPAGE="https://www.gnu.org/software/gsl/" +SRC_URI="mirror://gnu/${PN}/${P}.tar.gz + https://dev.gentoo.org/~mgorny/dist/${PN}-2.3-cblas.patch.bz2" + +LICENSE="GPL-3" +SLOT="0/23" +KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos ~sparc-solaris ~x86-solaris" +IUSE="cblas-external +deprecated static-libs" + +RDEPEND="cblas-external? ( virtual/cblas:= )" +DEPEND="${RDEPEND} + app-eselect/eselect-cblas + virtual/pkgconfig" + +PATCHES=( "${WORKDIR}"/${PN}-2.3-cblas.patch ) + +pkg_pretend() { + # prevent to use external cblas from a previously installed gsl + local current_lib + if use cblas-external; then + current_lib=$(eselect cblas show | cut -d' ' -f2) + if [[ ${current_lib} == gsl ]]; then + ewarn "USE flag cblas-external is set: linking gsl with an external cblas." + ewarn "However the current selected external cblas is gsl." + ewarn "Please install and/or eselect another cblas" + die "Circular gsl dependency" + fi + fi +} + +src_prepare() { + ESELECT_PROF="gsl" + + # bug 349005 + [[ $(tc-getCC)$ == *gcc* ]] && \ + [[ $(tc-getCC)$ != *apple* ]] && \ + [[ $(gcc-major-version)$(gcc-minor-version) -eq 44 ]] \ + && filter-mfpmath sse + filter-flags -ffast-math + + default + if use deprecated; then + sed -i -e "/GSL_DISABLE_DEPRECATED/,+2d" configure.ac || die + fi + eautoreconf + + local deletea=() dylib=() + use static-libs || deletea=(-e '/\.a$/d') + [[ ${CHOST} != *-darwin* ]] || dylib=(-e 's/\.so\([\.0-9]\+\)\?/\1.dylib/g') + sed -e "s:/usr:${EPREFIX}/usr:" "${deletea[@]}" "${dylib[@]}" -- \ + "${FILESDIR}"/eselect.cblas.gsl >"${T}"/eselect.cblas.gsl || die +} + +src_configure() { + if use cblas-external; then + export CBLAS_LIBS="$($(tc-getPKG_CONFIG) --libs cblas)" + export CBLAS_CFLAGS="$($(tc-getPKG_CONFIG) --cflags cblas)" + fi + econf \ + --enable-shared \ + $(use_with cblas-external) \ + $(use_enable static-libs static) +} + +src_test() { + local MAKEOPTS="${MAKEOPTS} -j1" + default +} + +src_install() { + default + + find "${ED}" -name '*.la' -exec rm -f {} + + + # take care of pkgconfig file for cblas implementation. + sed \ + -e "s/@LIBDIR@/$(get_libdir)/" \ + -e "s/@PV@/${PV}/" \ + -e "/^prefix=/s:=:=${EPREFIX}:" \ + -e "/^libdir=/s:=:=${EPREFIX}:" \ + "${FILESDIR}"/cblas.pc.in > cblas.pc \ + || die "sed cblas.pc failed" + insinto /usr/$(get_libdir)/blas/gsl + doins cblas.pc + eselect cblas add $(get_libdir) "${T}"/eselect.cblas.gsl \ + ${ESELECT_PROF} +} + +pkg_postinst() { + local p=cblas + local current_lib=$(eselect ${p} show | cut -d' ' -f2) + if [[ ${current_lib} == ${ESELECT_PROF} || -z ${current_lib} ]]; then + # work around eselect bug #189942 + local configfile="${EROOT}"/etc/env.d/${p}/$(get_libdir)/config + [[ -e ${configfile} ]] && rm -f ${configfile} + eselect ${p} set ${ESELECT_PROF} + elog "${p} has been eselected to ${ESELECT_PROF}" + else + elog "Current eselected ${p} is ${current_lib}" + elog "To use ${p} ${ESELECT_PROF} implementation, you have to issue (as root):" + elog "\t eselect ${p} set ${ESELECT_PROF}" + fi +} diff --git a/sci-libs/gsl/metadata.xml b/sci-libs/gsl/metadata.xml new file mode 100644 index 00000000..4a8296b2 --- /dev/null +++ b/sci-libs/gsl/metadata.xml @@ -0,0 +1,26 @@ + + + + + sci@gentoo.org + Gentoo Science Project + + + The GNU Scientific Library (GSL) is a collection of routines for + numerical analysis. The routines are written from scratch by the GSL + team in C, and present a modern API for C programmers, while allowing + wrappers to be written for very high level languages. + + GSL includes data types and routines for complex numbers, vectors, + matrices, basic linear algebra subroutines (BLAS), eigensystems, + simulated annealing, minimization, root finding, pseudo-random + numbers, least-squares fitting, fast Fourier transforms (FFT), + differential equations, quadrature, Monte Carlo integration, special + functions, physical constants, and much more. + + + Link gsl with external cblas provided by + (virtual/cblas) instead of shipped internal version + Enable deprecated functions + + -- cgit v1.2.3-65-gdbad