This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathbuild-android.osx
More file actions
executable file
·165 lines (136 loc) · 5.74 KB
/
build-android.osx
File metadata and controls
executable file
·165 lines (136 loc) · 5.74 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# The folder containing this script
export TOOLS=`dirname $0`
export TRUNK=`cd $TOOLS/..; pwd`
# Global variables needed later
if [ "$MODE" == "" ]; then
export MODE=debug
fi
if [ "$MODE" == "debug" ]; then
export DEBUGGABLE_FLAG=true
export DEBUG_FLAG=1
else
export DEBUGGABLE_FLAG=false
export DEBUG_FLAG=0
fi
export ANDROID_NDK=$TRUNK/sdks/android-ndk
export ANDROID_SDK=$TRUNK/sdks/android-sdk
# Local variables
export SRCROOT=$TRUNK
export JAVA_SDK=`/usr/libexec/java_home`
export JCOUNT=20
export PREBUILT_LIB_DIR=$SRCROOT/prebuilt/lib/android/armv6
# Find the appropriate folder for the platform-tools, now located in the build-tools
BUILD_TOOLS=${ANDROID_SDK}/build-tools/$(ls $ANDROID_SDK/build-tools | tail -n 1)
# Path variables
export CLASSPATH="$ANDROID_SDK/platforms/android-8/android.jar"
export NDKBUILD=$ANDROID_NDK/ndk-build
export DSTROOT=$SRCROOT/_build/android/$MODE
export RAWROOT=$SRCROOT/_build/android/$MODE/assets
export JAVAC=$JAVA_SDK/bin/javac
export JAR=$JAVA_SDK/bin/jar
export ADB=$ANDROID_SDK/platform-tools/adb
# Android SDK changed a bit from the version 20 and part of the tools can't be found in
# the platform-tools anymore
if [ -f "$ANDROID_SDK/platform-tools/aidl" ]; then
export DX=$ANDROID_SDK/platforms/android-8/tools/dx
export AAPT=$ANDROID_SDK/platforms/android-8/tools/aapt
export APKBUILDER=$ANDROID_SDK/tools/apkbuilder
export ZIPALIGN=$ANDROID_SDK/tools/zipalign
export AIDL=$ANDROID_SDK/platform-tools/aidl
else
# Android SDK 20+ has been installed
# Find the appropriate folder for the platform-tools, now located in the build-tools
BUILD_TOOLS=${ANDROID_SDK}/build-tools/$(ls $ANDROID_SDK/build-tools | tail -n 1)
export DX=$BUILD_TOOLS/dx
export AAPT=$BUILD_TOOLS/aapt
export APKBUILDER="$ANDROID_SDK/tools/lib/sdklib.jar"
export ZIPALIGN=$BUILD_TOOLS/zipalign
export AIDL=$BUILD_TOOLS/aidl
fi
##########
# Update version info
#$TRUNK/prebuilt/bin/Revolution.osx -ui $TRUNK/engine/encode_version.rev $TRUNK/engine
cd $TRUNK/engine
$TRUNK/util/encode_version.pl $TRUNK/engine
cd $TRUNK
# Build the native code components
export NDK_PROJECT_PATH=$DSTROOT
echo "Building native code components..."
$NDKBUILD NDK_DEBUG=$DEBUG_FLAG NDK_APP_DEBUGGABLE=$DEBUGGABLE_FLAG NDK_APPLICATION_MK=$SRCROOT/Application.mk -j $JCOUNT -s
if [ $? != 0 ]; then
exit $?
fi
export JAVASRC=$SRCROOT/engine/src/java
# generate the interface classes from the aidl files
"$AIDL" -I"$JAVASRC" -p"$ANDROID_SDK/platforms/android-8/framework.aidl" "$JAVASRC/com/sec/android/iap/IAPServiceCallback.aidl"
if [ $? != 0 ]; then
exit $?
fi
"$AIDL" -I"$JAVASRC" -p"$ANDROID_SDK/platforms/android-8/framework.aidl" "$JAVASRC/com/sec/android/iap/IAPConnector.aidl"
if [ $? != 0 ]; then
exit $?
fi
# generate the IInAppBillingService interface class from the aidl file
"$AIDL" -I"JAVASRC" -p"$ANDROID_SDK/platforms/android-8/framework.aidl" "$JAVASRC/com/android/vending/billing/IInAppBillingService.aidl"
if [ $? != 0 ]; then
exit $?
fi
# Compile the java classes
echo "Building java classes..."
mkdir -p "$DSTROOT/classes_livecode_community"
mkdir -p "$DSTROOT/classes_app"
"$JAVAC" -d "$DSTROOT/classes_livecode_community" -source 1.5 -target 1.5 -cp "$CLASSPATH" -sourcepath "$JAVASRC" "$JAVASRC/com/runrev/android/LiveCodeActivity.java"
if [ $? != 0 ]; then
exit $?
fi
"$JAVAC" -d "$DSTROOT/classes_livecode_community" -source 1.5 -target 1.5 -cp "$CLASSPATH" -sourcepath "$JAVASRC" "$JAVASRC/com/runrev/android/EngineReceiver.java"
if [ $? != 0 ]; then
exit $?
fi
"$JAVAC" -d "$DSTROOT/classes_livecode_community" -source 1.5 -target 1.5 -cp "$CLASSPATH" -sourcepath "$JAVASRC" "$JAVASRC/com/runrev/android/PushReceiver.java"
if [ $? != 0 ]; then
exit $?
fi
"$JAVAC" -d "$DSTROOT/classes_livecode_community" -source 1.5 -target 1.5 -cp "$CLASSPATH" -sourcepath "$JAVASRC" "$JAVASRC/com/runrev/android/billing/google/GoogleBillingProvider.java"
if [ $? != 0 ]; then
exit $?
fi
"$JAVAC" -d "$DSTROOT/classes_livecode_community" -source 1.5 -target 1.5 -cp "$CLASSPATH" -sourcepath "$JAVASRC" "$JAVASRC/com/runrev/android/billing/samsung/SamsungBillingProvider.java"
if [ $? != 0 ]; then
exit $?
fi
# add LiveCode classes to jar
echo "Create Classes jar"
"$JAR" cf "$DSTROOT/LiveCode-Community.jar" -C "$DSTROOT/classes_livecode_community" .
##########
#
# CUSTOM_DIR="$HOME/Documents/My LiveCode/Runtime/Android"
# CUSTOM_EXT_DIR="$HOME/Documents/My LiveCode/Externals"
#
# mkdir -p "$CUSTOM_DIR"
#
# cp $DSTROOT/libs/armeabi/librevandroid.so "$CUSTOM_DIR/Standalone"
# cp $DSTROOT/libs/armeabi/librevxml.so "$CUSTOM_DIR/RevXml"
# cp $DSTROOT/libs/armeabi/librevzip.so "$CUSTOM_DIR/RevZip"
# cp $DSTROOT/libs/armeabi/librevdb.so "$CUSTOM_DIR/RevDb"
# cp $DSTROOT/libs/armeabi/libdbsqlite.so "$CUSTOM_DIR/DbSqlite"
# cp $DSTROOT/libs/armeabi/libdbmysql.so "$CUSTOM_DIR/DbMysql"
# cp $DSTROOT/LiveCode.jar "$CUSTOM_DIR/Classes"
# cp $TRUNK/engine/rsrc/android-manifest.xml "$CUSTOM_DIR/Manifest.xml"
# cp $TRUNK/engine/rsrc/android-notify-icon.png "$CUSTOM_DIR/notify_icon.png"
# cp $TRUNK/engine/rsrc/android-inputcontrol.xml "$CUSTOM_DIR/livecode_inputcontrol.xml"
#
# ##########
PKGDIR=$DSTROOT
cp $DSTROOT/libs/armeabi/librevandroid-community.so $PKGDIR/Standalone-Community
cp $DSTROOT/libs/armeabi/librevxml.so $PKGDIR/RevXml
cp $DSTROOT/libs/armeabi/librevzip.so $PKGDIR/RevZip
cp $DSTROOT/libs/armeabi/librevdb.so $PKGDIR/RevDb
cp $DSTROOT/libs/armeabi/libdbsqlite.so $PKGDIR/DbSqlite
cp $DSTROOT/libs/armeabi/libdbmysql.so $PKGDIR/DbMysql
cp $DSTROOT/libs/armeabi/librevsecurity.so $PKGDIR/RevSecurity
cp $DSTROOT/LiveCode-Community.jar $PKGDIR/Classes-Community
cp $TRUNK/engine/rsrc/android-manifest.xml $PKGDIR/Manifest.xml
cp $TRUNK/engine/rsrc/android-notify-icon.png "$PKGDIR/notify_icon.png"
cp $TRUNK/engine/rsrc/android-inputcontrol.xml "$PKGDIR/livecode_inputcontrol.xml"
##########