2015-02-14 15:02:55 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
2015-10-05 18:20:28 -04:00
|
|
|
WORKDIR=~/antlr35.tmp
|
|
|
|
echo "This script will install antlr 3.5 (and matching libantlr) on your computer."
|
2015-02-14 15:02:55 -05:00
|
|
|
read -p "Should the script create $WORKDIR and use it for building? [Y/n] " yn
|
|
|
|
if [ "$yn" = "n" ]; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
mkdir -p $WORKDIR
|
|
|
|
if [ ! -d $WORKDIR ]; then
|
|
|
|
echo "Error creating $WORKDIR"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
cd $WORKDIR
|
|
|
|
|
|
|
|
read -p "Should the script download and build antlr and libantlr3c? [Y/n] " yn
|
|
|
|
if [ "$yn" = "n" ]; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
read -p "Should the script install with prefix /usr or /usr/local? [U/l] " yn
|
|
|
|
if [ "$yn" = "l" ]; then
|
|
|
|
PREFIX=/usr/local
|
|
|
|
else
|
|
|
|
PREFIX=/usr
|
|
|
|
fi
|
2015-02-14 17:52:56 -05:00
|
|
|
read -p "Should the script build libantlr3c for 64 bit? [Y/n] " yn
|
|
|
|
if [ "$yn" != "n" ]; then
|
|
|
|
ENABLE64BIT="--enable-64bit"
|
|
|
|
fi
|
2015-10-05 18:20:28 -04:00
|
|
|
wget --no-check-certificate https://github.com/antlr/website-antlr3/raw/gh-pages/download/antlr-3.5.2-complete.jar
|
2015-02-14 15:02:55 -05:00
|
|
|
wget --no-check-certificate https://github.com/antlr/website-antlr3/raw/gh-pages/download/C/libantlr3c-3.4.tar.gz
|
|
|
|
tar xzf libantlr3c-3.4.tar.gz
|
|
|
|
cd libantlr3c-3.4
|
2015-02-14 17:52:56 -05:00
|
|
|
./configure $ENABLE64BIT --prefix=$PREFIX && make && sudo make install
|
2015-02-14 15:02:55 -05:00
|
|
|
cd $WORKDIR
|
|
|
|
|
|
|
|
sudo mkdir -p "$PREFIX/share/java"
|
2015-10-05 18:20:28 -04:00
|
|
|
sudo install antlr-3.5.2-complete.jar "$PREFIX/share/java"
|
2015-02-14 15:02:55 -05:00
|
|
|
printf "#!/bin/sh
|
|
|
|
export CLASSPATH
|
2015-10-05 18:20:28 -04:00
|
|
|
CLASSPATH=\$CLASSPATH:$PREFIX/share/java/antlr-3.5.2-complete.jar:$PREFIX/share/java
|
2015-02-14 15:02:55 -05:00
|
|
|
/usr/bin/java org.antlr.Tool \$*
|
|
|
|
" > antlr3
|
2015-03-18 15:38:01 -04:00
|
|
|
sudo install --mode=755 antlr3 "$PREFIX/bin"
|
2015-02-14 15:02:55 -05:00
|
|
|
|