commit:     ca651457817c04e676ca5911421a0a740767578f
Author:     Christopher Fore <csfore <AT> posteo <DOT> net>
AuthorDate: Mon Oct 13 18:16:11 2025 +0000
Commit:     Nowa Ammerlaan <nowa <AT> gentoo <DOT> org>
CommitDate: Tue Oct 14 16:06:29 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ca651457

sci-libs/libqalculate: add 5.8.0

Backported two commits that fix an ASAN error and failing a test due to
using a function that is not available when built with +hardened.

Signed-off-by: Christopher Fore <csfore <AT> posteo.net>
Part-of: https://github.com/gentoo/gentoo/pull/44164
Signed-off-by: Nowa Ammerlaan <nowa <AT> gentoo.org>

 sci-libs/libqalculate/Manifest                     |  1 +
 .../files/libqalculate-5.8.0-fix-tests.patch       | 33 ++++++++
 sci-libs/libqalculate/libqalculate-5.8.0.ebuild    | 93 ++++++++++++++++++++++
 3 files changed, 127 insertions(+)

diff --git a/sci-libs/libqalculate/Manifest b/sci-libs/libqalculate/Manifest
index a34759186d3a..2bedbe8657a0 100644
--- a/sci-libs/libqalculate/Manifest
+++ b/sci-libs/libqalculate/Manifest
@@ -1 +1,2 @@
 DIST libqalculate-5.7.0.tar.gz 2310241 BLAKE2B 
2bb934c67ef8ade6525bc34fbd4fd52c163a3e968b1d06bb07deb1fbb12f6a457b6a3d16734a9ce1a7b216c060d88b73a28ea26d7d29ca3ac9f4b232e6e25665
 SHA512 
f21144541da78f3dcbf65b1c9f826a50d8758515554a4ded9f450daf945b042820412114110aaf46bc21493f4ebb7e0a7d2ee925fdce0e497fd90f4adc983cf8
+DIST libqalculate-5.8.0.tar.gz 2354285 BLAKE2B 
2480498d437dc6807233e95a6c994889edbfd8118858463cbadeacfa815367556e32eb9423363c15f97cfc4b9639b8282628d78725af19ad2c9c3a00baa54b57
 SHA512 
2fc8d02578e0277b51e5bc5c738744b4919a1bc09a793f445296430d1e2ac84dece653ed48f7bd091882267c0ac924c9a3e430e3d674af1afab353de371b3c00

diff --git a/sci-libs/libqalculate/files/libqalculate-5.8.0-fix-tests.patch 
b/sci-libs/libqalculate/files/libqalculate-5.8.0-fix-tests.patch
new file mode 100644
index 000000000000..4bde0be21c69
--- /dev/null
+++ b/sci-libs/libqalculate/files/libqalculate-5.8.0-fix-tests.patch
@@ -0,0 +1,33 @@
+https://github.com/Qalculate/libqalculate/issues/853
+https://github.com/Qalculate/libqalculate/commit/9370610599a200577f5368849e63151ec8399cb5
+https://github.com/Qalculate/libqalculate/commit/113f4448bb0c1bbb666ec237b07da1e4a667b629
+
+From 113f4448bb0c1bbb666ec237b07da1e4a667b629 Mon Sep 17 00:00:00 2001
+From: "Hanna K." <[email protected]>
+Date: Mon, 13 Oct 2025 18:29:18 +0200
+Subject: [PATCH 1/3] Fix compilation with -fsanitize=undefined (issue #853)
+
+--- a/libqalculate/Calculator-parse.cc
++++ b/libqalculate/Calculator-parse.cc
+@@ -3458,6 +3458,7 @@ void Calculator::parse(MathStructure *mstruct, string 
str, const ParseOptions &p
+                                                                               
                best_pl = name_length + name_length_old;
+                                                                               
                best_pnl = name_length_old;
+                                                                               
                index = -1;
++                                                                              
                break;
+                                                                               
        }
+                                                                               
        if(!p_mode) {
+                                                                               
                str.erase(str_index - name_length_old, name_length_old);
+
+--- a/src/qalc.cc
++++ b/src/qalc.cc
+@@ -4558,6 +4558,9 @@ int main(int argc, char *argv[]) {
+                       }
+                       if(!unittest || str.empty() || str[0] != '\t') 
remove_blank_ends(str);
+                       if(str.empty() || str[0] == '#' || (str.length() >= 2 
&& str[0] == '/' && str[1] == '/')) continue;
++#ifdef DISABLE_INSECURE
++                      if(unittest && str.find("libqalculate_tests_vector") != 
string::npos) break;
++#endif
+               } else {
+ #ifdef HAVE_LIBREADLINE
+                       rlbuffer = readline(prompt.c_str());
+

diff --git a/sci-libs/libqalculate/libqalculate-5.8.0.ebuild 
b/sci-libs/libqalculate/libqalculate-5.8.0.ebuild
new file mode 100644
index 000000000000..753047964758
--- /dev/null
+++ b/sci-libs/libqalculate/libqalculate-5.8.0.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Bump with sci-calculators/qalculate-gtk and sci-calculators/qalculate-qt
+
+inherit autotools flag-o-matic toolchain-funcs
+
+MY_PV="${PV//b/}"
+
+DESCRIPTION="A modern multi-purpose calculator library"
+HOMEPAGE="https://qalculate.github.io/";
+SRC_URI="https://github.com/Qalculate/libqalculate/archive/v${MY_PV}.tar.gz -> 
${P}.tar.gz"
+S="${WORKDIR}"/"${PN}-${MY_PV}"
+
+LICENSE="GPL-2+"
+# SONAME changes pretty often on bumps. Check!
+SLOT="0/23.3"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~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}"/"${PN}"-5.8.0-fix-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
+
+       eautoreconf
+}
+
+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
+
+       # bug #924939
+       use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152
+
+       local myeconfargs=(
+               $(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)
+       )
+
+       econf "${myeconfargs[@]}"
+}
+
+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
+}

Reply via email to