1{
2 lib,
3 stdenv,
4 fetchgit,
5 gcc,
6 unstableGitUpdater,
7}:
8
9stdenv.mkDerivation {
10 pname = "cakelisp";
11 # using unstable as it's the only version that builds against gcc-13
12 version = "0.3.0-unstable-2024-04-25";
13
14 src = fetchgit {
15 url = "https://macoy.me/code/macoy/cakelisp";
16 rev = "eb4427f555c3def9d65612672ccfe59e11b14059";
17 hash = "sha256-wFyqAbHrBMFKqMYlBjS6flYHPn3Rxtaiqb1rRmlZrB4=";
18 };
19
20 buildInputs = [ gcc ];
21
22 postPatch = ''
23 substituteInPlace runtime/HotReloading.cake \
24 --replace '"/usr/bin/g++"' '"${gcc}/bin/g++"'
25 substituteInPlace src/ModuleManager.cpp \
26 --replace '"/usr/bin/g++"' '"${gcc}/bin/g++"'
27 ''
28 + lib.optionalString stdenv.hostPlatform.isDarwin ''
29 substituteInPlace Build.sh --replace '--export-dynamic' '-export_dynamic'
30 substituteInPlace runtime/HotReloading.cake --replace '--export-dynamic' '-export_dynamic'
31 substituteInPlace Bootstrap.cake --replace '--export-dynamic' '-export_dynamic'
32 '';
33
34 buildPhase = ''
35 runHook preBuild
36 ./Build.sh
37 runHook postBuild
38 '';
39
40 env.NIX_CFLAGS_COMPILE = "-Wno-error=format";
41
42 installPhase = ''
43 runHook preInstall
44 install -Dm755 bin/cakelisp -t $out/bin
45 runHook postInstall
46 '';
47
48 passthru.updateScript = unstableGitUpdater {
49 url = "https://macoy.me/code/macoy/cakelisp";
50 };
51
52 meta = with lib; {
53 description = "Performance-oriented Lisp-like language";
54 mainProgram = "cakelisp";
55 homepage = "https://macoy.me/code/macoy/cakelisp";
56 license = licenses.gpl3Plus;
57 platforms = platforms.darwin ++ platforms.linux;
58 maintainers = [ maintainers.sbond75 ];
59 # never built on aarch64-darwin since first introduction in nixpkgs
60 broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
61 };
62}