depot/third_party/nixpkgs/pkgs/development/tools/parsing/tree-sitter/library.nix

31 lines
477 B
Nix
Raw Normal View History

{ stdenv
, language
, tree-sitter
, version
, source
}:
stdenv.mkDerivation {
pname = "tree-sitter-${language}-library";
inherit version;
src = source;
buildInputs = [ tree-sitter ];
dontUnpack = true;
configurePhase= ":";
buildPhase = ''
runHook preBuild
$CC -I$src/src/ -shared -o parser -Os $src/src/parser.c
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir $out
mv parser $out/
runHook postInstall
'';
}