commit:     40937d5af20e7e4d82592013d254a00d54c245c9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 29 22:41:47 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec 29 22:42:01 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40937d5a

sci-libs/libqalculate: add 4.5.0

Bug: https://bugs.gentoo.org/887369
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sci-libs/libqalculate/Manifest                     |  1 +
 .../files/libqalculate-4.5.0-tests.patch           | 81 +++++++++++++++++++++
 sci-libs/libqalculate/libqalculate-4.5.0.ebuild    | 83 ++++++++++++++++++++++
 sci-libs/libqalculate/metadata.xml                 |  5 ++
 4 files changed, 170 insertions(+)

diff --git a/sci-libs/libqalculate/Manifest b/sci-libs/libqalculate/Manifest
index dfa964a4533d..fa43c41f3e1f 100644
--- a/sci-libs/libqalculate/Manifest
+++ b/sci-libs/libqalculate/Manifest
@@ -3,3 +3,4 @@ DIST libqalculate-3.22.0.tar.gz 2150167 BLAKE2B 
2023dc00e516f26d93e6acae66acb621
 DIST libqalculate-4.1.1.tar.gz 2172017 BLAKE2B 
e9dcc22ad2d102572610ddc103afc5a279cf4f63681750c6165dac40225c7e29ebb4ccdc4f54cb97031ca8684ef17e08e99478c6b200870c7858e832a7588f18
 SHA512 
7a0f2fac6c96247b40565bdd015f8b52dc250fa74a8d8ed4a52a6f2134fb2b628e469c0253723f22b433a8f575590a28be8c0d4aa6cfb473b58f1b2c63707956
 DIST libqalculate-4.2.0.tar.gz 2215812 BLAKE2B 
393bab0d9cf5d4a3158d93bf676805d829a2103ec1dc733e3d98fd7a54ab0c42d3797dadb1cde72b1df2e13cfb691430982f5fbd886ac9f0a906b3884f912202
 SHA512 
105f567a3b24a1c396df0eb85f299d18228f489e4d989f0fa09cf97321494030e9a85d9cd9fe4b5dd8cc233b4329025788275ba168546929e912598dee8ef6b8
 DIST libqalculate-4.3.0.tar.gz 2230559 BLAKE2B 
724dde0bc16e5eaed63420c6dd68ac7c94477c44c007c92bb3b4560d8a2d2062ade4be6d2c8005ff64bf8ffe4c42d95d6990f7900df7a1c1a36cd4cd717bd04d
 SHA512 
234c111435d9461ab65d274030f9a5f6ee401cd81df62b9c2273e921edb8db3bde4254060285dbfaa7b9701a257a5801c8ab8f26b0c2aeeafd2a36042bdeeb84
+DIST libqalculate-4.5.0.tar.gz 2603599 BLAKE2B 
142790cf89e97c601b08d553b1f9cd6c1bf184a43c2614a07fa91560a875ea3e3124cf29d7652640b1f2fb4fada1519d48e4cb0ebcfb844c26369d3031aee230
 SHA512 
a123eaa725c6c6badce0eceecd6ef7e37ca281e7de18085d6a28aa6043bb3f1069f9ebba82b29989c9958455aa093ee183fd8013a86b39bd34e56454bdb35770

diff --git a/sci-libs/libqalculate/files/libqalculate-4.5.0-tests.patch 
b/sci-libs/libqalculate/files/libqalculate-4.5.0-tests.patch
new file mode 100644
index 000000000000..102b245a56b1
--- /dev/null
+++ b/sci-libs/libqalculate/files/libqalculate-4.5.0-tests.patch
@@ -0,0 +1,81 @@
+https://github.com/Qalculate/libqalculate/commit/e4c86b6124a3c8732f03dc1dfc8be9fac14a40eb
+
+From e4c86b6124a3c8732f03dc1dfc8be9fac14a40eb Mon Sep 17 00:00:00 2001
+From: Hanna K <[email protected]>
+Date: Wed, 28 Dec 2022 09:44:40 +0100
+Subject: [PATCH] Fix unit tests (issue #499); Fix some limits broken by
+ countTotalChildren() update
+
+--- a/libqalculate/MathStructure-limit.cc
++++ b/libqalculate/MathStructure-limit.cc
+@@ -595,7 +595,7 @@ bool calculate_limit_sub(MathStructure &mstruct, const 
MathStructure &x_var, con
+                                       }
+                               }
+                       }
+-                      if(!b_possible_zero && !b_fail && lhop_depth < 5 && 
!mzero.isOne() && !minfp.isOne() && mzero.countTotalChildren(false) + 
minfp.countTotalChildren(false) < 50) {
++                      if(!b_possible_zero && !b_fail && lhop_depth < 5 && 
!mzero.isOne() && !minfp.isOne() && mzero.countTotalChildren(false) + 
minfp.countTotalChildren(false) < 250) {
+                               //L'Hôpital's rule
+                               MathStructure mden, mnum;
+                               for(size_t i2 = 0; i2 < 2; i2++) {
+--- a/tests/calculus.batch
++++ b/tests/calculus.batch
+@@ -1,7 +1,7 @@
+ diff(6x^2)
+       12x
+ diff(sinh(x^2)/(5x) + 3xy/sqrt(x))
+-      0.4 * cosh(x^2) - sinh(x^2) / (5x^2) + (3y) / (2 * sqrt(x))
++      0.4 * cosh(x^2) + (3y) / (2 * sqrt(x)) - sinh(x^2) / (5x^2)
+ 
+ integrate(6x^2)
+       2x^3 + C
+--- a/tests/solver.batch
++++ b/tests/solver.batch
+@@ -23,37 +23,37 @@ x^(-3x) = 2
+       x = e^lambertw(-ln(2) / 3) or x = e^lambertw(-ln(2) / 3, -1)
+ 
+ 1/3 * sin(3x) - 1/3 = 0
+-      x = pi / 6 + (2/3) * pi * n
++      x = (2/3) * pi * n + pi / 6
+ 
+ 2/3 * sin(3x) - 1/3 = 0
+-      x = (5/18) * pi + (2/3) * pi * n or x = pi / 18 + (2/3) * pi * n
++      x = (2/3) * pi * n + (5/18) * pi or x = (2/3) * pi * n + pi / 18
+ 
+ sin(x) + cos(x) = 1
+-      x = 2 pi * n or x = pi / 2 + 2 pi * n
++      x = 2 pi * n or x = 2 pi * n + pi / 2
+ 
+ sin(x) = 1 + cos(x)
+-      x = pi + 2 pi * n or x = pi / 2 + 2 pi * n
++      x = 2 pi * n + pi or x = 2 pi * n + pi / 2
+ 
+ sqrt(2) * cos(3x + pi/6) = 1
+-      x = (2/3) * pi * n - (5/36) * pi or x = pi / 36 + (2/3) * pi * n
++      x = (2/3) * pi * n + pi / 36 or x = (2/3) * pi * n - (5/36) * pi
+ 
+ 2 * sin(3x/4) = 1
+-      x = (10/9) * pi + (8/3) * pi * n or x = (2/9) * pi + (8/3) * pi * n
++      x = (8/3) * pi * n + (10/9) * pi or x = (8/3) * pi * n + (2/9) * pi
+ 
+ tan(x/4 + pi/3) = sqrt(3)
+       x = 4 pi * n
+ 
+ sqrt(3) * sin(x) + cos(x) = sqrt(3)
+-      x = pi / 2 + 2 pi * n or x = pi / 6 + 2 pi * n
++      x = 2 pi * n + pi / 2 or x = 2 pi * n + pi / 6
+ 
+ sin(x)^2 = sin(x)^3
+-      x = pi * n or x = pi / 2 + 2 pi * n
++      x = pi * n or x = 2 pi * n + pi / 2
+ 
+ sin(x) = sin(x/2)
+-      x = 2 pi * n or x = 4 pi * n - (2/3) * pi or x = (2/3) * pi + 4 pi * n
++      x = 2 pi * n or x = 4 pi * n + (2/3) * pi or x = 4 pi * n - (2/3) * pi
+ 
+ sin(4x) + cos(2x) = 0
+-      x = pi * n - pi / 12 or x = (7/12) * pi + pi * n or x = (pi * n) / 2 - 
pi / 4
++      x = pi * n + (7/12) * pi or x = pi * n - pi / 12 or x = (pi * n) / 2 - 
pi / 4
+ 
+ /set approximation try exact
+ 
+

diff --git a/sci-libs/libqalculate/libqalculate-4.5.0.ebuild 
b/sci-libs/libqalculate/libqalculate-4.5.0.ebuild
new file mode 100644
index 000000000000..d967fd779daf
--- /dev/null
+++ b/sci-libs/libqalculate/libqalculate-4.5.0.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bump with sci-calculators/qalculate-gtk!
+
+inherit toolchain-funcs
+
+DESCRIPTION="A modern multi-purpose calculator library"
+HOMEPAGE="https://qalculate.github.io/";
+SRC_URI="https://github.com/Qalculate/${PN}/releases/download/v${PV}/${P}.tar.gz";
+
+LICENSE="GPL-2"
+# SONAME changes pretty often on bumps. Check!
+SLOT="0/22"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv 
~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="curl icu gnuplot +hardened readline test"
+RESTRICT="!test? ( test )"
+
+DEPEND="dev-libs/gmp:=
+       dev-libs/libxml2:2
+       dev-libs/mpfr:=
+       virtual/libiconv
+       curl? ( net-misc/curl )
+       icu? ( dev-libs/icu:= )
+       readline? ( sys-libs/readline:= )"
+RDEPEND="${DEPEND}
+       gnuplot? ( >=sci-visualization/gnuplot-3.7 )"
+BDEPEND="dev-util/intltool
+       sys-devel/gettext
+       virtual/pkgconfig"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-tests.patch
+)
+
+src_prepare() {
+       default
+
+       cat >po/POTFILES.skip <<-EOF || die
+               # Required by make check
+               data/currencies.xml.in
+               data/datasets.xml.in
+               data/elements.xml.in
+               data/functions.xml.in
+               data/planets.xml.in
+               data/prefixes.xml.in
+               data/units.xml.in
+               data/variables.xml.in
+               src/defs2doc.cc
+       EOF
+}
+
+src_configure() {
+       # Needed for po-defs/Makefile
+       export CXX_FOR_BUILD="$(tc-getBUILD_CXX)"
+       export CXXCPP_FOR_BUILD="$(tc-getBUILD_CXX) -E"
+
+       # bug #792027
+       tc-export CC
+
+       econf \
+               $(use_enable test tests) \
+               $(use_enable test unittests) \
+               $(use_with curl libcurl) \
+               $(use_with gnuplot gnuplot-call) \
+               $(use_enable !hardened insecure) \
+               $(use_with icu) \
+               $(use_with readline)
+}
+
+src_install() {
+       # docs/reference/Makefile.am -> referencedir=
+       emake \
+               DESTDIR="${D}" \
+               referencedir="${EPREFIX}/usr/share/doc/${PF}/html" \
+               install
+
+       einstalldocs
+
+       find "${ED}" -name '*.la' -delete || die
+}

diff --git a/sci-libs/libqalculate/metadata.xml 
b/sci-libs/libqalculate/metadata.xml
index 284c82a7b616..39ddc8a41c49 100644
--- a/sci-libs/libqalculate/metadata.xml
+++ b/sci-libs/libqalculate/metadata.xml
@@ -5,6 +5,11 @@
     <email>[email protected]</email>
     <name>Gentoo Science Project</name>
   </maintainer>
+  <use>
+    <flag name="hardened">
+      Disable unsafe functions like 'command' and variables like 'uptime'.
+    </flag>
+  </use>
   <upstream>
     <remote-id type="sourceforge">qalculate-0.9.7</remote-id>
     <remote-id type="github">Qalculate/libqalculate</remote-id>

Reply via email to