about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/math/gap
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/applications/science/math/gap
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/applications/science/math/gap')
-rw-r--r--nixpkgs/pkgs/applications/science/math/gap/default.nix103
1 files changed, 103 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/science/math/gap/default.nix b/nixpkgs/pkgs/applications/science/math/gap/default.nix
new file mode 100644
index 000000000000..2927701dbd71
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/math/gap/default.nix
@@ -0,0 +1,103 @@
+{ stdenv
+, fetchurl
+, fetchpatch
+, m4
+, gmp
+# don't remove any packages -- results in a ~1.3G size increase
+# see https://github.com/NixOS/nixpkgs/pull/38754 for a discussion
+, keepAllPackages ? true
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gap";
+  # https://www.gap-system.org/Releases/
+  # newer versions (4.9.0) are available, but still considered beta (https://github.com/gap-system/gap/wiki/GAP-4.9-release-notes)
+  version = "4r8p10";
+  pkgVer = "2018_01_15-13_02";
+  name = "${pname}-${version}";
+
+  src = let
+    # 4r8p10 -> 48
+    majorminor = stdenv.lib.replaceStrings ["r"] [""] (
+      builtins.head (stdenv.lib.splitString "p" version) # 4r8p10 -> 4r8
+    );
+  in
+    fetchurl {
+    url = "https://www.gap-system.org/pub/gap/gap${majorminor}/tar.bz2/gap${version}_${pkgVer}.tar.bz2";
+    sha256 = "0wzfdjnn6sfiaizbk5c7x44rhbfayis4lf57qbqqg84c7dqlwr6f";
+  };
+
+  # remove all non-essential packages (which take up a lot of space)
+  preConfigure = stdenv.lib.optionalString (!keepAllPackages) ''
+    find pkg -type d -maxdepth 1 -mindepth 1 \
+       -not -name 'GAPDoc-*' \
+       -not -name 'autpgrp*' \
+       -exec echo "Removing package {}" \; \
+       -exec rm -r {} \;
+  '';
+
+  configureFlags = [ "--with-gmp=system" ];
+  buildInputs = [ m4 gmp ];
+
+  patches = [
+    #  fix infinite loop in writeandcheck() when writing an error message fails.
+    (fetchpatch {
+      url = "https://git.sagemath.org/sage.git/plain/build/pkgs/gap/patches/writeandcheck.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
+      sha256 = "1r1511x4kc2i2mbdq1b61rb6p3misvkf1v5qy3z6fmn6vqwziaz1";
+    })
+  ];
+
+  doCheck = true;
+  checkTarget = "testinstall";
+  # "teststandard" is a superset of testinstall. It takes ~1h instead of ~1min.
+  # tests are run twice, once with all packages loaded and once without
+  # checkTarget = "teststandard";
+
+  preCheck = ''
+    # gap tests check that the home directory exists
+    export HOME="$TMP/gap-home"
+    mkdir -p "$HOME"
+  '';
+
+  postCheck = ''
+    # The testsuite doesn't exit with a non-zero exit code on failure.
+    # It leaves its logs in dev/log however.
+
+    # grep for error messages
+    if grep ^##### dev/log/*; then
+        exit 1
+    fi
+  '';
+
+  postBuild = ''
+    pushd pkg
+    bash ../bin/BuildPackages.sh
+    popd
+  '';
+
+  installPhase = ''
+    mkdir -p "$out/bin" "$out/share/gap/"
+
+    cp -r . "$out/share/gap/build-dir"
+
+    sed -e "/GAP_DIR=/aGAP_DIR='$out/share/gap/build-dir/'" -i "$out/share/gap/build-dir/bin/gap.sh"
+
+    ln -s "$out/share/gap/build-dir/bin/gap.sh" "$out/bin/gap"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Computational discrete algebra system";
+    maintainers = with maintainers;
+    [
+      raskin
+      chrisjefferson
+    ];
+    platforms = platforms.all;
+    # keeping all packages increases the package size considerably, wchich
+    # is why a local build is preferable in that situation. The timeframe
+    # is reasonable and that way the binary cache doesn't get overloaded.
+    hydraPlatforms = stdenv.lib.optionals (!keepAllPackages) meta.platforms;
+    license = licenses.gpl2;
+    homepage = http://gap-system.org/;
+  };
+}