forked from mirrors/nixpkgs
be4832848d
otherwise neovim's treesitter fails with for instance: `undefined symbol: tree_sitter_bash_external_scanner_create`
35 lines
598 B
Nix
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
|
|
'';
|
|
}
|