diff --git a/pkgs/development/compilers/sbcl/bootstrap.nix b/pkgs/development/compilers/sbcl/bootstrap.nix index 015d7dd95da8..8c1a6e27a769 100644 --- a/pkgs/development/compilers/sbcl/bootstrap.nix +++ b/pkgs/development/compilers/sbcl/bootstrap.nix @@ -1,24 +1,53 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchurl, makeWrapper }: +let + options = rec { + x86_64-darwin = rec { + version = "1.1.8"; + system = "x86-64-darwin"; + sha256 = "006pr88053wclvbjfjdypnbiw8wymbzdzi7a6kbkpdfn4zf5943j"; + }; + x86_64-linux = rec { + version = "1.2.15"; + system = "x86-64-linux"; + sha256 = "1bpbfz9x2w73hy2kh8p0kd4m1p6pin90h2zycq52r3bbz8yv47aw"; + }; + i686-linux = rec { + version = "1.2.7"; + system = "x86-linux"; + sha256 = "07f3bz4br280qvn85i088vpzj9wcz8wmwrf665ypqx181pz2ai3j"; + }; + armv7l-linux = rec { + version = "1.2.14"; + system = "armhf-linux"; + sha256 = "0sp5445rbvms6qvzhld0kwwvydw51vq5iaf4kdqsf2d9jvaz3yx5"; + }; + armv6l-linux = armv7l-linux; + }; + cfg = options.${stdenv.system}; +in stdenv.mkDerivation rec { name = "sbcl-bootstrap-${version}"; - version = "1.1.8"; + version = cfg.version; - src = if stdenv.isDarwin - then fetchurl { - url = mirror://sourceforge/project/sbcl/sbcl/1.1.8/sbcl-1.1.8-x86-64-darwin-binary.tar.bz2; - sha256 = "006pr88053wclvbjfjdypnbiw8wymbzdzi7a6kbkpdfn4zf5943j"; - } - else fetchurl { - url = mirror://sourceforge/project/sbcl/sbcl/1.1.8/sbcl-1.1.8-x86-64-linux-binary.tar.bz2; - sha256 = "0lh1jglxlfwk4cm6sgwk1jnb6ikhbrkx7p5aha2nbmkd6zl96prx"; - }; + src = fetchurl { + url = "mirror://sourceforge/project/sbcl/sbcl/${version}/sbcl-${version}-${cfg.system}-binary.tar.bz2"; + sha256 = cfg.sha256; + }; + + buildInputs = [ makeWrapper ]; installPhase = '' - mkdir -p $out/bin - cp -p src/runtime/sbcl $out/bin mkdir -p $out/share/sbcl + cp -p src/runtime/sbcl $out/share/sbcl cp -p output/sbcl.core $out/share/sbcl + mkdir -p $out/bin + makeWrapper $out/share/sbcl/sbcl $out/bin/sbcl \ + --add-flags "--core $out/share/sbcl/sbcl.core" + ''; + + postFixup = if stdenv.isArm then "" else '' + patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $out/share/sbcl/sbcl ''; meta = { diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index c6d8db6751e9..534e54f03962 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, sbclBootstrap, clisp, which}: +{ stdenv, fetchurl, sbclBootstrap, sbclBootstrapHost ? "${sbclBootstrap}/bin/sbcl --disable-debugger --no-userinit --no-sysinit", which }: stdenv.mkDerivation rec { name = "sbcl-${version}"; @@ -9,10 +9,7 @@ stdenv.mkDerivation rec { sha256 = "0l8nrf5qnr8c9hr6bn1kd86mnr2s37b493azh9rrk3v59f56wnnr"; }; - buildInputs = [ which ] - ++ (stdenv.lib.optional stdenv.isDarwin sbclBootstrap) - ++ (stdenv.lib.optional stdenv.isLinux clisp) - ; + buildInputs = [ which ]; patchPhase = '' echo '"${version}.nixos"' > version.lisp-expr @@ -22,7 +19,10 @@ stdenv.mkDerivation rec { (pushnew x features)) (disable (x) (setf features (remove x features)))) - (enable :sb-thread))) " > customize-target-features.lisp + #-arm + (enable :sb-thread) + #+arm + (enable :arm))) " > customize-target-features.lisp pwd @@ -64,13 +64,9 @@ stdenv.mkDerivation rec { export HOME=$PWD/test-home ''; - 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' - ''; + buildPhase = '' + sh make.sh --prefix=$out --xc-host="${sbclBootstrapHost}" + ''; installPhase = '' INSTALL_ROOT=$out sh install.sh diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 654b02c4f493..7ca074899520 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4701,9 +4701,7 @@ let rustfmt = callPackage ../development/tools/rust/rustfmt { }; sbclBootstrap = callPackage ../development/compilers/sbcl/bootstrap.nix {}; - sbcl = callPackage ../development/compilers/sbcl { - clisp = clisp; - }; + sbcl = callPackage ../development/compilers/sbcl {}; # For StumpWM sbcl_1_2_5 = callPackage ../development/compilers/sbcl/1.2.5.nix { clisp = clisp;