2021-10-04 12:37:57 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, jdk
|
|
|
|
, makeWrapper
|
|
|
|
, buildNativeImage ? true
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "dbqn" + lib.optionalString buildNativeImage "-native";
|
2021-10-17 02:12:59 +00:00
|
|
|
version = "0.pre+date=2021-10-08";
|
2021-10-04 12:37:57 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dzaima";
|
|
|
|
repo = "BQN";
|
2021-10-17 02:12:59 +00:00
|
|
|
rev = "0001109a1c5a420421b368c79d34b1e93bfe606e";
|
|
|
|
hash = "sha256-riHHclTLkrVbtzmcz9ungAIc7kaoFHS77+SNatsfNhc=";
|
2021-10-04 12:37:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-10-07 14:46:35 +00:00
|
|
|
jdk
|
2021-10-17 02:12:59 +00:00
|
|
|
makeWrapper
|
2021-10-07 14:46:35 +00:00
|
|
|
];
|
2021-10-04 12:37:57 +00:00
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
|
2021-10-17 02:12:59 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs --build ./build8
|
|
|
|
'';
|
|
|
|
|
2021-10-04 12:37:57 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
2021-10-07 14:46:35 +00:00
|
|
|
./build8
|
2021-10-04 12:37:57 +00:00
|
|
|
'' + lib.optionalString buildNativeImage ''
|
|
|
|
native-image --report-unsupported-elements-at-runtime \
|
2021-10-17 02:12:59 +00:00
|
|
|
-H:CLibraryPath=${lib.getLib jdk}/lib -J-Dfile.encoding=UTF-8 \
|
|
|
|
-jar BQN.jar dbqn
|
2021-10-04 12:37:57 +00:00
|
|
|
'' + ''
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
|
|
|
|
'' + (if buildNativeImage then ''
|
|
|
|
mv dbqn $out/bin
|
|
|
|
'' else ''
|
|
|
|
mkdir -p $out/share/${pname}
|
|
|
|
mv BQN.jar $out/share/${pname}/
|
|
|
|
|
|
|
|
makeWrapper "${lib.getBin jdk}/bin/java" "$out/bin/dbqn" \
|
|
|
|
--add-flags "-jar $out/share/${pname}/BQN.jar"
|
|
|
|
'') + ''
|
|
|
|
ln -s $out/bin/dbqn $out/bin/bqn
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/dzaima/BQN";
|
|
|
|
description = "A BQN implementation in Java" + lib.optionalString buildNativeImage ", compiled as a native image";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ AndersonTorres sternenseemann ];
|
|
|
|
inherit (jdk.meta) platforms;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
# TODO: Processing app
|
|
|
|
# TODO: minimalistic JDK
|