3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/tools/parsing/tree-sitter/library.nix
Matthieu Coudron be4832848d tree-sitter.grammars: compile scanner.cc if exists
otherwise neovim's treesitter fails with for instance:
`undefined symbol: tree_sitter_bash_external_scanner_create`
2020-09-22 21:30:43 +02:00

35 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
'';
}