summaryrefslogtreecommitdiff
path: root/scripts/build_android.sh
blob: 8a4ea41a17c25a4d8b7c7545e05dcacfcdee70fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# Build Navit for Android.
#
# This script is to be run from the root of the Navit source tree. It is used by CircleCI as well as for local builds,
# in order to keep build environments as uniform as possible and CI test results meaningful.
#
# It will build Navit for all processor architectures specified in navit/android/build.gradle.
#
# When running this script locally, ensure all build dependencies are in place:
# - Packages required: cmake gettext libsaxonb-java librsvg2-bin pkg-config libprotobuf-c-dev protobuf-c-compiler
# - Android SDK installed
# - Environment variable $ANDROID_HOME points to Android SDK install location
# - Android NDK and CMake components installed via
#     sdkmanager ndk-bundle "cmake;3.6.4111459"
#   (later CMake versions from the SDK repository may also work)
#
# If any of the build steps fails, this script aborts with an error immediately.

echo Set up environment
set - e
export PATH=$PATH:$ANDROID_HOME/tools
export JVM_OPTS="-Xmx3200m"
export GRADLE_OPTS='-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'

echo Run CMake
cmake ./ -Dvehicle/gpsd_dbus:BOOL=FALSE -Dsvg2png_scaling:STRING=-1,24,32,48,64,96,128,192,256 -Dsvg2png_scaling_nav:STRING=-1,24,32,48,64,96,128,192,256 -Dsvg2png_scaling_flag:STRING=-1,24,32,64,96 -DUSE_PLUGINS=n -DBUILD_MAPTOOL=n -DXSL_PROCESSING=y -DXSLTS=android -DANDROID=y -DSAMPLE_MAP=n || exit 1

echo Process icons
pushd navit/icons
make || exit 32
mkdir ../android/res/drawable-nodpi
cp ./*.png ../android/res/drawable-nodpi
pushd ../android/res/drawable-nodpi
rename 'y/A-Z/a-z/' ./*.png
popd
popd

echo Process translations
pushd po
make || exit 64
mkdir ../navit/android/res/raw
cp ./*.mo ../navit/android/res/raw
pushd ../navit/android/res/raw
rename 'y/A-Z/a-z/' ./*.mo
popd
popd

echo Process xml config files
make navit_config_xml || exit 96
pushd navit
mkdir -p ./android/assets
cp -R config ./android/assets/
popd

echo Chmod permissions
chmod a+x ./gradlew

echo Download dependencies
./gradlew -v

echo Build
./gradlew assembleDebug || exit 128

echo Build finished.
echo APK should be in "navit/android/build/outputs/apk" and can be installed with
echo ./gradlew installDebug