Merge pull request #194827 from sternenseemann/cbqn-2022-10-04

cbqn: 0.pre+date=2022-05-06 -> 0.pre+date=2022-10-04
This commit is contained in:
Anderson Torres 2022-10-11 00:06:46 -03:00 committed by GitHub
commit b7fa69bbea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 12 deletions

View file

@ -4,6 +4,7 @@
, genBytecode ? false
, bqn-path ? null
, mbqn-source ? null
, libffi
}:
let
@ -11,23 +12,27 @@ let
name = "cbqn-bytecode-files";
owner = "dzaima";
repo = "CBQN";
rev = "c39653c898531a2cdbf4cc5c764df6e37b1894a4";
hash = "sha256-JCEmkwh5Rv5+NQoxvefSrYnayU892/Wam+gjMgcQmO0=";
rev = "3df8ae563a626ff7ae0683643092f0c3bc2481e5";
hash = "sha256:0rh9qp1bdm9aa77l0kn9n4jdy08gl6l7898lncskxiq9id6xvyb8";
};
in
assert genBytecode -> ((bqn-path != null) && (mbqn-source != null));
stdenv.mkDerivation rec {
pname = "cbqn" + lib.optionalString (!genBytecode) "-standalone";
version = "0.pre+date=2022-05-06";
version = "0.pre+date=2022-10-04";
src = fetchFromGitHub {
owner = "dzaima";
repo = "CBQN";
rev = "3496a939b670f8c9ca2a04927378d6b7e9abd68e";
hash = "sha256-P+PoY4XF9oEw7VIpmybvPp+jxWHEo2zt1Lamayf1mHg=";
rev = "abcb575a537712763e9e53b6cb0eb415346b00e6";
hash = "sha256:05gqw2ppcykv36ji8mkp8mq502q84vk9algp9c2d3z495xqy8rn6";
};
buildInputs = [
libffi
];
dontConfigure = true;
postPatch = ''
@ -44,8 +49,13 @@ stdenv.mkDerivation rec {
'' + (if genBytecode then ''
${bqn-path} genRuntime ${mbqn-source}
'' else ''
cp ${cbqn-bytecode-files}/src/gen/{compiles,formatter,runtime0,runtime1,src} src/gen/
'');
cp ${cbqn-bytecode-files}/src/gen/{compiles,explain,formatter,runtime0,runtime1,src} src/gen/
'')
# Need to adjust ld flags for darwin manually
# https://github.com/dzaima/CBQN/issues/26
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
makeFlagsArray+=(LD_LIBS="-ldl -lffi")
'';
installPhase = ''
runHook preInstall

View file

@ -7,13 +7,13 @@
stdenvNoCC.mkDerivation rec {
pname = "bqn";
version = "0.pre+date=2021-12-13";
version = "0.pre+date=2022-10-03";
src = fetchFromGitHub {
owner = "mlochbaum";
repo = "BQN";
rev = "2c2e86e10ff963a6aefa14f76fd8833ce3c9157c";
hash = "sha256-iAlDXGlHTeI6+r/QKFiBHhj5A+FgUy7JFrCpAwpyVQU=";
rev = "1518205cceeb1fef27c584d24e92b189ffd234f4";
hash = "sha256:1pyk331ymbs2fv9jxmbv28yvk9mr2mcni1dsja6fzkk1jrd767hy";
};
nativeBuildInputs = [ makeWrapper ];

View file

@ -15197,22 +15197,35 @@ with pkgs;
# Below, the classic self-bootstrapping process
cbqn-bootstrap = lib.dontRecurseIntoAttrs {
# Use clang to compile CBQN if we aren't already.
# CBQN's upstream primarily targets and tests clang which means using gcc
# will result in slower binaries and on some platforms failing/broken builds.
# See https://github.com/dzaima/CBQN/issues/12.
#
# Known issues:
#
# * CBQN using gcc is broken at runtime on i686 due to
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58416,
# * CBQN uses some CPP macros gcc doesn't like for aarch64.
stdenv = if !stdenv.cc.isClang 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) mbqn-source;
inherit (cbqn-bootstrap) mbqn-source stdenv;
genBytecode = true;
bqn-path = "${buildPackages.cbqn-bootstrap.phase0}/bin/cbqn";
};
phase2 = callPackage ../development/interpreters/bqn/cbqn {
inherit (cbqn-bootstrap) mbqn-source;
inherit (cbqn-bootstrap) mbqn-source stdenv;
genBytecode = true;
bqn-path = "${buildPackages.cbqn-bootstrap.phase1}/bin/cbqn";
};