Github messages for voidlinux
 help / color / mirror / Atom feed
From: tornaria <tornaria@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] giac: fix `#include <giac/giac.h>` in musl
Date: Thu, 24 Aug 2023 03:47:53 +0200	[thread overview]
Message-ID: <20230824014753.-3ULQs8DEd7_mDKI2ada3y5_V8ggQkIeFchWm1vBjZU@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-45735@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1722 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages giac
https://github.com/void-linux/void-packages/pull/45735

giac: fix `#include <giac/giac.h>` in musl
As reported in https://github.com/void-linux/void-packages/pull/45708#issuecomment-1688333569, including <giac/giac.h> 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!

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/45735.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-giac-45735.patch --]
[-- Type: text/x-diff, Size: 3242 bytes --]

From 7bafbdda9475be560cf6cf86a54b6d65af2091d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Wed, 23 Aug 2023 09:46:02 -0300
Subject: [PATCH] giac: fix `#include <giac/giac.h>` in musl

As reported in #45708, including <giac/giac.h> 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..2bf270458e53a 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 <giac/giac.h>' works (see #45708)"
+	echo '#include <giac/giac.h>' |
+		${CC} -c -isystem "${DESTDIR}/usr/include" -xc++ - -o /dev/null
 }
 
 libgiac_package() {

  parent reply	other threads:[~2023-08-24  1:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23 22:51 [PR PATCH] " tornaria
2023-08-23 22:58 ` tornaria
2023-08-24  1:47 ` tornaria [this message]
2023-08-24  1:47 ` tornaria
2023-08-24  1:48 ` tornaria
2023-08-26 20:12 ` [PR PATCH] [Merged]: " leahneukirchen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230824014753.-3ULQs8DEd7_mDKI2ada3y5_V8ggQkIeFchWm1vBjZU@z \
    --to=tornaria@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).