2018-04-11 10:49:43 +01:00
|
|
|
{ stdenv
|
2018-12-29 15:05:56 +00:00
|
|
|
, lib
|
2018-04-11 10:49:43 +01:00
|
|
|
, fetchurl
|
|
|
|
, fetchpatch
|
2018-12-29 15:05:56 +00:00
|
|
|
, makeWrapper
|
2020-05-28 15:06:34 +01:00
|
|
|
, readline
|
2018-04-11 10:49:43 +01:00
|
|
|
, gmp
|
2019-01-16 23:17:27 +00:00
|
|
|
# one of
|
|
|
|
# - "minimal" (~400M):
|
|
|
|
# Install the bare minimum of packages required by gap to start.
|
|
|
|
# This is likely to break a lot of stuff. Do not expect upstream support with
|
|
|
|
# this configuration.
|
|
|
|
# - "standard" (~700M):
|
|
|
|
# Install the "standard packages" which gap autoloads by default. These
|
|
|
|
# packages are effectively considered a part of gap.
|
|
|
|
# - "full" (~1.7G):
|
|
|
|
# Install all available packages. This takes a lot of space.
|
|
|
|
, packageSet ? "standard"
|
|
|
|
# Kept for backwards compatibility. Overrides packageSet to "full".
|
|
|
|
, keepAllPackages ? false
|
2018-04-11 10:49:43 +01:00
|
|
|
}:
|
2019-01-16 23:17:27 +00:00
|
|
|
let
|
|
|
|
# packages absolutely required for gap to start
|
|
|
|
# `*` represents the version where applicable
|
|
|
|
requiredPackages = [
|
|
|
|
"GAPDoc-*"
|
|
|
|
"primgrp-*"
|
|
|
|
"SmallGrp-*"
|
|
|
|
"transgrp"
|
|
|
|
];
|
|
|
|
# packages autoloaded by default if available
|
|
|
|
autoloadedPackages = [
|
|
|
|
"atlasrep"
|
|
|
|
"autpgrp-*"
|
|
|
|
"alnuth-*"
|
|
|
|
"crisp-*"
|
|
|
|
"ctbllib"
|
|
|
|
"FactInt-*"
|
|
|
|
"fga"
|
|
|
|
"irredsol-*"
|
|
|
|
"laguna-*"
|
|
|
|
"polenta-*"
|
|
|
|
"polycyclic-*"
|
|
|
|
"resclasses-*"
|
|
|
|
"sophus-*"
|
|
|
|
"tomlib-*"
|
|
|
|
];
|
|
|
|
keepAll = keepAllPackages || (packageSet == "full");
|
|
|
|
packagesToKeep = requiredPackages ++ lib.optionals (packageSet == "standard") autoloadedPackages;
|
2012-03-08 18:23:47 +00:00
|
|
|
|
2019-01-16 23:17:27 +00:00
|
|
|
# Generate bash script that removes all packages from the `pkg` subdirectory
|
|
|
|
# that are not on the whitelist. The whitelist consists of strings expected by
|
|
|
|
# `find`'s `-name`.
|
|
|
|
removeNonWhitelistedPkgs = whitelist: ''
|
|
|
|
find pkg -type d -maxdepth 1 -mindepth 1 \
|
|
|
|
'' + (lib.concatStringsSep "\n" (map (str: "-not -name '${str}' \\") whitelist)) + ''
|
|
|
|
-exec echo "Removing package {}" \; \
|
|
|
|
-exec rm -r '{}' \;
|
|
|
|
'';
|
|
|
|
in
|
2015-07-21 12:19:38 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2018-04-11 10:49:43 +01:00
|
|
|
pname = "gap";
|
|
|
|
# https://www.gap-system.org/Releases/
|
2019-07-01 19:06:42 +01:00
|
|
|
version = "4.10.2";
|
2018-12-29 15:05:56 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2020-05-28 14:53:56 +01:00
|
|
|
url = "https://files.gap-system.org/gap-${lib.versions.major version}.${lib.versions.minor version}/tar.bz2/gap-${version}.tar.bz2";
|
2019-07-01 19:06:42 +01:00
|
|
|
sha256 = "0cp6ddk0469zzv1m1vair6gm27ic6c5m77ri8rn0znq3gaps6x94";
|
2015-07-21 12:19:38 +01:00
|
|
|
};
|
2012-03-08 18:23:47 +00:00
|
|
|
|
2018-04-11 10:49:43 +01:00
|
|
|
# remove all non-essential packages (which take up a lot of space)
|
2019-01-16 23:17:27 +00:00
|
|
|
preConfigure = lib.optionalString (!keepAll) (removeNonWhitelistedPkgs packagesToKeep) + ''
|
2018-12-29 15:05:56 +00:00
|
|
|
patchShebangs .
|
2018-04-11 10:49:43 +01:00
|
|
|
'';
|
|
|
|
|
2018-12-29 15:05:56 +00:00
|
|
|
buildInputs = [
|
2020-05-28 15:06:34 +01:00
|
|
|
readline
|
2018-12-29 15:05:56 +00:00
|
|
|
gmp
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
];
|
2018-04-11 10:49:43 +01:00
|
|
|
|
|
|
|
patches = [
|
2019-04-06 17:01:02 +01:00
|
|
|
# https://github.com/gap-system/gap/pull/3294
|
2018-12-29 15:05:56 +00:00
|
|
|
(fetchpatch {
|
2019-04-06 17:01:02 +01:00
|
|
|
name = "add-make-install-targets.patch";
|
|
|
|
url = "https://github.com/gap-system/gap/commit/3361c172e6c5ff3bb3f01ba9d6f1dd4ad42cea80.patch";
|
|
|
|
sha256 = "1kwp9qnfvmlbpf1c3rs6j5m2jz22rj7a4hb5x1gj9vkpiyn5pdyj";
|
2018-04-11 10:49:43 +01:00
|
|
|
})
|
2020-05-27 21:00:21 +01:00
|
|
|
|
|
|
|
# Fix for locale specific tests causing issues. Already upstream.
|
|
|
|
# Backport of https://github.com/gap-system/gap/pull/4022
|
|
|
|
# WHEN REMOVING: also remove the`rm tst/testinstall/strings.tst` line in
|
|
|
|
# `postPatch` below. That line is necessary since the patch is not intended
|
|
|
|
# for gap 4.10.
|
|
|
|
(fetchpatch {
|
|
|
|
name = "remove-locale-specific-tests.patch";
|
|
|
|
url = "https://github.com/gap-system/gap/commit/c18b0c4215b5212a2cc4f305e2d5b94ba716bee8.patch";
|
|
|
|
excludes = ["tst/testinstall/stringobj.tst"];
|
|
|
|
sha256 = "1mz5b4mbw2jdd1ypp5s0dy6pp0jsvwsxr2dm4kbkls20r1r192sc";
|
|
|
|
})
|
2018-04-11 10:49:43 +01:00
|
|
|
];
|
|
|
|
|
2020-05-27 21:00:21 +01:00
|
|
|
postPatch = ''
|
|
|
|
# File not covered by the remove-locale-specific-tests.patch patch above.
|
|
|
|
rm tst/testinstall/strings.tst
|
|
|
|
'';
|
|
|
|
|
2018-04-11 10:49:43 +01:00
|
|
|
# "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";
|
|
|
|
|
2018-12-29 15:05:56 +00:00
|
|
|
doInstallCheck = true;
|
2020-05-27 21:00:21 +01:00
|
|
|
installCheckTarget = "check";
|
2018-12-29 15:05:56 +00:00
|
|
|
|
|
|
|
preInstallCheck = ''
|
2018-04-11 10:49:43 +01:00
|
|
|
# gap tests check that the home directory exists
|
|
|
|
export HOME="$TMP/gap-home"
|
|
|
|
mkdir -p "$HOME"
|
2018-12-29 15:05:56 +00:00
|
|
|
|
|
|
|
# make sure gap is in PATH
|
|
|
|
export PATH="$out/bin:$PATH"
|
|
|
|
|
|
|
|
# make sure we don't accidentally use the wrong gap binary
|
|
|
|
rm -r bin
|
|
|
|
|
|
|
|
# like the defaults the Makefile, but use gap from PATH instead of the
|
|
|
|
# one from builddir
|
|
|
|
installCheckFlagsArray+=(
|
|
|
|
"TESTGAP=gap --quitonbreak -b -m 100m -o 1g -q -x 80 -r -A"
|
|
|
|
"TESTGAPauto=gap --quitonbreak -b -m 100m -o 1g -q -x 80 -r"
|
|
|
|
)
|
2018-04-11 10:49:43 +01:00
|
|
|
'';
|
|
|
|
|
2016-06-02 22:53:39 +01:00
|
|
|
postBuild = ''
|
|
|
|
pushd pkg
|
|
|
|
bash ../bin/BuildPackages.sh
|
|
|
|
popd
|
|
|
|
'';
|
2018-04-11 10:49:43 +01:00
|
|
|
|
2019-01-16 22:42:15 +00:00
|
|
|
installTargets = [
|
|
|
|
"install-libgap"
|
|
|
|
"install-headers"
|
|
|
|
];
|
|
|
|
|
|
|
|
# full `make install` is not yet implemented, just for libgap and headers
|
|
|
|
postInstall = ''
|
|
|
|
# Install config.h, which is not currently handled by `make install-headers`
|
|
|
|
cp gen/config.h "$out/include/gap"
|
|
|
|
|
2014-06-30 13:56:10 +01:00
|
|
|
mkdir -p "$out/bin" "$out/share/gap/"
|
2012-03-08 18:23:47 +00:00
|
|
|
|
2018-12-29 15:05:56 +00:00
|
|
|
mkdir -p "$out/share/gap"
|
|
|
|
echo "Copying files to target directory"
|
|
|
|
cp -ar . "$out/share/gap/build-dir"
|
2012-03-08 18:23:47 +00:00
|
|
|
|
2018-12-29 15:05:56 +00:00
|
|
|
makeWrapper "$out/share/gap/build-dir/bin/gap.sh" "$out/bin/gap" \
|
|
|
|
--set GAP_DIR $out/share/gap/build-dir
|
|
|
|
'';
|
2012-03-08 18:23:47 +00:00
|
|
|
|
2018-12-29 15:05:56 +00:00
|
|
|
preFixup = ''
|
|
|
|
# patchelf won't strip references to the build dir if it still exists
|
|
|
|
rm -rf pkg
|
2015-07-21 12:19:38 +01:00
|
|
|
'';
|
2014-07-28 10:43:20 +01:00
|
|
|
|
2018-12-29 15:05:56 +00:00
|
|
|
meta = with lib; {
|
2012-03-08 18:23:47 +00:00
|
|
|
description = "Computational discrete algebra system";
|
2015-07-21 12:19:38 +01:00
|
|
|
maintainers = with maintainers;
|
2012-03-08 18:23:47 +00:00
|
|
|
[
|
|
|
|
raskin
|
2016-06-02 22:53:39 +01:00
|
|
|
chrisjefferson
|
2019-01-16 22:41:31 +00:00
|
|
|
timokau
|
2012-03-08 18:23:47 +00:00
|
|
|
];
|
2016-06-02 22:53:39 +01:00
|
|
|
platforms = platforms.all;
|
2019-04-20 11:36:11 +01:00
|
|
|
broken = stdenv.isDarwin;
|
2020-05-28 14:57:31 +01:00
|
|
|
# keeping all packages increases the package size considerably, which is
|
|
|
|
# why a local build is preferable in that situation. The timeframe is
|
|
|
|
# reasonable and that way the binary cache doesn't get overloaded.
|
2018-12-29 15:05:56 +00:00
|
|
|
hydraPlatforms = lib.optionals (!keepAllPackages) meta.platforms;
|
2015-07-21 12:19:38 +01:00
|
|
|
license = licenses.gpl2;
|
2020-05-28 14:58:41 +01:00
|
|
|
homepage = "https://www.gap-system.org";
|
2012-03-08 18:23:47 +00:00
|
|
|
};
|
2015-07-21 12:19:38 +01:00
|
|
|
}
|