Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sage: Fix on Darwin #264126

Merged
merged 9 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkgs/applications/science/math/gap/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ stdenv
, lib
, fetchpatch
, fetchurl
, makeWrapper
, readline
Expand Down Expand Up @@ -73,6 +74,13 @@ stdenv.mkDerivation rec {
sha256 = "sha256-ZyMIdF63iiIklO6N1nhu3VvDMUVvzGRWrAZL2yjVh6g=";
};

patches = [
(fetchpatch {
url = "https://github.com/gap-system/gap/commit/c786e229413a44b7462196716b99ae9bb0071f4c.patch";
hash = "sha256-g3jrEMSavHAUKlHoPqWmOw49hWHU+29SA788Klnr0Uw=";
})
];

# remove all non-essential packages (which take up a lot of space)
preConfigure = lib.optionalString (!keepAll) (removeNonWhitelistedPkgs packagesToKeep) + ''
patchShebangs .
Expand Down
8 changes: 7 additions & 1 deletion pkgs/applications/science/math/gfan/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{lib, stdenv, fetchurl, gmp, mpir, cddlib}:
{lib, stdenv, fetchpatch, fetchurl, gmp, mpir, cddlib}:
stdenv.mkDerivation rec {
pname = "gfan";
version = "0.6.2";
Expand All @@ -10,6 +10,12 @@ stdenv.mkDerivation rec {

patches = [
./gfan-0.6.2-cddlib-prefix.patch
] ++ lib.optionals (stdenv.cc.isClang) [
(fetchpatch {
name = "clang-fix-miscompilation.patch";
url = "https://github.com/sagemath/sage/eea1f59394a5066e9acd8ae39a90302820914ee3/build/pkgs/gfan/patches/nodel.patch";
sha256 = "sha256-RrncSgFyrBIk/Bwe3accxiJ2rpOSJKQ84cV/uBvQsDc=";
})
];

postPatch = lib.optionalString stdenv.cc.isClang ''
Expand Down
39 changes: 31 additions & 8 deletions pkgs/applications/science/math/giac/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,30 @@ assert (!blas.isILP64) && (!lapack.isILP64);

stdenv.mkDerivation rec {
pname = "giac${lib.optionalString enableGUI "-with-xcas"}";
version = "1.9.0-43"; # TODO try to remove preCheck phase on upgrade
version = "1.9.0-993"; # TODO try to remove preCheck phase on upgrade

src = fetchurl {
url = "https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/giac_${version}.tar.gz";
sha256 = "sha256-466jB8ZRqHkU5XCY+j0Fh7Dq/mMaOu10rHECKbtNGrs=";
sha256 = "sha256-pqytFWrSWfEwQqRdRbaigGCq68s8mdgj2j8M+kclslE=";
};

patches = [
./remove-old-functional-patterns.patch
Feyorsh marked this conversation as resolved.
Show resolved Hide resolved
./fix-fltk-guard.patch

(fetchpatch {
name = "pari_2_15.patch";
url = "https://github.com/sagemath/sage/07a2afd65fb4b0a1c9cbc43ede7d4a18c921a000/build/pkgs/giac/patches/pari_2_15.patch";
sha256 = "sha256-Q3xBFED7XEAyNz6AHjzt63XtospmdGAIdS6iPq1C2UE=";
})

(fetchpatch {
name = "pari_2_11.patch";
url = "https://github.com/sagemath/sage/21ba7540d385a9864b44850d6987893dfa16bfc0/build/pkgs/giac/patches/pari_2_11.patch";
sha256 = "sha256-vEo/5MNzMdYRPWgLFPsDcMT1W80Qzj4EPBjx/B8j68k=";
name = "infinity.patch";
url = "https://github.com/geogebra/giac/commit/851c2cd91e879c79d6652f8a5d5bed03b65c6d39.patch";
sha256 = "sha256-WJRT2b8I9kgAkRuIugMiXoF4hT7yR7qyad8A6IspNTM=";
stripLen = 5;
extraPrefix = "/src/";
excludes = [ "src/kdisplay.cc" ];
})

# giac calls scanf/printf with non-constant first arguments, which
Expand All @@ -31,8 +43,12 @@ stdenv.mkDerivation rec {
sha256 = "sha256-r+M+9MRPRqhHcdhYWI6inxyNvWbXUbBcPCeDY7aulvk=";
})

# increase pari stack size for test chk_fhan{4,6}
./increase-pari-stack-size.patch
# issue with include path precedence
(fetchpatch {
name = "fix_implicit_declaration.patch";
url = "https://salsa.debian.org/science-team/giac/-/raw/c05ae9b9e74d3c6ee6411d391071989426a76201/debian/patches/fix_implicit_declaration.patch";
sha256 = "sha256-ompUceYJLiL0ftfjBkIMcYvX1YqG2/XA7e1yDyFY0IY=";
})
] ++ lib.optionals (!enableGUI) [
# when enableGui is false, giac is compiled without fltk. That
# means some outputs differ in the make check. Patch around this:
Expand Down Expand Up @@ -86,6 +102,12 @@ stdenv.mkDerivation rec {
# when fltk is disabled. disable these tests for now.
echo > check/chk_fhan2
echo > check/chk_fhan9
'' + lib.optionalString (stdenv.isDarwin) ''
# these cover a known regression in giac, likely due to how pari state
# is shared between multiple giac instances (see pari.cc.old).
# see https://github.com/NixOS/nixpkgs/pull/264126 for more information
echo > check/chk_fhan4
echo > check/chk_fhan6
'';

enableParallelBuilding = true;
Expand All @@ -96,6 +118,8 @@ stdenv.mkDerivation rec {
"--enable-ao" "--enable-ecm" "--enable-glpk"
] ++ lib.optionals enableGUI [
"--enable-gui" "--with-x"
] ++ lib.optionals stdenv.isDarwin [
"--disable-nls"
] ++ lib.optionals (!enableGUI) [
"--disable-fltk"
] ++ lib.optionals (!enableMicroPy) [
Expand Down Expand Up @@ -129,7 +153,6 @@ stdenv.mkDerivation rec {
homepage = "https://www-fourier.ujf-grenoble.fr/~parisse/giac.html";
license = licenses.gpl3Plus;
platforms = platforms.linux ++ (optionals (!enableGUI) platforms.darwin);
broken = stdenv.isDarwin && stdenv.isAarch64;
maintainers = [ maintainers.symphorien ];
};
}
28 changes: 28 additions & 0 deletions pkgs/applications/science/math/giac/fix-fltk-guard.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From c7eafa2d7bde0d735b125912542acec2d5896c17 Mon Sep 17 00:00:00 2001
From: George Huebner <george@feyor.sh>
Date: Sat, 20 Jul 2024 02:31:20 -0500
Subject: [PATCH 3/4] remove erroneous HAVE_LIBFLTK guard

---
src/icas.cc | 4 ----
1 file changed, 4 deletions(-)

diff --git a/src/icas.cc b/src/icas.cc
index f91885b..17a0373 100644
--- a/src/icas.cc
+++ b/src/icas.cc
@@ -2407,11 +2407,7 @@ int main(int ARGC, char *ARGV[]){
#ifdef __APPLE__
startc=clock();
#endif
-#ifdef HAVE_LIBFLTK
xcas::icas_eval(gq,e,reading_file,filename,contextptr);
-#else
- e=eval(gq,1,contextptr);
-#endif
#ifdef __APPLE__
startc=clock()-startc;
#endif
--
2.44.1

18 changes: 0 additions & 18 deletions pkgs/applications/science/math/giac/increase-pari-stack-size.patch

This file was deleted.

Loading