-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-antlr.sh
55 lines (39 loc) · 1.19 KB
/
install-antlr.sh
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
set -e # Abort the script at the first error
######################################################################
# Preparation step
# create the target directory for installation
mkdir antlr
# create a fresh temp directory
mkdir antlr.tmp
cd antlr.tmp
echo Downloading antlr4
#download both the tool jar and the cpp runtime
curl -O https://www.antlr.org/download/antlr-4.9.2-complete.jar
curl -O https://www.antlr.org/download/antlr4-cpp-runtime-4.9.2-source.zip
echo Download OK
######################################################################
# Build step
unzip *.zip
mkdir build
cd build
cmake ..
make
cd ../..
######################################################################
# install step
# tool jar
mkdir antlr/jar
mv antlr.tmp/*.jar antlr/jar
# runtime header files
mkdir antlr/include
cd antlr.tmp/runtime/src
find * -type d -print -exec mkdir ../../../antlr/include/'{}' ';'
find . -name '*.h' -print -exec cp '{}' ../../../antlr/include/'{}' ';'
cd ../../..
# runtime library files
mkdir antlr/lib
mv antlr.tmp/dist/libantlr4-runtime.a antlr/lib
######################################################################
# cleanup step
rm -rf antlr.tmp
echo PLD COMP: ANTLR OK