unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
blob 08a71c1dde174edfc8e44c6262f4bd2ce9551a21 1754 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
 
#!/bin/bash

lang=$1
topdir="$PWD"

if [ $# -lt 1 ]
then
    echo "Usage: $0 <language>"
    exit
fi

case $(uname) in
    "Darwin")
        soext="dylib"
        ;;
    *"MINGW"*)
        soext="dll"
        ;;
    *)
        soext="so"
        ;;
esac

echo "Building ${lang}"

### Retrieve sources

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

case "${lang}" in
    "dockerfile")
        org="camdencheek"
        ;;
    "cmake")
        org="uyha"
        ;;
    "go-mod")
        # The parser is called "gomod".
        lang="gomod"
        org="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"
        ;;
    "yaml")
        org="ikatyang"
        ;;
esac

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

### Build

cc -fPIC -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 08a71c1dde1 ...
found 08a71c1dde1 in https://yhetil.org/emacs-bugs/tencent_C2C8E471C2A582CF387766A66A786B7EEF09@qq.com/
found 9dc674237ca in https://git.savannah.gnu.org/cgit/emacs.git
preparing index
index prepared:
100755 9dc674237cac1620f0823d9e41e20d15dcd8b237	admin/notes/tree-sitter/build-module/build.sh

applying [1/1] https://yhetil.org/emacs-bugs/tencent_C2C8E471C2A582CF387766A66A786B7EEF09@qq.com/
diff --git a/admin/notes/tree-sitter/build-module/build.sh b/admin/notes/tree-sitter/build-module/build.sh
index 9dc674237ca..08a71c1dde1 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 08a71c1dde174edfc8e44c6262f4bd2ce9551a21	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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).