view scripts/build-luan.sh @ 1648:224af797b1f9

Mainly small install script improvements - Consistent usage of `$LUANHOME`, removed reliance on current directory. - Made Luan build and install fine (on Linux) without requiring launching it via sudo. Only asks to elevate privileges if installation failed. - Minor spelling mistake fix.
author Fox
date Mon, 28 Mar 2022 18:00:12 +0200
parents c8f4867fd083
children aed284cae1f0
line wrap: on
line source

set -e

cd `dirname $0`/..
LUANHOME=`pwd`

rm -rf build
mkdir -p build/luan/jars
cp lib/* build/luan/jars

find . -name *.class -delete

. $LUANHOME/classpath.sh

cd $LUANHOME/src
javac -classpath $CLASSPATH `find . -name *.java`
jar cvf $LUANHOME/build/luan/jars/luan.jar `find . -name *.class -o -name *.luan`

cd $LUANHOME/slf4j/src
javac -classpath $CLASSPATH `find . -name *.java`
jar cvf $LUANHOME/build/luan/jars/slf4j-goodjava.jar `find . -name *.class -o -name *.luan`

cd $LUANHOME
cp scripts/install.sh build/luan
chmod +x build/luan/install.sh
cp scripts/uninstall.sh build/luan

cd build
VERSION=`java -classpath $CLASSPATH luan.Luan classpath:luan/version.luan`
tar -cf luan-$VERSION.tar luan

luan/install.sh || sudo luan/install.sh

echo done