From 46fd35d01f3e24f2632d331112c952bbdc7925c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Wed, 23 Aug 2023 09:46:02 -0300 Subject: [PATCH] giac: fix `#include ` in musl As reported in #45708, including fails in musl because the HAVE_TGAMMAF macro from autotools is not available at this time. Here we include a patch adapted from https://github.com/geogebra/giac/commit/618a5de3349f8def5bdb909fea42fb447b6aad4a which is the solution upstream will include in next release of giac. We need to fix this now so we can build sagemath in musl! --- srcpkgs/giac/patches/fix-fgamma.patch | 40 +++++++++++++++++++++++++++ srcpkgs/giac/template | 6 +++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/giac/patches/fix-fgamma.patch diff --git a/srcpkgs/giac/patches/fix-fgamma.patch b/srcpkgs/giac/patches/fix-fgamma.patch new file mode 100644 index 0000000000000..05101e310d1be --- /dev/null +++ b/srcpkgs/giac/patches/fix-fgamma.patch @@ -0,0 +1,40 @@ +Adapted from +https://github.com/geogebra/giac/commit/618a5de3349f8def5bdb909fea42fb447b6aad4a + +--- a/src/usual.cc ++++ b/src/usual.cc +@@ -81,6 +81,16 @@ using namespace std; + #define sprintf256 sprintf + #endif + ++#if defined HAVE_TGAMMAF || defined __APPLE__ || defined EMCC || defined EMCC2 || defined NO_BSD ++inline float fgamma(float f1){ return tgammaf(f1); } ++#else ++#if defined(__MINGW_H) || defined(VISUALC) || defined(FXCG)// FIXME gamma, not used ++inline float fgamma(float f1){ return f1; } ++#else ++inline float fgamma(float f1){ return gammaf(f1); } // or tgammaf(f1) on some versions of emscripten ++#endif ++#endif ++ + #ifndef NO_NAMESPACE_GIAC + namespace giac { + #endif // ndef NO_NAMESPACE_GIAC +--- a/src/first.h ++++ b/src/first.h +@@ -578,15 +578,6 @@ inline float ffloor(float f1){ + #endif + } + inline float finv(float f1){ return 1/f1; } +-#if defined HAVE_TGAMMAF || defined __APPLE__ || defined EMCC || defined EMCC2 || defined NO_BSD +-inline float fgamma(float f1){ return tgammaf(f1); } +-#else +-#if defined(__MINGW_H) || defined(VISUALC) || defined(FXCG)// FIXME gamma, not used +-inline float fgamma(float f1){ return f1; } +-#else +-inline float fgamma(float f1){ return gammaf(f1); } // or tgammaf(f1) on some versions of emscripten +-#endif +-#endif + #ifdef FXCG + inline float atan2f(float f1,float f2,int rad){ if (rad) return std::atan2(f1,f2); else return std::atan2(f1,f2)*180/3.14159265358979323846;} + #else diff --git a/srcpkgs/giac/template b/srcpkgs/giac/template index 6ba75e6372fdc..95fd2046917f9 100644 --- a/srcpkgs/giac/template +++ b/srcpkgs/giac/template @@ -1,7 +1,7 @@ # Template file for 'giac' pkgname=giac version=1.9.0.57 -revision=1 +revision=2 build_style=gnu-configure configure_args="--disable-micropy --disable-quickjs" hostmakedepends="automake gettext-devel libtool" @@ -56,6 +56,10 @@ pre_configure() { post_install() { # remove duplicates rm -r ${DESTDIR}/usr/share/doc + + echo "giac: check that '#include ' works (see #45708)" + echo '#include ' | + gcc -c -isystem "${DESTDIR}/usr/include" -xc++ - -o /dev/null } libgiac_package() {