Improve check_tools script
This commit is contained in:
parent
8041f7da83
commit
3296ca83f1
1 changed files with 29 additions and 29 deletions
|
@ -1,37 +1,37 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
rm -f check_tools.mk
|
||||
touch check_tools.mk
|
||||
|
||||
# Check java
|
||||
JAVA=\"$(which java)\"
|
||||
if [ -z ${JAVA} ]; then
|
||||
echo "Could not find java. Please install java";
|
||||
exit -1;
|
||||
error_on_quit=0
|
||||
|
||||
check_installed() {
|
||||
if [ -z "$(which $1)" ]; then
|
||||
echo "Could not find $1. Please install $2."
|
||||
error_on_quit=1
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
check_installed "java" "it"
|
||||
check_installed "ant" "it"
|
||||
check_installed "yasm" "it"
|
||||
check_installed "nasm" "it"
|
||||
check_installed "ndk-build" "android NDK"
|
||||
if check_installed "android" "android SDK"; then
|
||||
check_installed "adb" "android SDK platform tools"
|
||||
# check that at least one target is installed
|
||||
if [ -z "$(android list target -c)" ]; then
|
||||
echo "Install at least one android target in android SDK"
|
||||
error_on_quit=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check antlr
|
||||
ANTLR="${JAVA} -jar \"submodules/externals/antlr3/antlr-3.2.jar\"";
|
||||
|
||||
# Check NDK
|
||||
NDK=$(which ndk-build)
|
||||
if [ -z ${NDK} ]; then
|
||||
echo "Could not find ndk-build. Please install android ndk";
|
||||
exit -1;
|
||||
if [ $error_on_quit = 0 ]; then
|
||||
echo "JAVA=\"$(which java)\"" >> check_tools.mk
|
||||
echo "ANTLR=\"$(which java)\" -jar \"submodules/externals/antlr3/antlr-3.2.jar\"" >> check_tools.mk
|
||||
fi
|
||||
|
||||
# Check SDK
|
||||
SDK=$(which android)
|
||||
if [ -z ${SDK} ]; then
|
||||
echo "Could not find android. Please install android sdk";
|
||||
exit -1;
|
||||
fi
|
||||
|
||||
SDK_PLATFORM_TOOLS=$(which adb)
|
||||
if [ -z ${SDK_PLATFORM_TOOLS} ]; then
|
||||
echo "Could not find adb. Please install android sdk platform tools";
|
||||
exit -1;
|
||||
fi
|
||||
|
||||
echo JAVA=${JAVA} >> check_tools.mk
|
||||
echo ANTLR=${ANTLR} >> check_tools.mk
|
||||
exit $error_on_quit
|
||||
|
|
Loading…
Reference in a new issue