From c3467534821e340a1d0bf88a2d78d34e78c8fc31 Mon Sep 17 00:00:00 2001 From: Paul Berg Date: Thu, 31 Mar 2022 01:25:29 +0200 Subject: [PATCH] add libtree_sitter_highlight (#4694) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add libtree_sitter_highlight * Update T/tree_sitter_highlight/build_tarballs.jl Co-authored-by: Mosè Giordano * Remove vvvv to avoid confusion * fix for windows build * Update build_tarballs.jl Co-authored-by: Mosè Giordano --- T/tree_sitter_highlight/build_tarballs.jl | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 T/tree_sitter_highlight/build_tarballs.jl diff --git a/T/tree_sitter_highlight/build_tarballs.jl b/T/tree_sitter_highlight/build_tarballs.jl new file mode 100644 index 00000000000..dee7d3c8c43 --- /dev/null +++ b/T/tree_sitter_highlight/build_tarballs.jl @@ -0,0 +1,43 @@ +# Note that this script can accept some limited command-line arguments, run +# `julia build_tarballs.jl --help` to see a usage message. +using BinaryBuilder + +name = "tree_sitter_highlight" +version = v"0.20.6" + +# Collection of sources required to complete build +sources = [ + GitSource("https://github.com/tree-sitter/tree-sitter/", + "ccd6bf554d922596ce905730d98a77af368bba5c"), +] + +# Bash recipe for building across all platforms +script = raw""" +cd $WORKSPACE/srcdir/ + +# Use cargo-rustc to build tree-sitter-highlight as a dynamic library here +cargo rustc --release --manifest-path highlight/Cargo.toml -- --crate-type=cdylib + +install -Dvm 755 target/${rust_target}/release/deps/*tree_sitter_highlight-*.${dlext} "${libdir}/libtree_sitter_highlight.${dlext}" +""" + +# These are the platforms we will build for by default, unless further +# platforms are passed in on the command line +platforms = supported_platforms() +# Rust toolchain is unusable on i686-w64-mingw32 +filter!(p -> !(Sys.iswindows(p) && arch(p) == "i686"), platforms) +# Also, can't build cdylib for Musl systems +filter!(p -> libc(p) != "musl", platforms) + +# The products that we will ensure are always built +products = [ + LibraryProduct("libtree_sitter_highlight", :libtree_sitter_highlight), +] + +# Dependencies that must be installed before this package can be built +dependencies = Dependency[ +] + +# Build the tarballs, and possibly a `build.jl` as well. +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; + compilers=[:c, :rust], julia_compat="1.6", lock_microarchitecture=false)