From ea02d8a9a51734526dc88c422821a62db4fada94 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Tue, 24 Oct 2023 00:06:05 -0400 Subject: [PATCH 1/2] sbcl: support using CLISP as bootstrap host MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moves the bootstrap code into main derivation because it’s only used there, and this helps let the main derivation decide when to evaluate it in the first place (depending on the system), which helps on Hydra. Not actually enabled by default on any systems yet. --- pkgs/development/compilers/sbcl/2.x.nix | 71 +++++++++++++++++-- pkgs/development/compilers/sbcl/bootstrap.nix | 61 +--------------- pkgs/top-level/all-packages.nix | 4 -- 3 files changed, 68 insertions(+), 68 deletions(-) diff --git a/pkgs/development/compilers/sbcl/2.x.nix b/pkgs/development/compilers/sbcl/2.x.nix index a4de7b8b876f..bd52b41dc809 100644 --- a/pkgs/development/compilers/sbcl/2.x.nix +++ b/pkgs/development/compilers/sbcl/2.x.nix @@ -1,5 +1,4 @@ -{ lib, stdenv, fetchurl, fetchpatch, writeText, sbclBootstrap, zstd -, sbclBootstrapHost ? "${sbclBootstrap}/bin/sbcl --disable-debugger --no-userinit --no-sysinit" +{ lib, stdenv, callPackage, clisp, fetchurl, fetchpatch, writeText, zstd , threadSupport ? (stdenv.hostPlatform.isx86 || "aarch64-linux" == stdenv.hostPlatform.system || "aarch64-darwin" == stdenv.hostPlatform.system) , linkableRuntime ? stdenv.hostPlatform.isx86 , disableImmobileSpace ? false @@ -26,8 +25,62 @@ let sha256 = "sha256-fSiakSMgIgKL8BKJAMMr8A5MVDDDLyivBZTIpZKphlQ="; }; }; + # Collection of pre-built SBCL binaries for platforms that need them for + # bootstrapping. Ideally these are to be avoided. If CLISP (or any other + # non-binary-distributed Lisp) can run on any of these systems, that entry + # should be removed from this list. + bootstrapBinaries = rec { + aarch64-darwin = { + version = "2.1.2"; + system = "arm64-darwin"; + sha256 = "sha256-H0ALigXcWIypdA+fTf7jERscwbb7QIAfcoxCtGDh0RU="; + }; + x86_64-darwin = { + version = "2.2.9"; + system = "x86-64-darwin"; + sha256 = "sha256-b1BLkoLIOELAYBYA9eBmMgm1OxMxJewzNP96C9ADfKY="; + }; + x86_64-linux = { + version = "1.3.16"; + system = "x86-64-linux"; + sha256 = "0sq2dylwwyqfwkbdvcgqwz3vay9v895zpb0fyzsiwy31d1x9pr2s"; + }; + i686-linux = { + version = "1.2.7"; + system = "x86-linux"; + sha256 = "07f3bz4br280qvn85i088vpzj9wcz8wmwrf665ypqx181pz2ai3j"; + }; + aarch64-linux = { + version = "1.3.16"; + system = "arm64-linux"; + sha256 = "0q1brz9c49xgdljzfx8rpxxnlwhadxkcy5kg0mcd9wnxygind1cl"; + }; + armv7l-linux = { + version = "1.2.14"; + system = "armhf-linux"; + sha256 = "0sp5445rbvms6qvzhld0kwwvydw51vq5iaf4kdqsf2d9jvaz3yx5"; + }; + armv6l-linux = armv7l-linux; + x86_64-freebsd = { + version = "1.2.7"; + system = "x86-64-freebsd"; + sha256 = "14k42xiqd2rrim4pd5k5pjcrpkac09qnpynha8j1v4jngrvmw7y6"; + }; + x86_64-solaris = { + version = "1.2.7"; + system = "x86-64-solaris"; + sha256 = "05c12fmac4ha72k1ckl6i780rckd7jh4g5s5hiic7fjxnf1kx8d0"; + }; + }; + sbclBootstrap = callPackage ./bootstrap.nix { + cfg = bootstrapBinaries.${stdenv.hostPlatform.system}; + }; + bootstrapLisp = + if (builtins.hasAttr stdenv.hostPlatform.system bootstrapBinaries) + then "${sbclBootstrap}/bin/sbcl --disable-debugger --no-userinit --no-sysinit" + else "${clisp}/bin/clisp -E UTF-8 --silent -norc"; -in with versionMap.${version}; +in stdenv.mkDerivation rec { pname = "sbcl"; @@ -35,7 +88,7 @@ stdenv.mkDerivation rec { src = fetchurl { url = "mirror://sourceforge/project/sbcl/sbcl/${version}/${pname}-${version}-source.tar.bz2"; - inherit sha256; + inherit (versionMap.${version}) sha256; }; nativeBuildInputs = [ texinfo ]; @@ -108,7 +161,7 @@ stdenv.mkDerivation rec { buildPhase = '' runHook preBuild - sh make.sh --prefix=$out --xc-host="${sbclBootstrapHost}" ${ + sh make.sh --prefix=$out --xc-host="${bootstrapLisp}" ${ lib.concatStringsSep " " (builtins.map (x: "--with-${x}") enableFeatures ++ builtins.map (x: "--without-${x}") disableFeatures) @@ -142,5 +195,11 @@ stdenv.mkDerivation rec { } ''); - meta = sbclBootstrap.meta; + meta = with lib; { + description = "Lisp compiler"; + homepage = "https://sbcl.org"; + license = licenses.publicDomain; # and FreeBSD + maintainers = lib.teams.lisp.members; + platforms = attrNames bootstrapBinaries; + }; } diff --git a/pkgs/development/compilers/sbcl/bootstrap.nix b/pkgs/development/compilers/sbcl/bootstrap.nix index 05634d0c83f3..e23557c5a62f 100644 --- a/pkgs/development/compilers/sbcl/bootstrap.nix +++ b/pkgs/development/compilers/sbcl/bootstrap.nix @@ -1,59 +1,12 @@ -{ lib, stdenv, fetchurl, makeWrapper }: +{ lib, stdenv, fetchurl, makeWrapper, cfg }: -let - options = rec { - aarch64-darwin = { - version = "2.1.2"; - system = "arm64-darwin"; - sha256 = "sha256-H0ALigXcWIypdA+fTf7jERscwbb7QIAfcoxCtGDh0RU="; - }; - x86_64-darwin = { - version = "2.2.9"; - system = "x86-64-darwin"; - sha256 = "sha256-b1BLkoLIOELAYBYA9eBmMgm1OxMxJewzNP96C9ADfKY="; - }; - x86_64-linux = { - version = "1.3.16"; - system = "x86-64-linux"; - sha256 = "0sq2dylwwyqfwkbdvcgqwz3vay9v895zpb0fyzsiwy31d1x9pr2s"; - }; - i686-linux = { - version = "1.2.7"; - system = "x86-linux"; - sha256 = "07f3bz4br280qvn85i088vpzj9wcz8wmwrf665ypqx181pz2ai3j"; - }; - aarch64-linux = { - version = "1.3.16"; - system = "arm64-linux"; - sha256 = "0q1brz9c49xgdljzfx8rpxxnlwhadxkcy5kg0mcd9wnxygind1cl"; - }; - armv7l-linux = { - version = "1.2.14"; - system = "armhf-linux"; - sha256 = "0sp5445rbvms6qvzhld0kwwvydw51vq5iaf4kdqsf2d9jvaz3yx5"; - }; - armv6l-linux = armv7l-linux; - x86_64-freebsd = { - version = "1.2.7"; - system = "x86-64-freebsd"; - sha256 = "14k42xiqd2rrim4pd5k5pjcrpkac09qnpynha8j1v4jngrvmw7y6"; - }; - x86_64-solaris = { - version = "1.2.7"; - system = "x86-64-solaris"; - sha256 = "05c12fmac4ha72k1ckl6i780rckd7jh4g5s5hiic7fjxnf1kx8d0"; - }; - }; - cfg = options.${stdenv.hostPlatform.system}; -in -assert builtins.hasAttr stdenv.hostPlatform.system options; stdenv.mkDerivation rec { pname = "sbcl-bootstrap"; - version = cfg.version; + inherit (cfg) version; src = fetchurl { url = "mirror://sourceforge/project/sbcl/sbcl/${version}/sbcl-${version}-${cfg.system}-binary.tar.bz2"; - sha256 = cfg.sha256; + inherit (cfg) sha256; }; nativeBuildInputs = [ makeWrapper ]; @@ -73,12 +26,4 @@ stdenv.mkDerivation rec { postFixup = lib.optionalString (!stdenv.isAarch32 && stdenv.isLinux) '' patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $out/share/sbcl/sbcl ''; - - meta = with lib; { - description = "Lisp compiler"; - homepage = "http://www.sbcl.org"; - license = licenses.publicDomain; # and FreeBSD - maintainers = lib.teams.lisp.members; - platforms = attrNames options; - }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6909a953e36f..9b2360c30bca 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26063,10 +26063,6 @@ with pkgs; }; # Steel Bank Common Lisp - sbclBootstrap = wrapLisp { - pkg = callPackage ../development/compilers/sbcl/bootstrap.nix {}; - faslExt = "fasl"; - }; sbcl_2_3_8 = wrapLisp { pkg = callPackage ../development/compilers/sbcl/2.x.nix { version = "2.3.8"; }; faslExt = "fasl"; From 4106d42ac16f18153a6efc9c6e502f7bf429125a Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Wed, 25 Oct 2023 23:30:18 -0400 Subject: [PATCH 2/2] sbcl: CLISP bootstrap host for default systems --- pkgs/development/compilers/sbcl/2.x.nix | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/pkgs/development/compilers/sbcl/2.x.nix b/pkgs/development/compilers/sbcl/2.x.nix index bd52b41dc809..8156c48256b0 100644 --- a/pkgs/development/compilers/sbcl/2.x.nix +++ b/pkgs/development/compilers/sbcl/2.x.nix @@ -30,31 +30,17 @@ let # non-binary-distributed Lisp) can run on any of these systems, that entry # should be removed from this list. bootstrapBinaries = rec { - aarch64-darwin = { - version = "2.1.2"; - system = "arm64-darwin"; - sha256 = "sha256-H0ALigXcWIypdA+fTf7jERscwbb7QIAfcoxCtGDh0RU="; - }; + # This build segfaults using CLISP. x86_64-darwin = { version = "2.2.9"; system = "x86-64-darwin"; sha256 = "sha256-b1BLkoLIOELAYBYA9eBmMgm1OxMxJewzNP96C9ADfKY="; }; - x86_64-linux = { - version = "1.3.16"; - system = "x86-64-linux"; - sha256 = "0sq2dylwwyqfwkbdvcgqwz3vay9v895zpb0fyzsiwy31d1x9pr2s"; - }; i686-linux = { version = "1.2.7"; system = "x86-linux"; sha256 = "07f3bz4br280qvn85i088vpzj9wcz8wmwrf665ypqx181pz2ai3j"; }; - aarch64-linux = { - version = "1.3.16"; - system = "arm64-linux"; - sha256 = "0q1brz9c49xgdljzfx8rpxxnlwhadxkcy5kg0mcd9wnxygind1cl"; - }; armv7l-linux = { version = "1.2.14"; system = "armhf-linux"; @@ -200,6 +186,12 @@ stdenv.mkDerivation rec { homepage = "https://sbcl.org"; license = licenses.publicDomain; # and FreeBSD maintainers = lib.teams.lisp.members; - platforms = attrNames bootstrapBinaries; + platforms = attrNames bootstrapBinaries ++ [ + # These aren’t bootstrapped using the binary distribution but compiled + # using a separate (lisp) host + "x86_64-linux" + "aarch64-darwin" + "aarch64-linux" + ]; }; }