-
Notifications
You must be signed in to change notification settings - Fork 13
/
treesit.patch
49 lines (49 loc) · 2.57 KB
/
treesit.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
diff --git a/lisp/treesit.el b/lisp/treesit.el
index d7502560fea..dbdbdb193c0 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -2952,11 +2952,11 @@ function signals an error."
(default-directory (make-temp-file "treesit-workdir" t))
(workdir (expand-file-name "repo"))
(source-dir (expand-file-name (or source-dir "src") workdir))
- (cc (or cc (seq-find #'executable-find '("cc" "gcc" "c99"))
+ (cc (or cc (concat (file-name-as-directory (getenv "EMACS_SNAP_DIR")) "usr/bin/gcc-14")
;; If no C compiler found, just use cc and let
;; `call-process' signal the error.
"cc"))
- (c++ (or c++ (seq-find #'executable-find '("c++" "g++"))
+ (c++ (or c++ (concat (file-name-as-directory (getenv "EMACS_SNAP_DIR")) "usr/bin/g++-14")
"c++"))
(soext (or (car dynamic-library-suffixes)
(signal 'treesit-error '("Emacs cannot figure out the file extension for dynamic libraries for this system, because `dynamic-library-suffixes' is nil"))))
@@ -2981,20 +2981,27 @@ function signals an error."
(message "Compiling library")
;; cc -fPIC -c -I. parser.c
(treesit--call-process-signal
- cc nil t nil "-fPIC" "-c" "-I." "parser.c")
+ cc nil t nil "-fPIC" "-c" "-I."
+ "--sysroot" (file-name-as-directory (getenv "EMACS_SNAP_DIR"))
+ "parser.c")
;; cc -fPIC -c -I. scanner.c
(when (file-exists-p "scanner.c")
(treesit--call-process-signal
- cc nil t nil "-fPIC" "-c" "-I." "scanner.c"))
+ cc nil t nil "-fPIC" "-c" "-I."
+ "--sysroot" (file-name-as-directory (getenv "EMACS_SNAP_DIR"))
+ "scanner.c"))
;; c++ -fPIC -I. -c scanner.cc
(when (file-exists-p "scanner.cc")
(treesit--call-process-signal
- c++ nil t nil "-fPIC" "-c" "-I." "scanner.cc"))
+ c++ nil t nil "-fPIC" "-c" "-I."
+ "--sysroot" (file-name-as-directory (getenv "EMACS_SNAP_DIR"))
+ "scanner.cc"))
;; cc/c++ -fPIC -shared *.o -o "libtree-sitter-${lang}.${soext}"
(apply #'treesit--call-process-signal
(if (file-exists-p "scanner.cc") c++ cc)
nil t nil
`("-fPIC" "-shared"
+ "--sysroot" ,(file-name-as-directory (getenv "EMACS_SNAP_DIR"))
,@(directory-files
default-directory nil
(rx bos (+ anychar) ".o" eos))