@ -1,33 +1,30 @@
{ lib
, stdenv
, fetchFromGitHub
, genBytecode ? false
, bqn-path ? null
, mbqn-source ? null
} :
let
mlochbaum-bqn = fetchFromGitHub {
owner = " m l o c h b a u m " ;
repo = " B Q N " ;
rev = " 9 7 c b d c 6 7 f e 6 a 9 6 5 2 c 4 2 d a e f a d d 6 5 8 c c 4 1 c 1 e 5 a e 3 " ;
hash = " s h a 2 5 6 - F 2 B v 3 n 3 C 7 z A h q K C M B 6 h T 2 i I W T j E q F d L B M y X 6 / w 7 V 1 S Y = " ;
cbqn-bytecode-files = fetchFromGitHub {
name = " c b q n - b y t e c o d e - f i l e s " ;
owner = " d z a i m a " ;
repo = " C B Q N " ;
rev = " 9 4 b b 3 1 2 d 2 0 9 1 9 f 9 4 2 e a b e d 3 d c a 3 3 c 5 1 4 d e 3 c 3 2 2 7 " ;
hash = " s h a 2 5 6 - a F w 5 / F 7 / s Y k Y m x A n G e K 8 E w k o V r b E c j u J A D 9 Y T + i W 9 R w = " ;
} ;
in
assert genBytecode -> ( ( bqn-path != null ) && ( mbqn-source != null ) ) ;
stdenv . mkDerivation rec {
pname = " c b q n " ;
version = " 0 . 0 . 0 + u n s t a b l e = 2 0 2 1 - 0 9 - 2 9 " ;
pname = " c b q n " + lib . optionalString ( ! genBytecode ) " - s t a n d a l o n e " ;
version = " 0 . 0 . 0 + u n s t a b l e = 2 0 2 1 - 1 0 - 0 1 " ;
src = fetchFromGitHub {
owner = " d z a i m a " ;
repo = " C B Q N " ;
rev = " 1 c 8 3 4 8 3 d 5 3 9 5 e 0 9 7 f 6 0 d e 2 9 9 2 7 4 e b e 0 d f 5 9 0 2 1 7 e " ;
hash = " s h a 2 5 6 - C 3 4 D p X a b 0 8 m B m 2 o C Q u a e q 4 f J P t Q 5 r V a / H l p L / n B 9 X j Q = " ;
} ;
cbqn-bytecode = fetchFromGitHub {
owner = " d z a i m a " ;
repo = " C B Q N " ;
rev = " f d f 0 b 9 3 4 0 9 d 6 8 d 5 f f d 8 6 c 5 6 7 0 d b 2 7 c 2 4 0 e 6 0 3 9 e 0 " ;
hash = " s h a 2 5 6 - A 0 z v p g + G 3 7 W N g y f r J u c 5 r H 6 L 7 W n t d b r z 8 p Y E P r e q g K E = " ;
rev = " 3 7 2 5 b d 5 8 c 7 5 8 a 7 4 9 6 5 3 0 8 0 3 1 9 7 6 6 a 3 3 1 6 9 5 5 1 5 3 6 " ;
hash = " s h a 2 5 6 - x W p 6 4 i n F Z R q G G T r H 6 H q b j 7 a A 0 v Y P y d + F d e t o w T M T j P s = " ;
} ;
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 = [
" C C = ${ stdenv . cc . targetPrefix } c c "
" s i n g l e - o 3 "
] ;
installPhase = ''
@ -70,9 +66,10 @@ stdenv.mkDerivation rec {
homepage = " h t t p s : / / g i t h u b . c o m / d z a i m a / C B Q N / " ;
description = " B Q N i m p l e m e n t a t i o n i n 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