commit:     d136d0941d9332e436fa6d59476a7f1eb135dd01
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 17 16:29:34 2026 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Jan 17 16:55:44 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d136d094

sci-mathematics/gfan: fix build against libcxx

Yet another patch against 0.6.x. I did try to package gfan-0.7 again
first, this time with the Debian patches for the int128 types, but the
build still failed miserably.

Closes: https://bugs.gentoo.org/928999
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 sci-mathematics/gfan/Manifest             |  1 +
 sci-mathematics/gfan/gfan-0.6.2-r8.ebuild | 88 +++++++++++++++++++++++++++++++
 2 files changed, 89 insertions(+)

diff --git a/sci-mathematics/gfan/Manifest b/sci-mathematics/gfan/Manifest
index 23cbc2f60273..9f04d1f8dff3 100644
--- a/sci-mathematics/gfan/Manifest
+++ b/sci-mathematics/gfan/Manifest
@@ -1 +1,2 @@
+DIST gfan-0.6.2-libcxx.patch.xz 13704 BLAKE2B 
0611206260a2ba5690a7821c38dd96de10e05a8c7afb68af3000b1bddbe175bfee74a520ec62e309a25525f25dbcb9647ba0a0e1297ceb199968c5ff76d87b09
 SHA512 
caeef81bd8bec8da7fb7a57629ec53d55d60d2e881faa842a194bf0e5904ffd9048fe287c480b571394059ea087e33617bfae3602dae8089bcaa6047a3f78719
 DIST gfan0.6.2.tar.gz 1321059 BLAKE2B 
1ed61e1e084a1ceb65dd21848440bc3a90486c0ce4012b3b64c8029e89636696d2b0e5446ea156d2cf050b5db179c7c2f25c97e683cecf6e9616e8553d8513bf
 SHA512 
5961820750af2522fdc1a86c0254742c3b003607a8707df5d6cd5f0bc6461e4d3db3b1d3cb537979d57eb9dff387974a58aeb91d0b5246d7c701cadc5a2cf4cf

diff --git a/sci-mathematics/gfan/gfan-0.6.2-r8.ebuild 
b/sci-mathematics/gfan/gfan-0.6.2-r8.ebuild
new file mode 100644
index 000000000000..174d43cc6707
--- /dev/null
+++ b/sci-mathematics/gfan/gfan-0.6.2-r8.ebuild
@@ -0,0 +1,88 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic toolchain-funcs
+
+DESCRIPTION="Compute Groebner fans and tropical varieties"
+HOMEPAGE="https://users-math.au.dk/~jensen/software/gfan/gfan.html";
+SRC_URI="https://users-math.au.dk/~jensen/software/${PN}/${PN}${PV}.tar.gz
+       https://dev.gentoo.org/~mjo/distfiles/${P}-libcxx.patch.xz";
+
+S="${WORKDIR}/${PN}${PV}"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~riscv ~x86"
+IUSE="doc"
+
+# texlive-plaingeneric is needed for \usepackage{ulem} in
+# the manual. ghostscript-gpl provides the "dvipdf" command.
+BDEPEND="doc? (
+       app-text/ghostscript-gpl
+       dev-texlive/texlive-plaingeneric
+       virtual/latex-base
+)"
+DEPEND="dev-libs/gmp:0=[cxx(+)]
+       sci-libs/cddlib:0="
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-0.6.2-testsuite.patch"
+       "${FILESDIR}/${PN}-0.6.2-Makefile.patch"
+       "${FILESDIR}/${PN}-0.6.2-fix-0602ResultantFanProjection.patch"
+       "${FILESDIR}/${PN}-0.6.2-fix-spelling-errors.patch"
+       "${FILESDIR}/${PN}-0.6.2-find-name.patch"
+       "${FILESDIR}/${PN}-0.6.2-glibcxx-assertions.patch"
+       "${FILESDIR}/${PN}-0.6.2-gcc15.patch"
+       "${WORKDIR}/${PN}-0.6.2-libcxx.patch"
+)
+
+pkg_setup() {
+       tc-export CC CXX
+
+       # This should really go in cppflags, but that doesn't work with
+       # gfan's hand-written Makefile.
+       append-cxxflags -DNOCDDPREFIX -I"${EPREFIX}"/usr/include/cddlib
+}
+
+src_prepare() {
+       default
+
+       # And this one fails (harmlessly) on x86, bug 818397.
+       rm -r testsuite/0009RenderStairCase || \
+               die "unable to disable test 0009RenderStairCase"
+}
+
+src_configure() {
+       # -Werror=odr
+       # https://bugs.gentoo.org/863044
+       # Only contact method is email. I have sent one detailing the issue.
+       filter-lto
+
+       # The upstream Makefile says that GCC produces bad code with -O3.
+       replace-flags "-O3" "-O2"
+       default
+}
+
+src_compile() {
+       default
+       if use doc; then
+               pushd doc > /dev/null || die
+               # The LaTeX build commands need to be repeated until the
+               # document "stops changing," which is not as easy as it
+               # sounds to detect. Running it twice seems to work here.
+               for iteration in 1 2; do
+                       latex manual.tex && \
+                               bibtex manual && \
+                               dvipdf manual.dvi manual.pdf || die
+               done
+               popd > /dev/null || die
+       fi
+}
+
+src_install() {
+       emake PREFIX="${ED}/usr" install
+       use doc && dodoc doc/manual.pdf
+}

Reply via email to