1{ lib, stdenv, fetchgit, gcc }:
2
3stdenv.mkDerivation rec {
4 pname = "cakelisp";
5 version = "0.1.0";
6
7 src = fetchgit {
8 url = "https://macoy.me/code/macoy/cakelisp";
9 rev = "v${version}";
10 sha256 = "sha256-r7Yg8+2U8qQTYRP3KFET7oBRCZHIZS6Y8TsfL1NR24g=";
11 };
12
13 buildInputs = [ gcc ];
14
15 postPatch = ''
16 substituteInPlace runtime/HotReloading.cake \
17 --replace '"/usr/bin/g++"' '"${gcc}/bin/g++"'
18 substituteInPlace src/ModuleManager.cpp \
19 --replace '"/usr/bin/g++"' '"${gcc}/bin/g++"'
20 '' + lib.optionalString stdenv.isDarwin ''
21 substituteInPlace Build.sh --replace '--export-dynamic' '-export_dynamic'
22 substituteInPlace runtime/HotReloading.cake --replace '--export-dynamic' '-export_dynamic'
23 substituteInPlace Bootstrap.cake --replace '--export-dynamic' '-export_dynamic'
24 '';
25
26 buildPhase = ''
27 runHook preBuild
28 ./Build.sh
29 runHook postBuild
30 '';
31
32 installPhase = ''
33 runHook preInstall
34 install -Dm755 bin/cakelisp -t $out/bin
35 runHook postInstall
36 '';
37
38 meta = with lib; {
39 description = "A performance-oriented Lisp-like language";
40 homepage = "https://macoy.me/code/macoy/cakelisp";
41 license = licenses.gpl3Plus;
42 platforms = platforms.darwin ++ platforms.linux;
43 maintainers = [ maintainers.sbond75 ];
44 # never built on aarch64-darwin since first introduction in nixpkgs
45 broken = stdenv.isDarwin && stdenv.isAarch64;
46 };
47}