diff --git a/pkgs/development/interpreters/bqn/cbqn/default.nix b/pkgs/development/interpreters/bqn/cbqn/default.nix index 0426a72c81aa..f45dda4088fa 100644 --- a/pkgs/development/interpreters/bqn/cbqn/default.nix +++ b/pkgs/development/interpreters/bqn/cbqn/default.nix @@ -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 diff --git a/pkgs/development/interpreters/bqn/mlochbaum-bqn/default.nix b/pkgs/development/interpreters/bqn/mlochbaum-bqn/default.nix index fbb5b458d08b..83d4a08e33dc 100644 --- a/pkgs/development/interpreters/bqn/mlochbaum-bqn/default.nix +++ b/pkgs/development/interpreters/bqn/mlochbaum-bqn/default.nix @@ -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 ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a2606b396279..e3b79c211b9c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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"; };