commit 1521750ac3a0b758f5ebcb0e56cb03a90536e430
parent 7193f06810da939f0f2c80eb800cd78965787f22
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sun,  5 Jul 2015 14:18:08 +0200
refactor nix build
Diffstat:
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/default.nix b/default.nix
@@ -11,10 +11,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [sbcl ccl ecl mkcl];
 
-  buildPhase = ''
-    export ASDF_OUTPUT_TRANSLATIONS=/:$(pwd)/cache/:
-  ''
-  + (if "sbcl" == "${lisptype}" then ''
+  sbclBuild = ''
     sbcl \
       --lose-on-corruption \
       --disable-ldb \
@@ -25,31 +22,38 @@ stdenv.mkDerivation rec {
       --eval '(push (truename "./") asdf:*central-registry*)' \
       --eval '(require :cl-rw-demo-${demo})' \
       --eval '(rw.demo.${demo}::save-image)'
-  '' else "")
-  + (if "ccl" == "${lisptype}" then ''
+  '';
+  cclBuild = ''
     lx86cl64 -K utf-8 -n \
       -l "${ccl}/share/ccl-installation/tools/asdf" \
       -e '(push (truename "./") asdf:*central-registry*)' \
       -e '(require :cl-rw-demo-${demo})' \
       -e '(rw.demo.${demo}::save-image)'
-  '' else "")
-  + (if "ecl" == "${lisptype}" then ''
-    find ${ecl}
+  '';
+  eclBuild = ''
     ecl \
       -norc \
       -load "${ccl}/share/ccl-installation/tools/asdf" \
       -eval '(push (truename "./") asdf:*central-registry*)' \
       -eval '(require :cl-rw-demo-${demo})' \
       -eval '(rw.demo.${demo}::save-image)'
-  '' else "")
-  + (if "mkcl" == "${lisptype}" then ''
+  '';
+  mkclBuild = ''
     mkcl \
       -norc \
       -load "${ccl}/share/ccl-installation/tools/asdf" \
       -eval '(push (truename "./") asdf:*central-registry*)' \
       -eval '(require :cl-rw-demo-${demo})' \
       -eval '(rw.demo.${demo}::save-image)'
-  '' else "");
+  '';
+  buildPhase = ''
+    export ASDF_OUTPUT_TRANSLATIONS=/:$(pwd)/cache/:
+  ''
+  + (if "sbcl" == "${lisptype}" then sbclBuild
+     else if "ccl" == "${lisptype}" then cclBuild
+     else if "ecl" == "${lisptype}" then eclBuild
+     else if "mkcl" == "${lisptype}" then mkclBuild
+     else "");
 
   dontPatchELF = true;
   dontStrip = true;