From 08c744d4b880fe8bde00d7da7f29be79ba26a045 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sat, 14 Feb 2015 21:02:55 +0100 Subject: [PATCH] Add antlr 3.4 build and install helper script --- scripts/antlr34_install.sh | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 scripts/antlr34_install.sh diff --git a/scripts/antlr34_install.sh b/scripts/antlr34_install.sh new file mode 100755 index 00000000..d661fe2f --- /dev/null +++ b/scripts/antlr34_install.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +WORKDIR=~/antlr34.tmp +echo "This script will install antlr 3.4 (and matching libantlr) on your computer." +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 +wget --no-check-certificate https://github.com/antlr/website-antlr3/raw/gh-pages/download/antlr-3.4-complete.jar +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 +./configure --disable-abiflags --prefix=$PREFIX && make +exit +#&& sudo make install +cd $WORKDIR + +sudo mkdir -p "$PREFIX/share/java" +sudo mv antlr-3.4-complete.jar "$PREFIX/share/java" +printf "#!/bin/sh +export CLASSPATH +CLASSPATH=\$CLASSPATH:$PREFIX/share/java/antlr-3.4-complete.jar:$PREFIX/share/java +/usr/bin/java org.antlr.Tool \$* +" > antlr3 +chmod a+x antlr3 +sudo mv antlr3 "$PREFIX/bin" +