lol
1{ stdenv, buildPackages, callPackage }:
2
3let
4 chezSystemMap = {
5 # See `/workarea` of source code for list of systems
6 "aarch64-darwin" = "tarm64osx";
7 "aarch64-linux" = "tarm64le";
8 "armv7l-linux" = "tarm32le";
9 "x86_64-darwin" = "ta6osx";
10 "x86_64-linux" = "ta6le";
11 };
12 inherit (stdenv.hostPlatform) system;
13 chezSystem = chezSystemMap.${system} or (throw "Add ${system} to chezSystemMap to enable building chez-racket");
14 # Chez Scheme uses an ad-hoc `configure`, hence we don't use the usual
15 # stdenv abstractions.
16 forBoot = {
17 pname = "chez-scheme-racket-boot";
18 configurePhase = ''
19 runHook preConfigure
20 ./configure --pb ZLIB=$ZLIB LZ4=$LZ4
21 runHook postConfigure
22 '';
23 makeFlags = [ "${chezSystem}.bootquick" ];
24 installPhase = ''
25 runHook preInstall
26 mkdir -p $out
27 pushd boot
28 mv $(ls -1 | grep -v "^pb$") -t $out
29 popd
30 runHook postInstall
31 '';
32 };
33 boot = buildPackages.callPackage (import ./shared.nix forBoot) {};
34 forFinal = {
35 pname = "chez-scheme-racket";
36 configurePhase = ''
37 runHook preConfigure
38 cp -r ${boot}/* -t ./boot
39 ./configure -m=${chezSystem} --installprefix=$out --installman=$out/share/man ZLIB=$ZLIB LZ4=$LZ4
40 runHook postConfigure
41 '';
42 preBuild = ''
43 pushd ${chezSystem}/c
44 '';
45 postBuild = ''
46 popd
47 '';
48 setupHook = ./setup-hook.sh;
49 };
50 final = callPackage (import ./shared.nix forFinal) {};
51in
52final