all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 190ceb3c4d509495d92d57c23fd6124d68311ab2 1423 bytes (raw)
name: admin/notes/tree-sitter/build-module/build.sh 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
#!/bin/bash

lang=$1
topdir="$PWD"

if [ $(uname) == "Darwin" ]
then
    soext="dylib"
else
    soext="so"
fi

echo "Building ${lang}"

### Retrieve sources

namespace="tree-sitter"
repo="tree-sitter-${lang}"
sourcedir="tree-sitter-${lang}/src"
grammardir="tree-sitter-${lang}"

case "${lang}" in
    "dockerfile")
        namespace="camdencheek"
        ;;
    "typescript")
        sourcedir="tree-sitter-typescript/typescript/src"
        grammardir="tree-sitter-typescript/typescript"
        ;;
    "tsx")
        repo="tree-sitter-typescript"
        sourcedir="tree-sitter-typescript/tsx/src"
        grammardir="tree-sitter-typescript/tsx"
        ;;
esac

git clone "https://github.com/${namespace}/${repo}.git" \
    --depth 1 --quiet
cp "${grammardir}"/grammar.js "${sourcedir}"
# We have to go into the source directory to compile, because some
# C files referes to files like "../../common/scanner.h".
cd "${sourcedir}"

### Build

cc -c -I. parser.c
# Compile scanner.c.
if test -f scanner.c
then
    cc -fPIC -c -I. scanner.c
fi
# Compile scanner.cc.
if test -f scanner.cc
then
    c++ -fPIC -I. -c scanner.cc
fi
# Link.
if test -f scanner.cc
then
    c++ -fPIC -shared *.o -o "libtree-sitter-${lang}.${soext}"
else
    cc -fPIC -shared *.o -o "libtree-sitter-${lang}.${soext}"
fi

### Copy out

mkdir -p "${topdir}/dist"
cp "libtree-sitter-${lang}.${soext}" "${topdir}/dist"
cd "${topdir}"
rm -rf "${repo}"

debug log:

solving 190ceb3c4d ...
found 190ceb3c4d in https://yhetil.org/emacs/5t8G3oC9Y_hC7GM3LVX458MHYqJAKMEa9EKqIB2ab25vjclMABoM_hREiIDuofYP97HQk011sxnz1Kwclukq69ZI3h9sQlkHppg4YQStHbs=@rjt.dev/
found a71ccaa4ed in https://git.savannah.gnu.org/cgit/emacs.git
preparing index
index prepared:
100755 a71ccaa4edbc6655fce217c139119755641afef5	admin/notes/tree-sitter/build-module/build.sh

applying [1/1] https://yhetil.org/emacs/5t8G3oC9Y_hC7GM3LVX458MHYqJAKMEa9EKqIB2ab25vjclMABoM_hREiIDuofYP97HQk011sxnz1Kwclukq69ZI3h9sQlkHppg4YQStHbs=@rjt.dev/
diff --git a/admin/notes/tree-sitter/build-module/build.sh b/admin/notes/tree-sitter/build-module/build.sh
index a71ccaa4ed..190ceb3c4d 100755

Checking patch admin/notes/tree-sitter/build-module/build.sh...
Applied patch admin/notes/tree-sitter/build-module/build.sh cleanly.

index at:
100755 190ceb3c4d509495d92d57c23fd6124d68311ab2	admin/notes/tree-sitter/build-module/build.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.