summaryrefslogtreecommitdiff
path: root/textproc
diff options
context:
space:
mode:
Diffstat (limited to 'textproc')
-rw-r--r--textproc/tree-sitter-grammars/Makefile4
-rw-r--r--textproc/tree-sitter-grammars/files/patch-src_main.rs8
2 files changed, 12 insertions, 0 deletions
diff --git a/textproc/tree-sitter-grammars/Makefile b/textproc/tree-sitter-grammars/Makefile
index 586c9ea4c669..c2aec35d5499 100644
--- a/textproc/tree-sitter-grammars/Makefile
+++ b/textproc/tree-sitter-grammars/Makefile
@@ -60,6 +60,10 @@ post-extract:
${CP} ${DISTDIR}/${LANG_HASH}/languages.toml ${WRKSRC}
+post-patch:
+ ${REINPLACE_CMD} "s#WRKDIR#${WRKDIR}#" \
+ ${WRKSRC}/src/main.rs
+
post-build:
cd ${WRKSRC}; \
${CARGO_TARGET_DIR}/release/build-tree-sitter --output ./output --tmp ${WRKSRC}/grammars
diff --git a/textproc/tree-sitter-grammars/files/patch-src_main.rs b/textproc/tree-sitter-grammars/files/patch-src_main.rs
index 4197c86a3f26..ea6c62211292 100644
--- a/textproc/tree-sitter-grammars/files/patch-src_main.rs
+++ b/textproc/tree-sitter-grammars/files/patch-src_main.rs
@@ -31,3 +31,11 @@
let path = if let Some(subpath) = grammar.source.subpath.as_ref() {
path.join(subpath)
} else {
+@@ -171,6 +171,7 @@ fn build_tree_sitter(name: &str, path: &Path, output:
+ fn build_tree_sitter(name: &str, path: &Path, output: &Path) -> Result<()> {
+ println!("-----------------------------------");
+ println!("now building tree sitter for {name}");
++ std::env::set_var("XDG_CACHE_HOME", "WRKDIR/.cache");
+ let output = Command::new("tree-sitter")
+ .current_dir(path)
+ .arg("build")