cbqn: init at 0.0.0+unstable=2021-09-29
This commit is contained in:
parent
8a587c79f6
commit
53527927eb
3 changed files with 106 additions and 0 deletions
|
@ -0,0 +1,15 @@
|
|||
diff --git a/makefile b/makefile
|
||||
index a5f3d75..f617e25 100644
|
||||
--- a/makefile
|
||||
+++ b/makefile
|
||||
@@ -109,9 +109,7 @@ ${bd}/%.o: src/builtins/%.c
|
||||
|
||||
|
||||
src/gen/customRuntime:
|
||||
- @echo "Copying precompiled bytecode from the bytecode branch"
|
||||
- git checkout remotes/origin/bytecode src/gen/{compiler,formatter,runtime0,runtime1,src}
|
||||
- git reset src/gen/{compiler,formatter,runtime0,runtime1,src}
|
||||
+ echo "src/gen/ files retrieved externally"
|
||||
${bd}/load.o: src/gen/customRuntime
|
||||
|
||||
-include $(bd)/*.d
|
78
pkgs/development/interpreters/bqn/cbqn/default.nix
Normal file
78
pkgs/development/interpreters/bqn/cbqn/default.nix
Normal file
|
@ -0,0 +1,78 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, bqn-path ? null
|
||||
}:
|
||||
|
||||
let
|
||||
mlochbaum-bqn = fetchFromGitHub {
|
||||
owner = "mlochbaum";
|
||||
repo = "BQN";
|
||||
rev = "97cbdc67fe6a9652c42daefadd658cc41c1e5ae3";
|
||||
hash = "sha256-F2Bv3n3C7zAhqKCMB6hT2iIWTjEqFdLBMyX6/w7V1SY=";
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "cbqn";
|
||||
version = "0.0.0+unstable=2021-09-29";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "dzaima";
|
||||
repo = "CBQN";
|
||||
rev = "1c83483d5395e097f60de299274ebe0df590217e";
|
||||
hash = "sha256-C34DpXab08mBm2oCQuaeq4fJPtQ5rVa/HlpL/nB9XjQ=";
|
||||
};
|
||||
|
||||
cbqn-bytecode = fetchFromGitHub {
|
||||
owner = "dzaima";
|
||||
repo = "CBQN";
|
||||
rev = "fdf0b93409d68d5ffd86c5670db27c240e6039e0";
|
||||
hash = "sha256-A0zvpg+G37WNgyfrJuc5rH6L7Wntdbrz8pYEPreqgKE=";
|
||||
};
|
||||
|
||||
dontConfigure = true;
|
||||
|
||||
patches = [
|
||||
# self-explaining
|
||||
./001-remove-vendoring.diff
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
sed -i '/SHELL =.*/ d' makefile
|
||||
'';
|
||||
|
||||
preBuild =
|
||||
if bqn-path == null
|
||||
then ''
|
||||
cp ${cbqn-bytecode}/src/gen/{compiler,formatter,runtime0,runtime1,src} src/gen/
|
||||
''
|
||||
else ''
|
||||
${bqn-path} genRuntime ${mlochbaum-bqn}
|
||||
'';
|
||||
|
||||
makeFlags = [
|
||||
"CC=${stdenv.cc.targetPrefix}cc"
|
||||
"single-o3"
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin/
|
||||
cp BQN -t $out/bin/
|
||||
ln -s $out/bin/BQN $out/bin/bqn
|
||||
ln -s $out/bin/BQN $out/bin/cbqn
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/dzaima/CBQN/";
|
||||
description = "BQN implementation in C";
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = with maintainers; [ AndersonTorres ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
# TODO: factor BQN
|
||||
# TODO: test suite (dependent on BQN from mlochbaum)
|
|
@ -12789,6 +12789,19 @@ with pkgs;
|
|||
|
||||
babashka = callPackage ../development/interpreters/clojure/babashka.nix { };
|
||||
|
||||
# BQN interpreters and compilers
|
||||
cbqn = cbqn-phase2;
|
||||
# And the classic bootstrapping process
|
||||
cbqn-phase0 = callPackage ../development/interpreters/bqn/cbqn {
|
||||
bqn-path = null;
|
||||
};
|
||||
cbqn-phase1 = callPackage ../development/interpreters/bqn/cbqn {
|
||||
bqn-path = "${cbqn-phase0}/bin/bqn";
|
||||
};
|
||||
cbqn-phase2 = callPackage ../development/interpreters/bqn/cbqn {
|
||||
bqn-path = "${cbqn-phase1}/bin/bqn";
|
||||
};
|
||||
|
||||
chibi = callPackage ../development/interpreters/chibi { };
|
||||
|
||||
ceptre = callPackage ../development/interpreters/ceptre { };
|
||||
|
|
Loading…
Reference in a new issue