depot/third_party/nixpkgs/pkgs/development/tools/parsing/tree-sitter/library.nix
Default email 1693fb2285 Project import generated by Copybara.
GitOrigin-RevId: 420f89ceb267b461eed5d025b6c3c0e57703cc5c
2020-10-07 11:15:18 +02:00

34 lines
598 B
Nix

{ 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
scanner_cc="$src/src/scanner.cc"
if [ ! -f "$scanner_cc" ]; then
scanner_cc=""
fi
$CC -I$src/src/ -shared -o parser -Os $src/src/parser.c $scanner_cc -lstdc++
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir $out
mv parser $out/
runHook postInstall
'';
}