cbqn: 0.0.0+unstable=2021-09-29 -> 0.0.0+unstable=2021-10-01

Many thanks for the various rewritings by @sternenseemann!

- The intermediary recompilation phases are hidden by default inside a
  `lib.dontRecurseIntoAttrs`; only the zeroth and the second ones are exposed.

- `clangStdenv` is used by default in non-cross builds.

- The standalone build has an inferior priority.

- The mbqn sources are explicitly taken from mbqn instead of hardcoded in cbqn.
main
AndersonTorres 3 years ago
parent fc88ec5d9d
commit 417487b457
  1. 2
      pkgs/development/interpreters/bqn/cbqn/001-remove-vendoring.diff
  2. 43
      pkgs/development/interpreters/bqn/cbqn/default.nix
  3. 41
      pkgs/top-level/all-packages.nix

@ -9,7 +9,7 @@ index a5f3d75..f617e25 100644
- @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"
+ @echo "src/gen/ files retrieved externally"
${bd}/load.o: src/gen/customRuntime
-include $(bd)/*.d

@ -1,33 +1,30 @@
{ lib
, stdenv
, fetchFromGitHub
, genBytecode ? false
, bqn-path ? null
, mbqn-source ? null
}:
let
mlochbaum-bqn = fetchFromGitHub {
owner = "mlochbaum";
repo = "BQN";
rev = "97cbdc67fe6a9652c42daefadd658cc41c1e5ae3";
hash = "sha256-F2Bv3n3C7zAhqKCMB6hT2iIWTjEqFdLBMyX6/w7V1SY=";
cbqn-bytecode-files = fetchFromGitHub {
name = "cbqn-bytecode-files";
owner = "dzaima";
repo = "CBQN";
rev = "94bb312d20919f942eabed3dca33c514de3c3227";
hash = "sha256-aFw5/F7/sYkYmxAnGeK8EwkoVrbEcjuJAD9YT+iW9Rw=";
};
in
assert genBytecode -> ((bqn-path != null) && (mbqn-source != null));
stdenv.mkDerivation rec {
pname = "cbqn";
version = "0.0.0+unstable=2021-09-29";
pname = "cbqn" + lib.optionalString (!genBytecode) "-standalone";
version = "0.0.0+unstable=2021-10-01";
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=";
rev = "3725bd58c758a749653080319766a33169551536";
hash = "sha256-xWp64inFZRqGGTrH6Hqbj7aA0vYPyd+FdetowTMTjPs=";
};
dontConfigure = true;
@ -42,17 +39,16 @@ stdenv.mkDerivation rec {
'';
preBuild =
if bqn-path == null
if genBytecode
then ''
cp ${cbqn-bytecode}/src/gen/{compiler,formatter,runtime0,runtime1,src} src/gen/
${bqn-path} genRuntime ${mbqn-source}
''
else ''
${bqn-path} genRuntime ${mlochbaum-bqn}
cp ${cbqn-bytecode-files}/src/gen/{compiler,formatter,runtime0,runtime1,src} src/gen/
'';
makeFlags = [
"CC=${stdenv.cc.targetPrefix}cc"
"single-o3"
];
installPhase = ''
@ -70,9 +66,10 @@ stdenv.mkDerivation rec {
homepage = "https://github.com/dzaima/CBQN/";
description = "BQN implementation in C";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ AndersonTorres ];
maintainers = with maintainers; [ AndersonTorres sternenseemann synthetica ];
platforms = platforms.all;
priority = if genBytecode then 0 else 10;
};
}
# TODO: factor BQN
# TODO: test suite (dependent on BQN from mlochbaum)
# TODO: factor and version cbqn-bytecode-files
# TODO: test suite

@ -12835,16 +12835,37 @@ with pkgs;
mbqn = callPackage ../development/interpreters/bqn/mlochbaum-bqn { };
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";
cbqn = cbqn-bootstrap.phase2;
cbqn-standalone = cbqn-bootstrap.phase0;
# Below, the classic self-bootstrapping process
cbqn-bootstrap = lib.dontRecurseIntoAttrs {
# use clang here since it emits less speculative warnings;
# however, avoid its building in cross compilations
stdenv =
if stdenv.hostPlatform == stdenv.buildPlatform
then clangStdenv
else stdenv;
mbqn-source = buildPackages.mbqn.src;
phase0 = callPackage ../development/interpreters/bqn/cbqn {
inherit (cbqn-bootstrap) stdenv;
genBytecode = false;
bqn-path = null;
mbqn-source = null;
};
phase1 = callPackage ../development/interpreters/bqn/cbqn {
inherit (cbqn-bootstrap) stdenv mbqn-source;
genBytecode = true;
bqn-path = "${buildPackages.cbqn-bootstrap.phase0}/bin/cbqn";
};
phase2 = callPackage ../development/interpreters/bqn/cbqn {
inherit (cbqn-bootstrap) stdenv mbqn-source;
genBytecode = true;
bqn-path = "${buildPackages.cbqn-bootstrap.phase1}/bin/cbqn";
};
};
dbqn = callPackage ../development/interpreters/bqn/dzaima-bqn {

Loading…
Cancel
Save