changelog shortlog graph tags branches files raw help

Mercurial > infra / changeset: added cargo-tools and ts-langs

changeset 24: 3e8310575574
parent 23: 4300e14bb1db
child 25: 30fa758d74b7
author: ellis <ellis@rwest.io>
date: Mon, 11 Dec 2023 22:54:50 -0500
files: makefile scripts/aws-set-env.sh scripts/build-emacs.sh scripts/get-cargo-tools.sh scripts/get-sbcl.sh scripts/init.sh scripts/ts-install-langs.sh
description: added cargo-tools and ts-langs
     1.1--- a/makefile	Tue Dec 05 23:12:16 2023 -0500
     1.2+++ b/makefile	Mon Dec 11 22:54:50 2023 -0500
     1.3@@ -95,6 +95,10 @@
     1.4 rust-install:rust-build;
     1.5 	cd $(RUST_TARGET) && x install
     1.6 
     1.7+### Tree-sitter Langs
     1.8+TS_LANGS_TARGET:=build/src/ts-langs
     1.9+ts-langs:scripts/ts-install-langs.sh # this requires sudo for now
    1.10+
    1.11 ### Code
    1.12 CODE_TARGET:=build/src/$(SRC)
    1.13 code:scripts/get-code.sh $(B)
     4.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2+++ b/scripts/get-cargo-tools.sh	Mon Dec 11 22:54:50 2023 -0500
     4.3@@ -0,0 +1,10 @@
     4.4+#!/bin/sh
     4.5+cargo install carg-add
     4.6+cargo install cbindgen
     4.7+cargo install cargo-asm
     4.8+cargo install t-rec
     4.9+cargo install trunk
    4.10+cargo install tokio-console
    4.11+cargo install sqlx-cli
    4.12+cargo install wasm-bindgen-cli
    4.13+cargo install wasm-opt
     5.1--- a/scripts/get-sbcl.sh	Tue Dec 05 23:12:16 2023 -0500
     5.2+++ b/scripts/get-sbcl.sh	Mon Dec 11 22:54:50 2023 -0500
     5.3@@ -1,4 +1,4 @@
     5.4-#!/usr/bin/bash
     5.5+#!/usr/bin/env bash
     5.6 # get SBCL source code
     5.7 VER="${1:-main}"
     5.8 TARGETDIR=${2:-$(realpath build/src/sbcl-$VER)}
     7.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2+++ b/scripts/ts-install-langs.sh	Mon Dec 11 22:54:50 2023 -0500
     7.3@@ -0,0 +1,55 @@
     7.4+#!/usr/bin/env bash
     7.5+
     7.6+# based on https://github.com/GrammaTech/sel/blob/master/tools/tree-sitter-install.sh
     7.7+set -eux
     7.8+
     7.9+declare -ar default_langs=(
    7.10+  commonlisp bash c cpp css go html java javascript jsdoc json python regex rust
    7.11+  typescript/tsx typescript/typescript yaml
    7.12+) # more langs: agda c-sharp julia ocaml/interface ocaml/ocaml php ql ruby scala
    7.13+
    7.14+TARGETDIR=${1:-$(realpath build/src/ts-langs)}
    7.15+PREFIX=${PREFIX:-/usr/local}
    7.16+CC=${CC:-clang}
    7.17+CXX=${CXX:-clang++}
    7.18+if [ $(uname) == "Darwin" ];then
    7.19+   EXT=dylib;
    7.20+else
    7.21+   EXT=so
    7.22+fi
    7.23+# Declared repositories.
    7.24+declare -A repos
    7.25+repos[commonlisp]=https://github.com/theHamsta/tree-sitter-commonlisp.git
    7.26+repos[yaml]=https://github.com/ikatyang/tree-sitter-yaml.git
    7.27+repos[cpp]=https://github.com/ruricolist/tree-sitter-cpp.git
    7.28+
    7.29+declare -a langs
    7.30+if [ -z "${2:-}" ]; then
    7.31+  langs=(${default_langs[@]})
    7.32+else
    7.33+  langs=($@)
    7.34+fi
    7.35+
    7.36+mkdir -pv $TARGETDIR
    7.37+pushd $TARGETDIR
    7.38+for lang in "${langs[@]}";do
    7.39+  [ -d "tree-sitter-${lang%/*}" ] || git clone ${repos[$lang]:-https://github.com/tree-sitter/tree-sitter-${lang%/*}};
    7.40+  # subshell
    7.41+  (
    7.42+    cd "tree-sitter-${lang}/src";
    7.43+    if test -f "scanner.cc"; then
    7.44+      ${CXX} -I. -fPIC scanner.cc -c -lstdc++;
    7.45+      ${CC} -I. -std=c99 -fPIC parser.c -c;
    7.46+      ${CXX} -shared scanner.o parser.o -o ${PREFIX}/lib/tree-sitter-"${lang//\//-}.${EXT}";
    7.47+    elif test -f "scanner.c"; then
    7.48+      ${CC} -I. -std=c99 -fPIC scanner.c -c;
    7.49+      ${CC} -I. -std=c99 -fPIC parser.c -c;
    7.50+      ${CC} -shared scanner.o parser.o -o ${PREFIX}/lib/tree-sitter-"${lang//\//-}.${EXT}";
    7.51+    else
    7.52+      ${CC} -I. -std=c99 -fPIC parser.c -c;
    7.53+      ${CC} -shared parser.o -o ${PREFIX}/lib/tree-sitter-"${lang//\//-}.${EXT}";
    7.54+    fi;
    7.55+    mkdir -p "${PREFIX}/share/tree-sitter/${lang}/";
    7.56+    cp grammar.json node-types.json "${PREFIX}/share/tree-sitter/${lang}";
    7.57+  )
    7.58+done