1#!/bin/sh
2
3MAKE=make
4QMAKE=@ANDROID_QT_QMAKE@
5APK_MAKE=@ANDROID_QT_APK_MAKE@
6
7TRAYMON_DIR=@TOP_DIR@/bacula/src/qt-console/tray-monitor
8BUILD_DIR=${TRAYMON_DIR}/android-build
9BUILD_JSON_FILE=android-libbacula-tray-monitor.so-deployment-settings.json
10BUILD_TARGET=android-@ANDROID_API@
11
12rm -rf ${BUILD_DIR}
13mkdir ${BUILD_DIR}
14cp ${KEYSTORE_FILE} ${BUILD_DIR}/android_release.keystore
15
16if [ -z "${ENTERPRISE}" ]; then
17   ${QMAKE} ${TRAYMON_DIR}/tray-monitor.android.pro -spec android-g++ INCLUDEPATH+=${ANDROID_OPENSSL_DIR}/include
18else
19   ${QMAKE} ${TRAYMON_DIR}/tray-monitor.android.pro -spec android-g++ INCLUDEPATH+=${ANDROID_OPENSSL_DIR}/include DEFINES+="ENTERPRISE"
20fi
21
22#libfix.sh
23sed -i -e 's/\.so/\.la/g' Makefile
24
25if [ -z "${SKIP_CLEAN}" ]; then
26   ${MAKE} clean
27fi
28
29${MAKE}
30${MAKE} install INSTALL_ROOT=${BUILD_DIR}
31
32#mvdyn.sh.in
33cp ${TRAYMON_DIR}/.libs/libbacula-tray-monitor.so ${TRAYMON_DIR}
34cp ${TRAYMON_DIR}/.libs/libbacula-tray-monitor.so ${BUILD_DIR}/@ANDROID_QT_BUILD_LIBS@
35cp @TOP_DIR@/bacula/src/lib/.libs/libbaccfg-@VERSION@.so ${BUILD_DIR}/@ANDROID_QT_BUILD_LIBS@
36cp @TOP_DIR@/bacula/src/lib/.libs/libbac-@VERSION@.so ${BUILD_DIR}/@ANDROID_QT_BUILD_LIBS@
37cp @TOP_DIR@/bacula/src/findlib/.libs/libbacfind-@VERSION@.so ${BUILD_DIR}/@ANDROID_QT_BUILD_LIBS@
38#cp ${DEPKGS_DIR}/src/openssl/libssl.so ${BUILD_DIR}/@ANDROID_QT_BUILD_LIBS@
39#cp ${DEPKGS_DIR}/src/openssl/libcrypto.so ${BUILD_DIR}/@ANDROID_QT_BUILD_LIBS@
40
41#build android apk
42${APK_MAKE} --output ${BUILD_DIR} \
43    --verbose \
44    --input ${BUILD_JSON_FILE} \
45    --android-platform ${BUILD_TARGET} \
46    --sign ${BUILD_DIR}/android_release.keystore  \
47    --storepass $KEYSTORE_PASSWORD \
48    --gradle
49