git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #54127 from timokau/gap-improvements

gap: install libgap, add packageSet option

commit29e150d85fcacb90728af7247b9e622b0ffa6772 authorTimo Kaufmann <timokau@zoho.com> dateThu 17 Jan 2019, 20:38 (8 years ago) parent9aa46aecf63a8c
2 files changed+83−14
pkgs/applications/science/math/gap/default.nix+65−12 pkgs/top-level/all-packages.nix+18−2
pkgs/applications/science/math/gap/default.nix+65−12
@@ -5,11 +5,60 @@
55, makeWrapper
66, m4
77, gmp
8−# don't remove any packages -- results in a ~1.3G size increase
9−# see https://github.com/NixOS/nixpkgs/pull/38754 for a discussion
10−, keepAllPackages ? true
8+# one of
9+# - "minimal" (~400M):
10+# Install the bare minimum of packages required by gap to start.
11+# This is likely to break a lot of stuff. Do not expect upstream support with
12+# this configuration.
13+# - "standard" (~700M):
14+# Install the "standard packages" which gap autoloads by default. These
15+# packages are effectively considered a part of gap.
16+# - "full" (~1.7G):
17+# Install all available packages. This takes a lot of space.
18+, packageSet ? "standard"
19+# Kept for backwards compatibility. Overrides packageSet to "full".
20+, keepAllPackages ? false
1121}:
12−
22+let
23+ # packages absolutely required for gap to start
24+ # `*` represents the version where applicable
25+ requiredPackages = [
26+ "GAPDoc-*"
27+ "primgrp-*"
28+ "SmallGrp-*"
29+ "transgrp"
30+ ];
31+ # packages autoloaded by default if available
32+ autoloadedPackages = [
33+ "atlasrep"
34+ "autpgrp-*"
35+ "alnuth-*"
36+ "crisp-*"
37+ "ctbllib"
38+ "FactInt-*"
39+ "fga"
40+ "irredsol-*"
41+ "laguna-*"
42+ "polenta-*"
43+ "polycyclic-*"
44+ "resclasses-*"
45+ "sophus-*"
46+ "tomlib-*"
47+ ];
48+ standardPackages = requiredPackages ++ autoloadedPackages;
49+ keepAll = keepAllPackages || (packageSet == "full");
50+ packagesToKeep = requiredPackages ++ lib.optionals (packageSet == "standard") autoloadedPackages;
51+
52+ # Generate bash script that removes all packages from the `pkg` subdirectory
53+ # that are not on the whitelist. The whitelist consists of strings expected by
54+ # `find`'s `-name`.
55+ removeNonWhitelistedPkgs = whitelist: ''
56+ find pkg -type d -maxdepth 1 -mindepth 1 \
57+ '' + (lib.concatStringsSep "\n" (map (str: "-not -name '${str}' \\") whitelist)) + ''
58+ -exec echo "Removing package {}" \; \
59+ -exec rm -r '{}' \;
60+ '';
61+in
1362stdenv.mkDerivation rec {
1463 pname = "gap";
1564 # https://www.gap-system.org/Releases/
@@ -21,14 +70,8 @@ stdenv.mkDerivation rec {
2170 };
2271
2372 # remove all non-essential packages (which take up a lot of space)
24− preConfigure = ''
73+ preConfigure = lib.optionalString (!keepAll) (removeNonWhitelistedPkgs packagesToKeep) + ''
2574 patchShebangs .
26− '' + lib.optionalString (!keepAllPackages) ''
27− find pkg -type d -maxdepth 1 -mindepth 1 \
28− -not -name 'GAPDoc-*' \
29− -not -name 'autpgrp*' \
30− -exec echo "Removing package {}" \; \
31− -exec rm -r {} \;
3275 '';
3376
3477 configureFlags = [ "--with-gmp=system" ];
@@ -107,7 +150,16 @@ stdenv.mkDerivation rec {
107150 popd
108151 '';
109152
110− installPhase = ''
153+ installTargets = [
154+ "install-libgap"
155+ "install-headers"
156+ ];
157+
158+ # full `make install` is not yet implemented, just for libgap and headers
159+ postInstall = ''
160+ # Install config.h, which is not currently handled by `make install-headers`
161+ cp gen/config.h "$out/include/gap"
162+
111163 mkdir -p "$out/bin" "$out/share/gap/"
112164
113165 mkdir -p "$out/share/gap"
@@ -129,6 +181,7 @@ stdenv.mkDerivation rec {
129181 [
130182 raskin
131183 chrisjefferson
184+ timokau
132185 ];
133186 platforms = platforms.all;
134187 # keeping all packages increases the package size considerably, wchich
pkgs/top-level/all-packages.nix+18−2
@@ -10822,17 +10822,31 @@ in
1082210822
1082310823 libgadu = callPackage ../development/libraries/libgadu { };
1082410824
10825+ # Deprecated since gap itself now ships with a library component. This is
10826+ # still necessary for sage 8.5 but will be removed once we switch to sage
10827+ # 8.6.
1082510828 gap-libgap-compatible = let
1082610829 version = "4r8p6";
1082710830 pkgVer = "2016_11_12-14_25";
1082810831 in
10829− (gap.override { keepAllPackages = false; }).overrideAttrs (oldAttrs: {
10832+ (gap.override { packageSet = "minimal"; }).overrideAttrs (oldAttrs: {
1083010833 name = "libgap-${oldAttrs.pname}-${version}";
1083110834 inherit version;
1083210835 src = fetchurl {
1083310836 url = "https://www.gap-system.org/pub/gap/gap48/tar.bz2/gap${version}_${pkgVer}.tar.bz2";
1083410837 sha256 = "19n2p1mdg33s2x9rs51iak7rgndc1cwr56jyqnah0g1ydgg1yh6b";
1083510838 };
10839+ # libgap targets not yet available for 4r8p6
10840+ installPhase = ''
10841+ mkdir -p "$out/bin" "$out/share/gap/"
10842+
10843+ mkdir -p "$out/share/gap"
10844+ echo "Copying files to target directory"
10845+ cp -ar . "$out/share/gap/build-dir"
10846+
10847+ makeWrapper "$out/share/gap/build-dir/bin/gap.sh" "$out/bin/gap" \
10848+ --set GAP_DIR $out/share/gap/build-dir
10849+ '';
1083610850 patches = [
1083710851 # don't install any packages by default (needed for interop with libgap, probably obsolete with 4r10
1083810852 (fetchpatch {
@@ -22007,7 +22021,9 @@ in
2200722021
2200822022 gap = callPackage ../applications/science/math/gap { };
2200922023
22010− gap-minimal = lowPrio (gap.override { keepAllPackages = false; });
22024+ gap-minimal = lowPrio (gap.override { packageSet = "minimal"; });
22025+
22026+ gap-full = lowPrio (gap.override { packageSet = "full"; });
2201122027
2201222028 geogebra = callPackage ../applications/science/math/geogebra { };
2201322029