cbqn: huge refactor
- Reorder input set to ASCIIbetical order - Gather all sources into sources.nix file - Including cbqn itself and the submodules - Better names for the inputs - Get rid of null - Reorder expression to the hammering guidelines - Update meta - get rid of nested with - license list
This commit is contained in:
parent
d924b019d2
commit
9127f7b3e8
@ -1,35 +0,0 @@
|
||||
{ lib
|
||||
, fetchFromGitHub
|
||||
, stdenvNoCC
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "cbqn-bytecode";
|
||||
version = "unstable-2023-05-17";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "dzaima";
|
||||
repo = "cbqnBytecode";
|
||||
rev = "32db4dfbfc753835bf112f3d8ae2991d8aebbe3d";
|
||||
hash = "sha256-9uBPrEESn/rB9u0xXwKaQ7ABveQWPc8LRMPlnI/79kg=";
|
||||
};
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -D $src/gen/{compiles,explain,formatter,runtime0,runtime1,runtime1x,src} -t $out/dev
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/dzaima/cbqnBytecode";
|
||||
description = "CBQN precompiled bytecode";
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = with maintainers; [ AndersonTorres sternenseemann synthetica shnarazk detegr ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
@ -1,53 +1,36 @@
|
||||
{ callPackage
|
||||
, lib
|
||||
, stdenv
|
||||
, stdenvNoCC
|
||||
{ lib
|
||||
, callPackage
|
||||
, fetchFromGitHub
|
||||
, fixDarwinDylibNames
|
||||
, genBytecode ? false
|
||||
, bqn-path ? null
|
||||
, libffi
|
||||
, mbqn-source
|
||||
, pkg-config
|
||||
, stdenv
|
||||
# Boolean flags
|
||||
, enableReplxx ? false
|
||||
, enableLibcbqn ? ((stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isDarwin) && !enableReplxx)
|
||||
, libffi
|
||||
, pkg-config
|
||||
, generateBytecode ? false
|
||||
# "Configurable" options
|
||||
, bqn-interpreter
|
||||
}:
|
||||
|
||||
let
|
||||
cbqn-bytecode-submodule =
|
||||
callPackage ./cbqn-bytecode.nix { inherit lib fetchFromGitHub stdenvNoCC; };
|
||||
replxx-submodule = callPackage ./replxx.nix { inherit lib fetchFromGitHub stdenvNoCC; };
|
||||
singeli-submodule = callPackage ./singeli.nix { inherit lib fetchFromGitHub stdenvNoCC; };
|
||||
sources = callPackage ./sources.nix { };
|
||||
in
|
||||
assert genBytecode -> ((bqn-path != null) && (mbqn-source != null));
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "cbqn" + lib.optionalString (!genBytecode) "-standalone";
|
||||
version = "0.5.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "dzaima";
|
||||
repo = "CBQN";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-PCpePevWQ+aPG6Yx3WqBZ4yTeyJsCGkYMSY6kzGDL1U=";
|
||||
};
|
||||
pname = "cbqn" + lib.optionalString (!generateBytecode) "-standalone";
|
||||
inherit (sources.cbqn) version src;
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
] ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
fixDarwinDylibNames
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libffi
|
||||
];
|
||||
|
||||
dontConfigure = true;
|
||||
doInstallCheck = true;
|
||||
|
||||
postPatch = ''
|
||||
sed -i '/SHELL =.*/ d' makefile
|
||||
patchShebangs build/build
|
||||
'';
|
||||
|
||||
makeFlags = [
|
||||
"CC=${stdenv.cc.targetPrefix}cc"
|
||||
];
|
||||
@ -64,19 +47,6 @@ stdenv.mkDerivation rec {
|
||||
"shared-o3"
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
# Purity: avoids git downloading bytecode files
|
||||
mkdir -p build/bytecodeLocal/gen
|
||||
cp -r ${singeli-submodule}/dev/* build/singeliLocal/
|
||||
'' + (if genBytecode then ''
|
||||
${bqn-path} ./build/genRuntime ${mbqn-source} build/bytecodeLocal/
|
||||
'' else ''
|
||||
cp -r ${cbqn-bytecode-submodule}/dev/* build/bytecodeLocal/gen/
|
||||
'')
|
||||
+ lib.optionalString enableReplxx ''
|
||||
cp -r ${replxx-submodule}/dev/* build/replxxLocal/
|
||||
'';
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
] ++ lib.optionals enableLibcbqn [
|
||||
@ -84,6 +54,32 @@ stdenv.mkDerivation rec {
|
||||
"dev"
|
||||
];
|
||||
|
||||
dontConfigure = true;
|
||||
|
||||
doInstallCheck = true;
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
postPatch = ''
|
||||
sed -i '/SHELL =.*/ d' makefile
|
||||
patchShebangs build/build
|
||||
'';
|
||||
|
||||
preBuild = ''
|
||||
mkdir -p build/singeliLocal/
|
||||
cp -r ${sources.singeli.src}/* build/singeliLocal/
|
||||
'' + (if generateBytecode then ''
|
||||
mkdir -p build/bytecodeLocal/gen
|
||||
${bqn-interpreter} ./build/genRuntime ${mbqn-source} build/bytecodeLocal/
|
||||
'' else ''
|
||||
mkdir -p build/bytecodeLocal/gen
|
||||
cp -r ${sources.cbqn-bytecode.src}/* build/bytecodeLocal/
|
||||
'')
|
||||
+ lib.optionalString enableReplxx ''
|
||||
mkdir -p build/replxxLocal/
|
||||
cp -r ${sources.replxx.src}/* build/replxxLocal/
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
@ -121,12 +117,26 @@ stdenv.mkDerivation rec {
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
meta = {
|
||||
homepage = "https://github.com/dzaima/CBQN/";
|
||||
description = "BQN implementation in C";
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = with maintainers; [ AndersonTorres sternenseemann synthetica shnarazk detegr ];
|
||||
platforms = platforms.all;
|
||||
license = with lib.licenses; [
|
||||
# https://github.com/dzaima/CBQN?tab=readme-ov-file#licensing
|
||||
asl20
|
||||
boost
|
||||
gpl3Only
|
||||
lgpl3Only
|
||||
mit
|
||||
mpl20
|
||||
];
|
||||
mainProgram = "cbqn";
|
||||
maintainers = with lib.maintainers; [
|
||||
AndersonTorres
|
||||
detegr
|
||||
shnarazk
|
||||
sternenseemann
|
||||
synthetica
|
||||
];
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
||||
|
@ -1,37 +0,0 @@
|
||||
{ lib
|
||||
, fetchFromGitHub
|
||||
, stdenvNoCC
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "replxx";
|
||||
version = "unstable-2023-10-31";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "dzaima";
|
||||
repo = "replxx";
|
||||
rev = "13f7b60f4f79c2f14f352a76d94860bad0fc7ce9";
|
||||
hash = "sha256-xPuQ5YBDSqhZCwssbaN/FcTZlc3ampYl7nfl2bbsgBA=";
|
||||
};
|
||||
|
||||
dontConfigure = true;
|
||||
# The CBQN derivation will build replxx, here we just provide the source files.
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/dev
|
||||
cp -r $src $out/dev
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/dzaima/replxx";
|
||||
description = "A replxx fork for CBQN";
|
||||
license = licenses.free;
|
||||
maintainers = with maintainers; [ AndersonTorres sternenseemann synthetica shnarazk detegr ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
{ lib
|
||||
, fetchFromGitHub
|
||||
, stdenvNoCC
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "singeli";
|
||||
version = "unstable-2023-11-22";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "mlochbaum";
|
||||
repo = "Singeli";
|
||||
rev = "528faaf9e2a7f4f3434365bcd91d6c18c87c4f08";
|
||||
hash = "sha256-/z1KHqflCqPGC9JU80jtgqdk2mkX06eWSziuf4TU4TM=";
|
||||
};
|
||||
|
||||
dontConfigure = true;
|
||||
# The CBQN derivation will build Singeli, here we just provide the source files.
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/dev
|
||||
cp -r $src $out/dev
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/mlochbaum/Singeli";
|
||||
description = "A metaprogramming DSL for SIMD";
|
||||
license = licenses.isc;
|
||||
maintainers = with maintainers; [ AndersonTorres sternenseemann synthetica shnarazk detegr ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
59
pkgs/development/interpreters/bqn/cbqn/sources.nix
Normal file
59
pkgs/development/interpreters/bqn/cbqn/sources.nix
Normal file
@ -0,0 +1,59 @@
|
||||
# Sources required to build CBQN
|
||||
# Update them all at the same time, or else misbuilds will happen!
|
||||
|
||||
{
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
|
||||
{
|
||||
cbqn = let
|
||||
self = {
|
||||
pname = "cbqn";
|
||||
version = "0.5.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "dzaima";
|
||||
repo = "CBQN";
|
||||
rev = "v${self.version}";
|
||||
hash = "sha256-PCpePevWQ+aPG6Yx3WqBZ4yTeyJsCGkYMSY6kzGDL1U=";
|
||||
};
|
||||
};
|
||||
in
|
||||
self;
|
||||
|
||||
cbqn-bytecode = {
|
||||
pname = "cbqn-bytecode";
|
||||
version = "0-unstable-2023-05-17";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "dzaima";
|
||||
repo = "cbqnBytecode";
|
||||
rev = "32db4dfbfc753835bf112f3d8ae2991d8aebbe3d";
|
||||
hash = "sha256-9uBPrEESn/rB9u0xXwKaQ7ABveQWPc8LRMPlnI/79kg=";
|
||||
};
|
||||
};
|
||||
|
||||
replxx = {
|
||||
pname = "replxx";
|
||||
version = "0-unstable-2023-10-31";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "dzaima";
|
||||
repo = "replxx";
|
||||
rev = "13f7b60f4f79c2f14f352a76d94860bad0fc7ce9";
|
||||
hash = "sha256-xPuQ5YBDSqhZCwssbaN/FcTZlc3ampYl7nfl2bbsgBA=";
|
||||
};
|
||||
};
|
||||
|
||||
singeli = {
|
||||
pname = "singeli";
|
||||
version = "0-unstable-2023-11-21";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "mlochbaum";
|
||||
repo = "Singeli";
|
||||
rev = "528faaf9e2a7f4f3434365bcd91d6c18c87c4f08";
|
||||
hash = "sha256-/z1KHqflCqPGC9JU80jtgqdk2mkX06eWSziuf4TU4TM=";
|
||||
};
|
||||
};
|
||||
}
|
@ -17087,34 +17087,36 @@ with pkgs;
|
||||
|
||||
phase0 = callPackage ../development/interpreters/bqn/cbqn {
|
||||
inherit (cbqn-bootstrap) mbqn-source stdenv;
|
||||
genBytecode = false;
|
||||
bqn-path = null;
|
||||
generateBytecode = false;
|
||||
# Not really used, but since null can be dangerous...
|
||||
bqn-interpreter = "${lib.getExe' buildPackages.mbqn "bqn"}";
|
||||
};
|
||||
|
||||
phase0-replxx = callPackage ../development/interpreters/bqn/cbqn {
|
||||
inherit (cbqn-bootstrap) mbqn-source stdenv;
|
||||
genBytecode = false;
|
||||
bqn-path = null;
|
||||
enableReplxx = true;
|
||||
generateBytecode = false;
|
||||
# Not really used, but since null can be dangerous...
|
||||
bqn-interpreter = "${lib.getExe' buildPackages.mbqn "bqn"}";
|
||||
};
|
||||
|
||||
phase1 = callPackage ../development/interpreters/bqn/cbqn {
|
||||
inherit (cbqn-bootstrap) mbqn-source stdenv;
|
||||
genBytecode = true;
|
||||
bqn-path = "${buildPackages.cbqn-bootstrap.phase0}/bin/cbqn";
|
||||
generateBytecode = true;
|
||||
bqn-interpreter = "${lib.getExe' buildPackages.cbqn-bootstrap.phase0 "cbqn"}";
|
||||
};
|
||||
|
||||
phase2 = callPackage ../development/interpreters/bqn/cbqn {
|
||||
inherit (cbqn-bootstrap) mbqn-source stdenv;
|
||||
genBytecode = true;
|
||||
bqn-path = "${buildPackages.cbqn-bootstrap.phase1}/bin/cbqn";
|
||||
generateBytecode = true;
|
||||
bqn-interpreter = "${lib.getExe' buildPackages.cbqn-bootstrap.phase0 "cbqn"}";
|
||||
};
|
||||
|
||||
phase2-replxx = callPackage ../development/interpreters/bqn/cbqn {
|
||||
inherit (cbqn-bootstrap) mbqn-source stdenv;
|
||||
genBytecode = true;
|
||||
bqn-path = "${buildPackages.cbqn-bootstrap.phase1}/bin/cbqn";
|
||||
generateBytecode = true;
|
||||
enableReplxx = true;
|
||||
bqn-interpreter = "${lib.getExe' buildPackages.cbqn-bootstrap.phase0 "cbqn"}";
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user