Commit 9133085d authored by Filip Roséen's avatar Filip Roséen Committed by Jean-Baptiste Kempf

compile.sh: introduce diagnostic helper

Given that diagnostic output should be written to stderr and not
stdout, a function named "diagnostic" is introduced that echo's
whatever is passed to stderr.

Usage of "echo" in terms of diagnostics has been replaced by usage of
this newly added function.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent da1fc362
#! /bin/sh #! /bin/sh
set -e set -e
diagnostic()
{
echo "$@" 1>&2;
}
# Read the Android Wiki http://wiki.videolan.org/AndroidCompile # Read the Android Wiki http://wiki.videolan.org/AndroidCompile
# Setup all that stuff correctly. # Setup all that stuff correctly.
# Get the latest Android SDK Platform or modify numbers in configure.sh and libvlc/default.properties. # Get the latest Android SDK Platform or modify numbers in configure.sh and libvlc/default.properties.
...@@ -44,8 +49,8 @@ while [ $# -gt 0 ]; do ...@@ -44,8 +49,8 @@ while [ $# -gt 0 ]; do
RUN=1 RUN=1
;; ;;
*) *)
echo "$0: Invalid option '$1'." 1>&2 diagnostic "$0: Invalid option '$1'."
echo "$0: Try --help for more information." 1>&2 diagnostic "$0: Try --help for more information."
exit 1 exit 1
;; ;;
esac esac
...@@ -53,13 +58,13 @@ while [ $# -gt 0 ]; do ...@@ -53,13 +58,13 @@ while [ $# -gt 0 ]; do
done done
if [ -z "$ANDROID_NDK" -o -z "$ANDROID_SDK" ]; then if [ -z "$ANDROID_NDK" -o -z "$ANDROID_SDK" ]; then
echo "You must define ANDROID_NDK, ANDROID_SDK before starting." diagnostic "You must define ANDROID_NDK, ANDROID_SDK before starting."
echo "They must point to your NDK and SDK directories.\n" diagnostic "They must point to your NDK and SDK directories."
exit 1 exit 1
fi fi
if [ -z "$ANDROID_ABI" ]; then if [ -z "$ANDROID_ABI" ]; then
echo "*** No ANDROID_ABI defined architecture: using ARMv7" diagnostic "*** No ANDROID_ABI defined architecture: using ARMv7"
ANDROID_ABI="armeabi-v7a" ANDROID_ABI="armeabi-v7a"
fi fi
...@@ -80,7 +85,7 @@ checkfail() ...@@ -80,7 +85,7 @@ checkfail()
########## ##########
if [ ! -d "gradle/wrapper" ]; then if [ ! -d "gradle/wrapper" ]; then
echo "Downloading gradle" diagnostic "Downloading gradle"
GRADLE_VERSION=2.10 GRADLE_VERSION=2.10
GRADLE_URL=https://download.videolan.org/pub/contrib/gradle-${GRADLE_VERSION}-all.zip GRADLE_URL=https://download.videolan.org/pub/contrib/gradle-${GRADLE_VERSION}-all.zip
wget ${GRADLE_URL} 2>/dev/null || curl -O ${GRADLE_URL} wget ${GRADLE_URL} 2>/dev/null || curl -O ${GRADLE_URL}
...@@ -135,7 +140,7 @@ if [ -z "$KEYSTORE_FILE" ]; then ...@@ -135,7 +140,7 @@ if [ -z "$KEYSTORE_FILE" ]; then
STOREALIAS="androiddebugkey" STOREALIAS="androiddebugkey"
else else
if [ -z "$PASSWORD_KEYSTORE" ]; then if [ -z "$PASSWORD_KEYSTORE" ]; then
echo "No password" diagnostic "No password"
exit 1 exit 1
fi fi
rm -f gradle.properties rm -f gradle.properties
...@@ -160,11 +165,11 @@ fi ...@@ -160,11 +165,11 @@ fi
TESTED_HASH=4e213ff TESTED_HASH=4e213ff
if [ ! -d "vlc" ]; then if [ ! -d "vlc" ]; then
echo "VLC source not found, cloning" diagnostic "VLC source not found, cloning"
git clone git://git.videolan.org/vlc.git vlc git clone git://git.videolan.org/vlc.git vlc
checkfail "vlc source: git clone failed" checkfail "vlc source: git clone failed"
else else
echo "VLC source found" diagnostic "VLC source found"
cd vlc cd vlc
if ! git cat-file -e ${TESTED_HASH}; then if ! git cat-file -e ${TESTED_HASH}; then
cat << EOF cat << EOF
...@@ -181,7 +186,7 @@ fi ...@@ -181,7 +186,7 @@ fi
# Make VLC # # Make VLC #
############ ############
echo "Configuring" diagnostic "Configuring"
OPTS="-a ${ANDROID_ABI}" OPTS="-a ${ANDROID_ABI}"
if [ "$RELEASE" = 1 ]; then if [ "$RELEASE" = 1 ]; then
OPTS="$OPTS release" OPTS="$OPTS release"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment