Merge pull request #54127 from timokau/gap-improvements
gap: install libgap, add packageSet option
This commit is contained in:
commit
29e150d85f
@ -5,11 +5,60 @@
|
|||||||
, makeWrapper
|
, makeWrapper
|
||||||
, m4
|
, m4
|
||||||
, gmp
|
, gmp
|
||||||
# don't remove any packages -- results in a ~1.3G size increase
|
# one of
|
||||||
# see https://github.com/NixOS/nixpkgs/pull/38754 for a discussion
|
# - "minimal" (~400M):
|
||||||
, keepAllPackages ? true
|
# 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
|
||||||
}:
|
}:
|
||||||
|
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-*"
|
||||||
|
];
|
||||||
|
standardPackages = requiredPackages ++ autoloadedPackages;
|
||||||
|
keepAll = keepAllPackages || (packageSet == "full");
|
||||||
|
packagesToKeep = requiredPackages ++ lib.optionals (packageSet == "standard") autoloadedPackages;
|
||||||
|
|
||||||
|
# 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
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "gap";
|
pname = "gap";
|
||||||
# https://www.gap-system.org/Releases/
|
# https://www.gap-system.org/Releases/
|
||||||
@ -21,14 +70,8 @@ stdenv.mkDerivation rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
# remove all non-essential packages (which take up a lot of space)
|
# remove all non-essential packages (which take up a lot of space)
|
||||||
preConfigure = ''
|
preConfigure = lib.optionalString (!keepAll) (removeNonWhitelistedPkgs packagesToKeep) + ''
|
||||||
patchShebangs .
|
patchShebangs .
|
||||||
'' + 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" ];
|
configureFlags = [ "--with-gmp=system" ];
|
||||||
@ -107,7 +150,16 @@ stdenv.mkDerivation rec {
|
|||||||
popd
|
popd
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
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"
|
||||||
|
|
||||||
mkdir -p "$out/bin" "$out/share/gap/"
|
mkdir -p "$out/bin" "$out/share/gap/"
|
||||||
|
|
||||||
mkdir -p "$out/share/gap"
|
mkdir -p "$out/share/gap"
|
||||||
@ -129,6 +181,7 @@ stdenv.mkDerivation rec {
|
|||||||
[
|
[
|
||||||
raskin
|
raskin
|
||||||
chrisjefferson
|
chrisjefferson
|
||||||
|
timokau
|
||||||
];
|
];
|
||||||
platforms = platforms.all;
|
platforms = platforms.all;
|
||||||
# keeping all packages increases the package size considerably, wchich
|
# keeping all packages increases the package size considerably, wchich
|
||||||
|
@ -10822,17 +10822,31 @@ in
|
|||||||
|
|
||||||
libgadu = callPackage ../development/libraries/libgadu { };
|
libgadu = callPackage ../development/libraries/libgadu { };
|
||||||
|
|
||||||
|
# Deprecated since gap itself now ships with a library component. This is
|
||||||
|
# still necessary for sage 8.5 but will be removed once we switch to sage
|
||||||
|
# 8.6.
|
||||||
gap-libgap-compatible = let
|
gap-libgap-compatible = let
|
||||||
version = "4r8p6";
|
version = "4r8p6";
|
||||||
pkgVer = "2016_11_12-14_25";
|
pkgVer = "2016_11_12-14_25";
|
||||||
in
|
in
|
||||||
(gap.override { keepAllPackages = false; }).overrideAttrs (oldAttrs: {
|
(gap.override { packageSet = "minimal"; }).overrideAttrs (oldAttrs: {
|
||||||
name = "libgap-${oldAttrs.pname}-${version}";
|
name = "libgap-${oldAttrs.pname}-${version}";
|
||||||
inherit version;
|
inherit version;
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://www.gap-system.org/pub/gap/gap48/tar.bz2/gap${version}_${pkgVer}.tar.bz2";
|
url = "https://www.gap-system.org/pub/gap/gap48/tar.bz2/gap${version}_${pkgVer}.tar.bz2";
|
||||||
sha256 = "19n2p1mdg33s2x9rs51iak7rgndc1cwr56jyqnah0g1ydgg1yh6b";
|
sha256 = "19n2p1mdg33s2x9rs51iak7rgndc1cwr56jyqnah0g1ydgg1yh6b";
|
||||||
};
|
};
|
||||||
|
# libgap targets not yet available for 4r8p6
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p "$out/bin" "$out/share/gap/"
|
||||||
|
|
||||||
|
mkdir -p "$out/share/gap"
|
||||||
|
echo "Copying files to target directory"
|
||||||
|
cp -ar . "$out/share/gap/build-dir"
|
||||||
|
|
||||||
|
makeWrapper "$out/share/gap/build-dir/bin/gap.sh" "$out/bin/gap" \
|
||||||
|
--set GAP_DIR $out/share/gap/build-dir
|
||||||
|
'';
|
||||||
patches = [
|
patches = [
|
||||||
# don't install any packages by default (needed for interop with libgap, probably obsolete with 4r10
|
# don't install any packages by default (needed for interop with libgap, probably obsolete with 4r10
|
||||||
(fetchpatch {
|
(fetchpatch {
|
||||||
@ -22007,7 +22021,9 @@ in
|
|||||||
|
|
||||||
gap = callPackage ../applications/science/math/gap { };
|
gap = callPackage ../applications/science/math/gap { };
|
||||||
|
|
||||||
gap-minimal = lowPrio (gap.override { keepAllPackages = false; });
|
gap-minimal = lowPrio (gap.override { packageSet = "minimal"; });
|
||||||
|
|
||||||
|
gap-full = lowPrio (gap.override { packageSet = "full"; });
|
||||||
|
|
||||||
geogebra = callPackage ../applications/science/math/geogebra { };
|
geogebra = callPackage ../applications/science/math/geogebra { };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user