Skip to content

Commit 790a380

Browse files
jfouquartjcs090218
authored andcommitted
Add FreeBSD support
1 parent cb805e0 commit 790a380

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tree-sitter-langs-build.el

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ infrequent (grammar-only changes). It is different from the version of
242242
(pcase system-type
243243
('darwin "macos")
244244
('gnu/linux "linux")
245+
('berkeley-unix "freebsd")
245246
('windows-nt "windows")
246247
(_ (error "Unsupported system-type %s" system-type))))
247248

@@ -272,6 +273,7 @@ If VERSION and OS are not spcified, use the defaults of
272273
(pcase os
273274
("windows" "x86_64-pc-windows-msvc")
274275
("linux" "x86_64-unknown-linux-gnu")
276+
("freebsd" "x86_64-unknown-freebsd")
275277
("macos" (if (string-prefix-p "aarch64" system-configuration)
276278
"aarch64-apple-darwin"
277279
"x86_64-apple-darwin")))
@@ -376,6 +378,26 @@ from the current state of the grammar repo, without cleanup."
376378
"src/parser.c"
377379
"-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol)
378380
"-target" target))))
381+
((memq system-type '(berkeley-unix))
382+
(cond
383+
((file-exists-p "src/scanner.cc")
384+
(tree-sitter-langs--call
385+
"c++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2"
386+
"-I" "src"
387+
"src/scanner.cc" "-xc" "src/parser.c"
388+
"-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol)))
389+
((file-exists-p "src/scanner.c")
390+
(tree-sitter-langs--call
391+
"cc" "-shared" "-fPIC" "-g" "-O2"
392+
"-I" "src"
393+
"src/scanner.c" "src/parser.c"
394+
"-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol)))
395+
(:default
396+
(tree-sitter-langs--call
397+
"cc" "-shared" "-fPIC" "-g" "-O2"
398+
"-I" "src"
399+
"src/parser.c"
400+
"-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol)))))
379401
(:default (tree-sitter-langs--call "tree-sitter" "test")))))
380402
;; Replace underscores with hyphens. Example: c_sharp.
381403
(let ((default-directory bin-dir))

0 commit comments

Comments
 (0)