summary refs log tree commit diff
path: root/pkgs/development/compilers/sbcl/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/sbcl/default.nix')
-rw-r--r--pkgs/development/compilers/sbcl/default.nix94
1 files changed, 40 insertions, 54 deletions
diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix
index 288fdb33454..d3892d43d15 100644
--- a/pkgs/development/compilers/sbcl/default.nix
+++ b/pkgs/development/compilers/sbcl/default.nix
@@ -1,36 +1,21 @@
-a :  
-let 
-  fetchurl = a.fetchurl;
-  s= # Generated upstream information
-  rec {
-    baseName="sbcl";
-    version="1.1.12";
-    name="${baseName}-${version}";
-    hash="0mvl6lpi44yv6jv3xhyyzvf9g7bdlj691iz3ydpn66v0vg5i554c";
-    url="mirror://sourceforge/project/sbcl/sbcl/1.1.12/sbcl-1.1.12-source.tar.bz2";
-    sha256="0mvl6lpi44yv6jv3xhyyzvf9g7bdlj691iz3ydpn66v0vg5i554c";
-  };
-  buildInputs = with a; [
-    clisp makeWrapper
-  ];
-in
-rec {
-  src = a.fetchUrlFromSrcInfo s;
+{ stdenv, fetchurl, sbclBootstrap, clisp}:
 
-  inherit buildInputs;
-  configureFlags = [];
+stdenv.mkDerivation rec {
+  name    = "sbcl-${version}";
+  version = "1.2.0";
 
-  /* doConfigure should be removed if not needed */
-  phaseNames = ["setVars" "doFixNewer" "doFixTests" "setVersion" "doPatch" "doBuild" "doInstall" "doWrap"];
+  src = fetchurl {
+    url    = "mirror://sourceforge/project/sbcl/sbcl/${version}/${name}-source.tar.bz2";
+    sha256 = "13k20sys1v4lvgis8cnbczww6zs93rw176vz07g4jx06418k53x2";
+  };
 
-  setVars = a.fullDepEntry (''
-    export INSTALL_ROOT=$out
-    mkdir test-home
-    export HOME=$PWD/test-home
-  '') ["minInit"];
+  buildInputs = [ ]
+    ++ (stdenv.lib.optional stdenv.isDarwin sbclBootstrap)
+    ++ (stdenv.lib.optional stdenv.isLinux clisp)
+    ;
 
-  setVersion = a.fullDepEntry (''
-    echo '"${s.version}.nixos"' > version.lisp-expr
+  patchPhase = ''
+    echo '"${version}.nixos"' > version.lisp-expr
     echo "
     (lambda (features)
       (flet ((enable (x)
@@ -38,14 +23,11 @@ rec {
              (disable (x)
                (setf features (remove x features))))
         (enable :sb-thread))) " > customize-target-features.lisp
-  '') ["minInit" "doUnpack"];
 
-  /* SBCL checks whether files are up-to-date in many places.. Unfortunately, same timestamp 
-     is not good enought
-  */
-  doFixNewer = a.fullDepEntry(''
     pwd
 
+    # SBCL checks whether files are up-to-date in many places..
+    # Unfortunately, same timestamp is not good enough
     sed -e 's@> x y@>= x y@' -i contrib/sb-aclrepl/repl.lisp
     sed -e '/(date)/i((= date 2208988801) 2208988800)' -i contrib/asdf/asdf.lisp
     sed -i src/cold/slam.lisp -e \
@@ -56,13 +38,8 @@ rec {
       '/date defaulted-fasl/a)'
     sed -i src/code/target-load.lisp -e \
       '/date defaulted-source/i(or (and (= 2208988801 (file-write-date defaulted-source-truename)) (= 2208988801 (file-write-date defaulted-fasl-truename)))'
-  '') ["minInit" "doUnpack"];
 
-  doWrap = a.fullDepEntry (''
-    wrapProgram "$out/bin/sbcl" --set "SBCL_HOME" "$out/lib/sbcl"
-  '') ["minInit" "addInputs"];
-
-  doFixTests = a.fullDepEntry (''
+    # Fix the tests
     sed -e '/deftest pwent/inil' -i contrib/sb-posix/posix-tests.lisp
     sed -e '/deftest grent/inil' -i contrib/sb-posix/posix-tests.lisp
     sed -e '/deftest .*ent.non-existing/,+5d' -i contrib/sb-posix/posix-tests.lisp
@@ -70,24 +47,33 @@ rec {
 
     sed -e '5,$d' -i contrib/sb-bsd-sockets/tests.lisp
     sed -e '5,$d' -i contrib/sb-simple-streams/*test*.lisp
-  '') ["minInit" "doUnpack"];
+  '';
+
+  preBuild = ''
+    export INSTALL_ROOT=$out
+    mkdir -p test-home
+    export HOME=$PWD/test-home
+  '';
 
-  doBuild = a.fullDepEntry (''
-    sh make.sh clisp
-  '') ["minInit" "doUnpack" "addInputs"];
+  buildPhase = if stdenv.isLinux
+    then ''
+      sh make.sh clisp --prefix=$out
+    ''
+    else ''
+      sh make.sh --prefix=$out --xc-host='${sbclBootstrap}/bin/sbcl --core ${sbclBootstrap}/share/sbcl/sbcl.core --disable-debugger --no-userinit --no-sysinit'
+    '';
 
-  doInstall = a.fullDepEntry (''
-    sh install.sh
-  '') ["doBuild" "minInit" "addInputs"];
+  installPhase = ''
+    INSTALL_ROOT=$out sh install.sh
+  '';
 
-  inherit(s) name;
-  inherit(s) version;
   meta = {
     description = "Lisp compiler";
-    homepage = "http://www.sbcl.org";
-    license = "bsd";
-    maintainers = [a.lib.maintainers.raskin];
-    platforms = with a.lib.platforms; all;
-    inherit(s) version;
+    homepage = http://www.sbcl.org;
+    license = stdenv.lib.licenses.bsd3;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.all;
+    inherit version;
+    updateWalker = true;
   };
 }