2018-04-24 21:53:36 +00:00
|
|
|
{ stdenv
|
|
|
|
, makeWrapper
|
2018-11-12 22:28:29 +00:00
|
|
|
, sage-tests
|
|
|
|
, sage-with-env
|
|
|
|
, sagedoc
|
|
|
|
, withDoc
|
2018-04-24 21:53:36 +00:00
|
|
|
}:
|
|
|
|
|
2018-11-12 22:28:29 +00:00
|
|
|
# A wrapper that makes sure sage finds its docs (if they were build).
|
|
|
|
|
2018-04-24 21:53:36 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2018-11-12 22:28:29 +00:00
|
|
|
version = src.version;
|
|
|
|
name = "sage-${version}";
|
|
|
|
src = sage-with-env.env.lib.src;
|
2018-04-24 21:53:36 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
makeWrapper
|
2018-11-12 22:28:29 +00:00
|
|
|
|
|
|
|
# This is a hack to make sure sage-tests is evaluated. It doesn't acutally
|
|
|
|
# produce anything of value, it just decouples the tests from the build.
|
|
|
|
sage-tests
|
2018-04-24 21:53:36 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
unpackPhase = "#do nothing";
|
|
|
|
configurePhase = "#do nothing";
|
|
|
|
buildPhase = "#do nothing";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/bin"
|
2018-11-12 22:28:29 +00:00
|
|
|
makeWrapper "${sage-with-env}/bin/sage" "$out/bin/sage" \
|
|
|
|
--set SAGE_DOC_SRC_OVERRIDE "${src}/src/doc" ${
|
|
|
|
stdenv.lib.optionalString withDoc "--set SAGE_DOC_OVERRIDE ${sagedoc}/share/doc/sage"
|
|
|
|
}
|
2018-04-24 21:53:36 +00:00
|
|
|
'';
|
|
|
|
|
2018-11-12 22:28:29 +00:00
|
|
|
doInstallCheck = withDoc;
|
2018-04-24 21:53:36 +00:00
|
|
|
installCheckPhase = ''
|
|
|
|
export HOME="$TMPDIR/sage-home"
|
|
|
|
mkdir -p "$HOME"
|
2018-11-12 22:28:29 +00:00
|
|
|
"$out/bin/sage" -c 'browse_sage_doc._open("reference", testing=True)'
|
2018-04-24 21:53:36 +00:00
|
|
|
'';
|
2018-11-12 22:28:29 +00:00
|
|
|
|
|
|
|
passthru = {
|
|
|
|
tests = sage-tests;
|
|
|
|
doc = sagedoc;
|
|
|
|
lib = sage-with-env.env.lib;
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ timokau ];
|
|
|
|
};
|
2018-04-24 21:53:36 +00:00
|
|
|
}
|