commit:     8e4335f40599fc6f56737d829711ff06652ac52b
Author:     Christopher Fore <csfore <AT> posteo <DOT> net>
AuthorDate: Thu Jul 17 14:19:53 2025 +0000
Commit:     Nowa Ammerlaan <nowa <AT> gentoo <DOT> org>
CommitDate: Fri Jul 18 09:02:03 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8e4335f4

sci-libs/libqalculate: add 5.6.0

- backports a patch from upstream that fixes a segfault discovered while
  running tests

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

 sci-libs/libqalculate/Manifest                     |  1 +
 .../files/libqalculate-5.6.0-fix-segfault.patch    | 19 +++++
 sci-libs/libqalculate/libqalculate-5.6.0.ebuild    | 94 ++++++++++++++++++++++
 3 files changed, 114 insertions(+)

diff --git a/sci-libs/libqalculate/Manifest b/sci-libs/libqalculate/Manifest
index 77f7eebe683a..1e758b8aab4e 100644
--- a/sci-libs/libqalculate/Manifest
+++ b/sci-libs/libqalculate/Manifest
@@ -1,3 +1,4 @@
 DIST libqalculate-5.5.0.tar.gz 2209195 BLAKE2B 
64781eeb1ad06bb25ac604fce10fb6a158e5f704ad311d52d0b3494ddf4f96d6240795b9f1d25aaf415b4e06f9916af12ca3db71d6b97c00f07fd0e31ebc6036
 SHA512 
c19dd210c03eb3a2966937dafade9f15e5289a04b5c498180b3bff37e202b6707e1942e02dd76fd4f461d5f80bd7ab7b99ba7802916b7ed6a25d1e59b16472e7
 DIST libqalculate-5.5.1.tar.gz 2212026 BLAKE2B 
dd10a0e2a5d6454c545465cafa21ab3d2d999b4671617ca98b95af4850f7275a9a53b59b923e0f34866cc6814298f82cdff714250df945ae3673a1e9e6d3c1b9
 SHA512 
97fca04ef8ccd9596a40f36095fd418ebcb9b98cd2c9f412b9bf8475454024b1d8942adc869b03f501656fa2d36a6dc2c8a2fc7e366325e8da382d6194346977
 DIST libqalculate-5.5.2.tar.gz 2211598 BLAKE2B 
b9f3dbbe01d95e5bcc358c6070f42a3ca27bbc9cb5e8d0de3e8150d29262f0d1f509287f3fdee8949eb7af9e5c56e625d31bf5bb94839018ee7c87742eb95b51
 SHA512 
5042e97a2f252ea2808681d1c14265f01d9e353262c7719bc664c6d9a6c4756dc287aa9828314e6ad236baa0b74d3914f7b4fec88c862b28cd9e880384ea10d6
+DIST libqalculate-5.6.0.tar.gz 2304322 BLAKE2B 
4513a41b3385fb60613af353a2733318373ba069cdf2868ff1a46b372cd678ccf56dac105fba1b2bc7ef1c79d0616fb9b09f97320a8c1cc944762e293bedfe91
 SHA512 
6cf50ac453c133d98a183127c44017a3872b4987b0786232e5638eeb944fed70953cfa284454f88c5130249fec21888438a181c331092378bd637083809a0a45

diff --git a/sci-libs/libqalculate/files/libqalculate-5.6.0-fix-segfault.patch 
b/sci-libs/libqalculate/files/libqalculate-5.6.0-fix-segfault.patch
new file mode 100644
index 000000000000..bcb5faaaaf50
--- /dev/null
+++ b/sci-libs/libqalculate/files/libqalculate-5.6.0-fix-segfault.patch
@@ -0,0 +1,19 @@
+https://github.com/Qalculate/libqalculate/commit/b56d623ada9cdd2aeac73b66ab839c9cd5bdd239
+
+From b56d623ada9cdd2aeac73b66ab839c9cd5bdd239 Mon Sep 17 00:00:00 2001
+From: "Hanna K." <[email protected]>
+Date: Thu, 17 Jul 2025 15:54:15 +0200
+Subject: [PATCH] Fix segfault with text argument containing potential text
+ returning function, or variable containing text value (issue #813)
+
+--- a/libqalculate/Function.cc
++++ b/libqalculate/Function.cc
+@@ -1763,7 +1763,7 @@ void Argument::parse(MathStructure *mstruct, const 
string &str, const ParseOptio
+                       if((mstruct->isVariable() && 
mstruct->variable()->isKnown() && ((KnownVariable*) 
mstruct->variable())->get().isSymbolic()) || (mstruct->isFunction() && 
(mstruct->function()->subtype() == SUBTYPE_USER_FUNCTION || 
mstruct->function()->subtype() == SUBTYPE_DATA_SET || mstruct->function()->id() 
== FUNCTION_ID_REGISTER || mstruct->function()->id() == FUNCTION_ID_STACK || 
mstruct->function()->id() == FUNCTION_ID_LOAD || mstruct->function()->id() == 
FUNCTION_ID_CHAR || mstruct->function()->id() == FUNCTION_ID_CONCATENATE || 
mstruct->function()->id() == FUNCTION_ID_COMPONENT || mstruct->function()->id() 
== FUNCTION_ID_BINARY_DECIMAL || mstruct->function()->id() == 
FUNCTION_ID_BIJECTIVE || mstruct->function()->id() == FUNCTION_ID_ROMAN || 
((mstruct->function()->id() == FUNCTION_ID_BIN || mstruct->function()->id() == 
FUNCTION_ID_OCT || mstruct->function()->id() == FUNCTION_ID_DEC || 
mstruct->function()->id() == FUNCTION_ID_HEX || mstruct->function()->id() == 
FUNCTION_ID_BASE) && mstruct->
 size() > 0 && mstruct->last().isOne())))) {
+                               EvaluationOptions eo;
+                               eo.parse_options = po;
+-                              MathStructure mtest(mstruct);
++                              MathStructure mtest(*mstruct);
+                               CALCULATOR->beginTemporaryStopMessages();
+                               mtest.eval(eo);
+                               CALCULATOR->endTemporaryStopMessages();

diff --git a/sci-libs/libqalculate/libqalculate-5.6.0.ebuild 
b/sci-libs/libqalculate/libqalculate-5.6.0.ebuild
new file mode 100644
index 000000000000..a47ac881836e
--- /dev/null
+++ b/sci-libs/libqalculate/libqalculate-5.6.0.ebuild
@@ -0,0 +1,94 @@
+# 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=(
+       # Remove on next version (current: 5.6.0)
+       "${FILESDIR}"/libqalculate-5.6.0-fix-segfault.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