Skip to content

Commit

Permalink
remove the need for faslExt by using output-file arg to compile-file
Browse files Browse the repository at this point in the history
  • Loading branch information
kgalkowski-comscore committed Jan 23, 2024
1 parent a26b5b3 commit 4702213
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
9 changes: 1 addition & 8 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ let

mkSpec = spec@{
pkg
, faslExt
, program ? pkg.pname
, flags ? ""
, asdf ? asdf_3_3_6
}: { inherit pkg faslExt program flags asdf; };
}: { inherit pkg program flags asdf; };

asdf_3_3_6 = pkgs.stdenv.mkDerivation rec {
pname = "asdf";
Expand All @@ -24,33 +23,27 @@ let

abclSpec = mkSpec {
pkg = abcl;
faslExt = "abcl";
};

eclSpec = mkSpec {
pkg = ecl;
faslExt = "fas";
};

cclSpec = mkSpec {
pkg = ccl;
faslExt = "lx64fsl";
};

sbclSpec = mkSpec {
pkg = sbcl;
faslExt = "fasl";
};

clispSpec = mkSpec {
pkg = clisp;
flags = "-E UTF-8";
faslExt = "fas";
};

claspSpec = mkSpec {
pkg = clasp;
faslExt = "fasp";
};

in pkgs.callPackage ./nix-cl.nix {
Expand Down
26 changes: 11 additions & 15 deletions nix-cl.nix
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,16 @@ let
}
else ff;

buildAsdf = { asdf, pkg, program, flags, faslExt }:
buildAsdf = { asdf, pkg, program, flags }:
stdenv.mkDerivation {
inherit (asdf) pname version;
inherit (asdf) pname;
version = "${asdf.version}-${pkg.pname}";
dontUnpack = true;
dontInstall = true;
buildPhase = ''
cp -v ${asdf} asdf.lisp
${pkg}/bin/${program} ${flags} < <(echo '(compile-file "asdf.lisp")')
'';
installPhase = ''
mkdir -p $out
cp -v asdf.${faslExt} $out
${pkg}/bin/${program} \
${flags} < \
<(echo "(compile-file \"${asdf}\" :output-file \"$out\")")
'';
};

Expand Down Expand Up @@ -124,9 +123,6 @@ let
# General flags to the Lisp executable
flags ? "",

# Extension for implementation-dependent FASL files
faslExt,

# ASDF amalgamation file to use
# Created in build/asdf.lisp by `make` in ASDF source tree
asdf,
Expand Down Expand Up @@ -158,7 +154,7 @@ let
stdenv.mkDerivation (rec {
inherit
pname version nativeLibs javaLibs lispLibs systems asds
pkg program flags faslExt
pkg program flags
;

# When src is null, we are building a lispWithPackages and only
Expand All @@ -180,11 +176,11 @@ let
# load-system. Strange.

# TODO(kasper) portable quit
asdfFasl = buildAsdf { inherit asdf pkg program flags faslExt; };
asdfFasl = buildAsdf { inherit asdf pkg program flags; };

buildScript = substituteAll {
src = ./builder.lisp;
asdf = "${asdfFasl}/asdf.${faslExt}";
asdf = "${asdfFasl}";
};

preConfigure = ''
Expand Down Expand Up @@ -285,7 +281,7 @@ let
${o.pkg}/bin/${o.program} \
$out/bin/${o.program} \
--add-flags "${o.flags}" \
--set ASDF "${o.asdfFasl}/asdf.${o.faslExt}" \
--set ASDF "${o.asdfFasl}" \
--prefix CL_SOURCE_REGISTRY : "$CL_SOURCE_REGISTRY" \
--prefix ASDF_OUTPUT_TRANSLATIONS : "$(echo $CL_SOURCE_REGISTRY | sed s,//:,::,g):" \
--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH" \
Expand Down

0 comments on commit 4702213

Please sign in to comment.