emacs-tree-sitter / tree-sitter-langs

Language bundle for Emacs's tree-sitter package
https://emacs-tree-sitter.github.io/languages/
MIT License
254 stars 131 forks source link

FreeBSD Support #155

Open ItsNilDev opened 1 year ago

ItsNilDev commented 1 year ago

Is there anyway to make tree-sitter work with FreeBSD? The package itself is ported in the FreeBSD repository, but can't make emacs work it. I get the unsupported system-type error that's raised by

(defconst tree-sitter-langs--os
  (pcase system-type
    ('darwin "macos")
    ('gnu/linux "linux")
    ('windows-nt "windows")
    (_ (error "Unsupported system-type %s" system-type))))

in the tree-sitter-langs-build.el

0x6d6e647a commented 9 months ago

Seems to be mostly fixed by emacs-tree-sitter/tree-sitter-langs#95.

In my experimentation everything works except the node based grammars that try to fetch tree-sitter via npm. If they published FreeBSD binaries it would all be seamless. For what it's worth, tree-sitter builds and works fine on FreeBSD.

In additional, the same applies to NetBSD and OpenBSD as well.

0x6d6e647a commented 9 months ago

Note the target needs to be set to x86_64-unknown-netbsd and x86_64-unknown-openbsd respectively for the other two BSDs to work. I'm accomplishing that with a call to uname to determine which BSD is being used.

jcs090218 commented 3 months ago

https://github.com/emacs-tree-sitter/tree-sitter-langs/pull/95 is now merged. Can you test to see if it works? 🤔

0x6d6e647a commented 3 months ago

I test using the following configuration:

The following language grammars built with no issues.

The following language grammars failed to build because they are marked to not build on FreeBSD. Please note in my private testing if the node build configuration is changed to allow FreeBSD or OpenBSD they build and work with no issue. At some point when I have tested these on FreeBSD, NetBSD, and OpenBSD I'll submit pull requests to them to resolve this issue and link to these issues and pull requests to a relevant open bug here for tracking. I plan on adding support eventually for those three major BSD operating systems.

The following throw errors during build. I have manually fixed some of these privately but they will not work out of the box. The problem is usually some fringe test case that makes Linux assumptions that don't work on BSD operating systems.

The following appear in the repos directory but are not invoked by scripts/compile all.

I plan to make pull requests in the future to add OpenBSD and NetBSD support which will change some things from #95. Otherwise there isn't much to fix on tree-sitter-langs since the problems with BSD operating systems are mostly due to issues in the grammars.