Add sci-libs/gsl from upstream gentoo

BUG=b:124770147
TEST=emerge-hatch gsl

Change-Id: Ica478063e329cdf8a2be1afd4cdfa11106b40c0b
Reviewed-on: https://chromium-review.googlesource.com/1716997
Tested-by: Tom Hughes <tomhughes@chromium.org>
Commit-Ready: Tom Hughes <tomhughes@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/sci-libs/gsl/Manifest b/sci-libs/gsl/Manifest
new file mode 100644
index 0000000..862f74f
--- /dev/null
+++ b/sci-libs/gsl/Manifest
@@ -0,0 +1,2 @@
+DIST gsl-2.3-cblas.patch.bz2 12036 BLAKE2B ddad801cc42f925581e2e4995292f3eab0d2faf70c43c3b205fcf521b98e426df1d0824ed7d98b2c4cc89bbc4068fd45f2595dc02d23bded5c702b5a01bbfdb2 SHA512 37b867a21e60cd96c453ae24139bcf16c00c85bb6d5a3dcece81185fd9af5870c5167d2fa3c74cffce55bfb84f72be34d28ea94e0889904f8dda8687f66b4d23
+DIST gsl-2.5.tar.gz 7303881 BLAKE2B 7c6d10c21071a1af1f03123f83244476d2e90fcd27d05a115b03a74fe631eb7d8081f5260e534ae58ab0997c1111f980a5e4cb50d110ca626fe810c44be70180 SHA512 5b4c5c023f9029ce220f4e09aa4d0234fed94d42ac224d58fda095fe0532d54237a7c33278f8b5d0ba051f6004486edb38d0adb4fcb49337a8c1d8a18cf4a24a
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 0000000..e081dc4
--- /dev/null
+++ b/sci-libs/gsl/gsl-2.5-r1.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+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="*"
+IUSE="cblas-external +deprecated static-libs"
+
+RDEPEND="cblas-external? ( virtual/cblas:= )"
+DEPEND="${RDEPEND}"
+
+PATCHES=( "${WORKDIR}"/${PN}-2.3-cblas.patch )
+
+src_prepare() {
+	# 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
+}
+
+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 {} +
+}
diff --git a/sci-libs/gsl/metadata.xml b/sci-libs/gsl/metadata.xml
new file mode 100644
index 0000000..4a8296b
--- /dev/null
+++ b/sci-libs/gsl/metadata.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <maintainer type="project">
+    <email>sci@gentoo.org</email>
+    <name>Gentoo Science Project</name>
+  </maintainer>
+  <longdescription lang="en">
+  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. 
+</longdescription>
+  <use>
+    <flag name="cblas-external">Link gsl with external cblas provided by
+    (<pkg>virtual/cblas</pkg>) instead of shipped internal version</flag>
+    <flag name="deprecated">Enable deprecated functions</flag>
+  </use>
+</pkgmetadata>