Improve check_tools again, check for almost everything

This commit is contained in:
Gautier Pelloux-Prayer 2014-12-23 12:28:48 +01:00
parent 3296ca83f1
commit 0f4de68059
2 changed files with 24 additions and 12 deletions

View file

@ -12,7 +12,7 @@ LINPHONE_ANDROID_DEBUG_VERSION=$(shell git describe --always)
BELLESIP_VERSION_SCRIPT:=cat submodules/belle-sip/configure.ac | grep "AC_INIT(" | sed -e "s/.*belle-sip\]//" | sed -e "s/].*//" | sed -e "s/.*\[//"
BELLESIP_VERSION=$(shell $(BELLESIP_VERSION_SCRIPT))
ANDROID_MOST_RECENT_TARGET=$(shell android list target -c | grep -E 'android-[0-9]+' | tail -n1)
#We force target 19 because 21 creates binaries incompatible with older versions due to rand() function no longer inline (congrats to Google's developers)
#We force target 19 because 21 creates binaries incompatible with older versions due to rand() function no longer inline (congrats to Google's developers)
NDKBUILD_TARGET=android-19
#The NDK target used to compile external third parties (ffmpeg, x264)
EXTERNAL_MAKE_TARGET=14
@ -64,7 +64,7 @@ APP_STL=stlport_static
# Checks
CHECK_MSG=$(shell ./check_tools.sh)
ifneq ($(CHECK_MSG),)
$(error $(CHECK_MSG))
$(error Some tools are missing.)
endif
include check_tools.mk

View file

@ -1,37 +1,49 @@
#!/bin/sh
rm -f check_tools.mk
touch check_tools.mk
error_on_quit=0
echo_err() {
echo "$@" >&2
}
check_installed() {
if [ -z "$(which $1)" ]; then
echo "Could not find $1. Please install $2."
echo_err "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"
for prog in automake autoconf pkg-config java ant yasm nasm wget; do
check_installed "$prog" "it"
done
check_installed "libtoolize" "libtool"
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"
echo_err "Install at least one android target in the android SDK"
error_on_quit=1
fi
fi
if nasm -f elf32 2>&1 | grep -q "fatal: unrecognised output format"; then
echo_err "Invalid version of nasm: your version does not support elf32 output format. If you have installed nasm, please check that your PATH env variable is set correctly."
error_on_quit=1
fi
if ! (find submodules/linphone/mediastreamer2 -mindepth 1 2>/dev/null | grep -q . \
|| find submodules/linphone/oRTP -mindepth 1 2>/dev/null | grep -q .); then
echo_err "Missing some git submodules. Did you run 'git submodule update --init --recursive'?"
fi
if [ $error_on_quit = 0 ]; then
rm -f check_tools.mk
touch check_tools.mk
echo "JAVA=\"$(which java)\"" >> check_tools.mk
echo "ANTLR=\"$(which java)\" -jar \"submodules/externals/antlr3/antlr-3.2.jar\"" >> check_tools.mk
else
echo "Failed to detect required tools, aborting."
fi
exit $error_on_quit