diff --git a/pkg.info b/pkg.info index 74c7576..844e905 100644 --- a/pkg.info +++ b/pkg.info @@ -1,24 +1,30 @@ name: tree-sitter description: An incremental parsing system for programming tools -version: 0.25.10 +version: 0.26.8 revision: 1 url: https://github.com/tree-sitter/tree-sitter license: MIT +maintainers: + - enumdev@enumerated.dev architecture: any type: source +depends: + - glibc make_depends: + - clang - cmake - rustc downloads: - url: https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v${BPM_PKG_VERSION}.tar.gz extract_to: ${BPM_SOURCE} extract_strip_components: 1 - checksum: ad5040537537012b16ef6e1210a572b927c7cdc2b99d1ee88d44a7dcdc3ff44c + checksum: e6826b7533ec3a885aba598377a6d20b5a6321ff3db76968e960c2352d3a5077 split_packages: - name: tree-sitter - name: tree-sitter-cli description: CLI tool for tree-sitter depends: + - glibc - gcc-libs optional_depends: - - nodejs + - nodejs:For the generate subcommand diff --git a/source.sh b/source.sh index 0142e8d..d72fa97 100644 --- a/source.sh +++ b/source.sh @@ -5,31 +5,30 @@ # The prepare function is executed in the root of the temp directory # This function is used for putting downloaded files to the correct location or applying patches prepare() { - cd "$BPM_SOURCE"/cli - cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')" + cd "$BPM_SOURCE"/crates/cli + cargo fetch --locked --target "$(rustc --print host-tuple)" } # The build function is executed in the source directory # This function is used to compile the source code build() { # Build library - mkdir lib/build - cd lib/build - - cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON .. - make + cmake -B build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON + cmake --build build # Build command-line interface - cd "$BPM_SOURCE"/cli - + cd "$BPM_SOURCE"/crates/cli cargo build --release --locked --offline + + # Build shell completions + for completion in bash elvish fish nushell zsh; do + cargo run --frozen --release -- complete --shell $completion > $completion-completions + done } # Function for packaging the main tree sitter library package_tree-sitter() { - cd lib/build - - make DESTDIR="$BPM_OUTPUT" install + DESTDIR="$BPM_OUTPUT" cmake --install build # Install package license install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/tree-sitter/LICENSE @@ -37,10 +36,16 @@ package_tree-sitter() { # Function for packaging the tree sitter cli tools package_tree-sitter-cli() { - cd cli - install -D "$BPM_SOURCE"/target/release/tree-sitter "$BPM_OUTPUT"/usr/bin/tree-sitter + # Install shell completions + cd crates/cli + install -Dm644 bash-completions "$BPM_OUTPUT"/usr/share/bash-completion/completions/tree-sitter + install -Dm644 elvish-completions "$BPM_OUTPUT"/usr/share/elvish/lib/tree-sitter.elv + install -Dm644 fish-completions "$BPM_OUTPUT"/usr/share/fish/vendor_completions.d/tree-sitter.fish + install -Dm644 nushell-completions "$BPM_OUTPUT"/usr/share/nushell/vendor/autoload/tree-sitter.nu + install -Dm644 zsh-completions "$BPM_OUTPUT"/usr/share/zsh/site-functions/_tree-sitter + # Install package license install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/tree-sitter/LICENSE }