summary refs log tree commit diff
path: root/pkgs/applications/science
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2018-02-14 21:30:08 +0100
committerFrederik Rietdijk <fridh@fridh.nl>2018-02-14 21:30:08 +0100
commit672bb6b4abd27d9b2796152522b54f5b82c9f76b (patch)
tree5b6989f6f2e3bfea9673efa21ef30aa722ad001e /pkgs/applications/science
parente4bfe5aac94ce07115ea068e6b235ddf6e8e71ac (diff)
parent303c9794362acec6ce0142b8bcf878202717c99c (diff)
downloadnixpkgs-672bb6b4abd27d9b2796152522b54f5b82c9f76b.tar
nixpkgs-672bb6b4abd27d9b2796152522b54f5b82c9f76b.tar.gz
nixpkgs-672bb6b4abd27d9b2796152522b54f5b82c9f76b.tar.bz2
nixpkgs-672bb6b4abd27d9b2796152522b54f5b82c9f76b.tar.lz
nixpkgs-672bb6b4abd27d9b2796152522b54f5b82c9f76b.tar.xz
nixpkgs-672bb6b4abd27d9b2796152522b54f5b82c9f76b.tar.zst
nixpkgs-672bb6b4abd27d9b2796152522b54f5b82c9f76b.zip
Merge remote-tracking branch 'upstream/master' into HEAD
Diffstat (limited to 'pkgs/applications/science')
-rw-r--r--pkgs/applications/science/logic/z3/default.nix7
-rw-r--r--pkgs/applications/science/math/sage/default.nix31
2 files changed, 26 insertions, 12 deletions
diff --git a/pkgs/applications/science/logic/z3/default.nix b/pkgs/applications/science/logic/z3/default.nix
index 532df11209b..5eda2da6056 100644
--- a/pkgs/applications/science/logic/z3/default.nix
+++ b/pkgs/applications/science/logic/z3/default.nix
@@ -1,8 +1,6 @@
-{ stdenv, fetchFromGitHub, python2, fixDarwinDylibNames }:
+{ stdenv, fetchFromGitHub, python, fixDarwinDylibNames }:
 
-let
-  python = python2;
-in stdenv.mkDerivation rec {
+stdenv.mkDerivation rec {
   name = "z3-${version}";
   version = "4.6.0";
 
@@ -14,6 +12,7 @@ in stdenv.mkDerivation rec {
   };
 
   buildInputs = [ python fixDarwinDylibNames ];
+  propagatedBuildInputs = [ python.pkgs.setuptools ];
   enableParallelBuilding = true;
 
   configurePhase = ''
diff --git a/pkgs/applications/science/math/sage/default.nix b/pkgs/applications/science/math/sage/default.nix
index 686e93b5d5e..ee646fee2c2 100644
--- a/pkgs/applications/science/math/sage/default.nix
+++ b/pkgs/applications/science/math/sage/default.nix
@@ -29,6 +29,7 @@
 , texlive
 , texinfo
 , hevea
+, buildDocs ? false
 }:
 
 stdenv.mkDerivation rec {
@@ -87,7 +88,7 @@ stdenv.mkDerivation rec {
     # Sage installs during first `make`, `make install` is no-op and just takes time.
   '';
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" ] ++ stdenv.lib.optionals (buildDocs) [ "doc" ];
 
   buildInputs = [
     bash # needed for the build
@@ -135,13 +136,16 @@ stdenv.mkDerivation rec {
     # TODO could be patched with `sed s|printf(ctime(\(.*\)))|%s... or fixed upstream
   ];
 
+  configureFlags = stdenv.lib.optionals(buildDocs) [ "--docdir=$(doc)" ];
   preConfigure = ''
-    export SAGE_NUM_THREADS=$NIX_BUILD_CORES
+    export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
     export SAGE_ATLAS_ARCH=fast
 
-    export HOME=$out/sage-home
-    mkdir -p $out/sage-home
+    export HOME=/tmp/sage-home
+    export SAGE_ROOT="$PWD"
+    export SAGE_SRC="$PWD"
 
+    mkdir -p "$HOME"
     mkdir -p "$out"
 
     # we need to keep the source around
@@ -150,12 +154,18 @@ stdenv.mkDerivation rec {
     mv "$dir" "$out/sage-root"
 
     cd "$out/sage-root" # build in target dir, since `make` is also `make install`
+  ''
+  + stdenv.lib.optionalString (buildDocs) ''
+    mkdir -p "$doc"
+    export SAGE_DOC="$doc"
+    export SAGE_DOCBUILD_OPTS="--no-pdf-links -k"
+    export SAGE_SPKG_INSTALL_DOCS='no'
   '';
 
+  buildFlags = if (buildDocs) then "doc" else "build";
+
   # for reference: http://doc.sagemath.org/html/en/installation/source.html
   preBuild = ''
-    # TODO do this conditionally
-    export SAGE_SPKG_INSTALL_DOCS='no'
     # symlink python to make sure the shebangs are patched to the sage path
     # while still being able to use python before building it
     # (this is important because otherwise sage will try to install python
@@ -167,10 +177,15 @@ stdenv.mkDerivation rec {
   '';
 
   postBuild = ''
+    # Clean up
     rm -r "$out/sage-root/upstream" # don't keep the sources of all the spkgs
-    rm -r "$out/sage-root/src/build"
-    rm -rf "$out/sage-root/src/.git"
+    rm -rf "$out/sage-root/src/build"
+    rm -rf "$out/sage-root/src/autom4te.cache"
+    rm -rf "$out/sage-root/src/config"
+    rm -rf "$out/sage-root/src/m4"
+    rm -rf "$out/sage-root/.git"
     rm -r "$out/sage-root/logs"
+    rm -r "$out"/lib/python*/test
     # Fix dependency cycle between out and doc
     rm -f "$out/sage-root/config.log"
     rm -f "$out/sage-root/config.status"