diff options
author | Sven Gothel <sgothel@jausoft.com> | 2011-07-28 04:24:54 +0200 |
---|---|---|
committer | Sven Gothel <sgothel@jausoft.com> | 2011-07-28 04:24:54 +0200 |
commit | 2d672b1c5f237ccb911b9106308c0dc1977530b0 (patch) | |
tree | 3e7f66d032c7aab0dfadb663a2fb60381bb6eece | |
parent | 445521018f49305cb3c09a4f2dcf0e9be8bc5a46 (diff) |
Fix android build/unit-test ; Generalize aapt packaging (macro) ; Use jogamp icons
make/scripts/make.gluegen.all.android-armv7-cross.sh
- make Rami and me happy :)
- 3 default locations plus recognize user provided android toolkit path
- fixes using ant targets as arguments
make/jogamp-androidtasks.xml
- macro aapt.signed: create signed apk file from jar
- incl. adding native libraries
- see macro doc.
adding generic jogamp icons/images
-rw-r--r-- | make/build-test.xml | 15 | ||||
-rw-r--r-- | make/build.xml | 119 | ||||
-rw-r--r-- | make/jogamp-androidtasks.xml | 163 | ||||
-rw-r--r-- | make/lib/android/AndroidManifest.xml | 4 | ||||
-rw-r--r-- | make/lib/res/jogamp_logo_final_346x70pel.png | bin | 0 -> 8946 bytes | |||
-rw-r--r-- | make/lib/res/jogamp_symbol_final_135x135pel.png | bin | 0 -> 5492 bytes | |||
-rwxr-xr-x | make/scripts/make.gluegen.all.android-armv7-cross.sh | 47 |
7 files changed, 224 insertions, 124 deletions
diff --git a/make/build-test.xml b/make/build-test.xml index 51dc554..f00e7b2 100644 --- a/make/build-test.xml +++ b/make/build-test.xml @@ -8,6 +8,7 @@ <import file="gluegen-cpptasks.xml" /> <import file="jogamp-archivetasks.xml" /> + <import file="jogamp-androidtasks.xml" /> <import file="jogamp-env.xml" /> <condition property="rootrel.build" value="build"> @@ -130,12 +131,14 @@ </target> <target name="android.package" depends="java.build,native.build" if="isAndroid"> - <delete file="${gluegen-test.apk}" includeEmptyDirs="true" quiet="true" failonerror="false" /> - <exec dir="." executable="dx" logError="true" failonerror="true" failifexecutionfails="true"> - <arg line="--dex"/> - <arg line="--output=${gluegen-test.apk}"/> - <arg line="${gluegen-test.jar}"/> - </exec> + <aapt.signed + jarbuilddir="${build_t}" + jarbasename="gluegen-test" + nativebuilddir="${build_t.lib}" + nativebasename="test" + androidmanifest.path="lib/android/AndroidManifest.xml" + version.code="${gluegen_int_version}" + version.name="${gluegen.version.plus}" /> </target> <target name="c.configure" depends="gluegen.cpptasks.detect.os,gluegen.cpptasks.setup.compiler"> diff --git a/make/build.xml b/make/build.xml index be52aba..2b1454b 100644 --- a/make/build.xml +++ b/make/build.xml @@ -21,6 +21,7 @@ <import file="gluegen-cpptasks.xml" /> <import file="jogamp-archivetasks.xml" /> + <import file="jogamp-androidtasks.xml" /> <import file="jogamp-env.xml" /> <condition property="rootrel.build" value="build"> @@ -81,8 +82,10 @@ <property name="gluegen.build.commit" value="manual"/> <!-- fallback --> <!-- This is the version of GlueGen you are building --> + <property name="gluegen_int_version" value="2"/> <property name="gluegen_base_version" value="2.0"/> <property name="gluegen.version" value="${gluegen_base_version}-b${gluegen.build.number}-${version.timestamp}" /> + <property name="gluegen.version.plus" value="${gluegen_base_version}-${gluegen.branch}-b${gluegen.build.number}-${gluegen.build.commit}-${version.timestamp}" /> <property name="stub.includes.dir" value="stub_includes" /> <!-- NOTE: this MUST be relative for FileSet --> @@ -687,103 +690,25 @@ </target> <target name="android.package" depends="gluegen.cpptasks.detect.os,gluegen.build.check.java" if="isAndroid"> - <property name="dex.file.name" value="classes.dex" /> - <property name="intermediate.dex.file" location="${build}/apk-temp/${dex.file.name}" /> - <property name="resource.package.file.name" value="${build}/gluegen-rt.ap_" /> - <property name="signed.file.name" value="${build}/gluegen-rt-sign.ap_" /> - <property name="release.file.name" value="${build}/gluegen-rt.apk" /> - <mkdir dir="${build}/apk-temp/bin/lib/armeabi" /> - <mkdir dir="${build}/apk-temp/bin/lib/src" /> - <mkdir dir="${build}/apk-temp/bin/lib/assets" /> - <copy todir="${build}/apk-temp/bin/lib/armeabi"> - <fileset dir="${build}/obj"> - <include name="*gluegen-rt.${native.library.suffix}" /> - </fileset> - </copy> - <delete file="${intermediate.dex.file}" includeEmptyDirs="true" quiet="true" failonerror="false" /> - <delete file="${release.file.name}" includeEmptyDirs="true" quiet="true" failonerror="false" /> - - <exec dir="." executable="dx" logError="true" failonerror="true" failifexecutionfails="true"> - <arg line="--dex"/> - <arg line="--output=${intermediate.dex.file}"/> - <arg line="${build}/gluegen-rt.jar"/> - <arg line="${build}/apk-temp/"/> <!-- need to be installed .. etc --> - </exec> - - <property name="version.code" value="" /> - <property name="build.packaging.debug" value="false" /> - <property name="build.signing.debug" value="false" /> - <property name="resource.dir" value="lib/android/res" /> - <property name="resource.absolute.dir" location="${resource.dir}" /> - <property name="filter.abi" value="" /> - - <path id="android.antlibs"> - <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/anttasks.jar" /> - <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/sdklib.jar" /> - <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/androidprefs.jar" /> - <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/apkbuilder.jar" /> - <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/jarutils.jar" /> - </path> - - <echo>Packaging resources</echo> - <exec dir="." executable="aapt" logError="true" failonerror="true" failifexecutionfails="true"> - <arg line="package"/> - <arg line="-v"/> - <arg line="--debug-mode"/> - <arg line="-f"/> - <arg line="-j"/> - <arg line="${build}/gluegen-rt.jar"/> - <arg line="-M"/> - <arg line="lib/android/AndroidManifest.xml"/> - <arg line="-S"/> - <arg line="lib/android/res"/> - <arg line="-A"/> - <arg line="${build}/apk-temp/bin/lib/assets"/> - <arg line="-I"/> - <arg line="${env.ANDROID_SDK_HOME}/platforms/android-${env.ANDROID_SDK_VERSION}/android.jar"/> - <arg line="-F"/> - <arg line="${resource.package.file.name}"/> - <arg line="${build}/apk-temp/"/> - </exec> - - <!-- TODO: Remove temp key and use jogamp signer --> - <echo>Generating temp debug key...</echo> - <exec dir="." executable="keytool" failonerror="true"> - <arg value="-genkey "/> - <arg value="-alias" /> - <arg value="debug" /> - <arg value="-keystore" /> - <arg value="${build}/apk-temp/debug.keystore" /> - <arg value="-keypass" /> - <arg value="jogamp" /> - <arg value="-dname" /> - <arg value="CN=GLUEGEN Debug,O=JOGAMP,C=US" /> - <arg value="-storepass" /> - <arg value="jogamp" /> - </exec> - - <echo>Signing apk...</echo> <!-- needed for install on device --> - <signjar - jar="${resource.package.file.name}" - signedjar="${signed.file.name}" - keystore="${build}/apk-temp/debug.keystore" - storepass="jogamp" - alias="debug" - keypass="jogamp" - verbose="true" /> - - <echo>Running zip align on final apk...</echo> - <exec dir="." executable="${env.ANDROID_SDK_HOME}/tools/zipalign" failonerror="true"> - <arg line="-v" /> - <arg value="-f" /> - <arg value="4" /> - <arg path="${signed.file.name}" /> - <arg path="${release.file.name}" /> - </exec> - - <delete dir="${build}/apk-temp" includeEmptyDirs="true" quiet="true" failonerror="false" /> - <delete file="${resource.package.file.name}" includeEmptyDirs="true" quiet="true" failonerror="false" /> - <delete file="${signed.file.name}" includeEmptyDirs="true" quiet="true" failonerror="false" /> + + <aapt.signed + jarbuilddir="${build}" + jarbasename="gluegen-rt" + nativebuilddir="${gluegen.lib.dir}" + nativebasename="gluegen-rt" + androidmanifest.path="lib/android/AndroidManifest.xml" + version.code="${gluegen_int_version}" + version.name="${gluegen.version.plus}" /> + + <aapt.signed + jarbuilddir="${build}" + jarbasename="gluegen" + nativebuilddir="${gluegen.lib.dir}" + nativebasename="gluegen-rt" + androidmanifest.path="lib/android/AndroidManifest.xml" + version.code="${gluegen_int_version}" + version.name="${gluegen.version.plus}" /> + </target> <target name="base.compile" depends="init, gluegen.build.java, gluegen.build.c, tag.build" /> diff --git a/make/jogamp-androidtasks.xml b/make/jogamp-androidtasks.xml new file mode 100644 index 0000000..5bfd708 --- /dev/null +++ b/make/jogamp-androidtasks.xml @@ -0,0 +1,163 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="jogamp-androidtasks" basedir="."> + <dirname property="jogamp-androidtasks.basedir" file="${ant.file.jogamp-androidtasks}"/> + <taskdef resource="net/sf/antcontrib/antlib.xml"> + <classpath> + <pathelement location="${jogamp-androidtasks.basedir}/lib/ant-contrib-1.0b3.jar"/> + </classpath> + </taskdef> + + <!--- + <aapt.signed + jarbuilddir="${build}" // jar build location + jarbasename="gluegen-rt" // jar base file name + nativebuilddir="${gluegen.lib.dir}" // native library build location + nativebasename="gluegen-rt" // native library base file name "*${nativebasename}*.${native.library.suffix}" + androidmanifest.path="lib/android/AndroidManifest.xml" + version.code="${gluegen_int_version}" + version.name="${gluegen.version.plus}" + + // optional values, for having a valid keystore: + keystore.file="./my-kstore.jks" // user supplied keystore + keystore.alias="mykey01" // key alias + keystore.storepass="spwd" // store pwd + keystore.keypass="kpwd" // key pwd + /> + + Even though we have impl. signing w/ an own keystore, + we strongly discourage users to actually use it in an automated environment! + Pls sign your apps manually. + --> + <macrodef name="aapt.signed"> + <attribute name="jarbuilddir" /> + <attribute name="jarbasename" /> + <attribute name="nativebuilddir" /> + <attribute name="nativebasename" /> + <attribute name="androidmanifest.path" /> + <attribute name="version.code" /> + <attribute name="version.name" /> + <attribute name="keystore.file" default="/non.existing.user.keystore.file" /> + <attribute name="keystore.alias" default="debug" /> + <attribute name="keystore.storepass" default="jogamp" /> + <attribute name="keystore.keypass" default="jogamp" /> + <sequential> + <var name="m.aapt.build.apk" unset="true"/> + <var name="m.aapt.dex.file" unset="true"/> + <var name="m.aapt.resource.package.file.name" unset="true"/> + <var name="m.aapt.signed.file.name" unset="true"/> + <var name="m.aapt.release.file.name" unset="true"/> + <var name="m.aapt.keystore.file" unset="true"/> + + <property name="m.aapt.build.apk" value="@{jarbuilddir}/@{jarbasename}.apk.d" /> + <property name="m.aapt.dex.file" location="${m.aapt.build.apk}/image/classes.dex" /> + <property name="m.aapt.resource.package.file.name" value="${m.aapt.build.apk}/@{jarbasename}.ap_" /> + <property name="m.aapt.signed.file.name" value="${m.aapt.build.apk}/@{jarbasename}-sign.ap_" /> + <property name="m.aapt.release.file.name" value="@{jarbuilddir}/@{jarbasename}.apk" /> + + <condition property="m.aapt.keystore.file" value="@{keystore.file}" else="${m.aapt.build.apk}/debug.keystore"> + <available file="@{keystore.file}"/> + </condition> + + <delete file="${m.aapt.release.file.name}" includeEmptyDirs="true" quiet="true" failonerror="false" /> + <delete dir="${m.aapt.build.apk}" includeEmptyDirs="true" quiet="true" failonerror="false" /> + + <mkdir dir="${m.aapt.build.apk}/image/bin/lib/armeabi" /> + <mkdir dir="${m.aapt.build.apk}/image/bin/lib/src" /> + <mkdir dir="${m.aapt.build.apk}/image/bin/lib/assets" /> + <copy todir="${m.aapt.build.apk}/image/bin/lib/armeabi"> + <fileset dir="@{nativebuilddir}"> + <include name="*@{nativebasename}*.${native.library.suffix}" /> + </fileset> + </copy> + + <echo>aapt.signed @{jarbasename}: dex'ing</echo> + <exec dir="." executable="dx" logError="true" failonerror="true" failifexecutionfails="true"> + <arg line="--dex"/> + <arg line="--output=${m.aapt.dex.file}"/> + <arg line="@{jarbuilddir}/@{jarbasename}.jar"/> + </exec> + + <path id="android.antlibs"> + <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/anttasks.jar" /> + <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/sdklib.jar" /> + <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/androidprefs.jar" /> + <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/apkbuilder.jar" /> + <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/jarutils.jar" /> + </path> + + <echo>aapt.signed @{jarbasename}: packaging</echo> + <exec dir="." executable="aapt" logError="true" failonerror="true" failifexecutionfails="true"> + <arg line="package"/> + <!--arg line="-v"/--> + <arg line="--debug-mode"/> + <arg line="-f"/> + <!-- arg line="-j" /> + <arg value="@{jarbuilddir}/@{jarbasename}.jar"/--> + + <arg line="-M" /> + <arg value="@{androidmanifest.path}"/> + + <arg line="-S" /> + <arg value="lib/android/res"/> + + <arg line="-A" /> + <arg value="${m.aapt.build.apk}/image/bin/lib/assets"/> <!-- FIXME: Should assets be in out lib/android/assets ?? --> + + <arg line="-I" /> + <arg value="${env.ANDROID_SDK_HOME}/platforms/android-${env.ANDROID_SDK_VERSION}/android.jar"/> + + <arg line="--version-code" /> + <arg value="@{version.code}"/> + + <arg line="--version-name" /> + <arg value="@{version.name}"/> + + <arg line="-F" /> + <arg value="${m.aapt.resource.package.file.name}"/> + + <arg line="${m.aapt.build.apk}/image/"/> + </exec> + + <echo>aapt.signed @{jarbasename}: gen temp keystore @{keystore.alias} @ ${m.aapt.build.apk}/debug.keystore</echo> + <exec dir="." executable="keytool" failonerror="true"> + <arg value="-genkey"/> + + <arg value="-keystore" /> + <arg value="${m.aapt.build.apk}/debug.keystore" /> + + <arg value="-alias" /> + <arg value="@{keystore.alias}" /> + + <arg value="-dname" /> + <arg value="CN=JogAmp Debug,O=JogAmp,C=DE" /> + + <arg value="-keypass" /> + <arg value="@{keystore.keypass}" /> + + <arg value="-storepass" /> + <arg value="@{keystore.storepass}" /> + </exec> + + <echo>aapt.signed @{jarbasename}: signing w/ key @{keystore.alias} @ ${m.aapt.keystore.file}</echo> + <signjar + jar="${m.aapt.resource.package.file.name}" + signedjar="${m.aapt.signed.file.name}" + keystore="${m.aapt.keystore.file}" + alias="@{keystore.alias}" + keypass="@{keystore.keypass}" + storepass="@{keystore.storepass}" + verbose="false" /> + + <echo>aapt.signed @{jarbasename}: zip aligning</echo> + <exec dir="." executable="${env.ANDROID_SDK_HOME}/tools/zipalign" failonerror="true"> + <arg line="-v" /> + <arg value="-f" /> + <arg value="4" /> + <arg path="${m.aapt.signed.file.name}" /> + <arg path="${m.aapt.release.file.name}" /> + </exec> + + <delete dir="${m.aapt.build.apk}" includeEmptyDirs="true" quiet="true" failonerror="false" /> + </sequential> + </macrodef> +</project> diff --git a/make/lib/android/AndroidManifest.xml b/make/lib/android/AndroidManifest.xml index 7ddeac8..121a876 100644 --- a/make/lib/android/AndroidManifest.xml +++ b/make/lib/android/AndroidManifest.xml @@ -1,8 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.jogamp.gluegen" - android:versionCode="1" - android:versionName="1.0"> + package="com.jogamp.gluegen"> <uses-sdk android:minSdkVersion="8" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> diff --git a/make/lib/res/jogamp_logo_final_346x70pel.png b/make/lib/res/jogamp_logo_final_346x70pel.png Binary files differnew file mode 100644 index 0000000..935c4c0 --- /dev/null +++ b/make/lib/res/jogamp_logo_final_346x70pel.png diff --git a/make/lib/res/jogamp_symbol_final_135x135pel.png b/make/lib/res/jogamp_symbol_final_135x135pel.png Binary files differnew file mode 100644 index 0000000..a097108 --- /dev/null +++ b/make/lib/res/jogamp_symbol_final_135x135pel.png diff --git a/make/scripts/make.gluegen.all.android-armv7-cross.sh b/make/scripts/make.gluegen.all.android-armv7-cross.sh index db69527..a9d84af 100755 --- a/make/scripts/make.gluegen.all.android-armv7-cross.sh +++ b/make/scripts/make.gluegen.all.android-armv7-cross.sh @@ -11,31 +11,42 @@ export TARGET_ANT_HOME=/usr/share/ant export ANDROID_SDK_VERSION=9 -if [ $# -eq "0" ] ; then - echo "Usage: `basename $0` <ANDROID_SDK_HOME> <NDK_ROOT>" - echo "Default: ANDROID_SDK_HOME=/usr/local/android-sdk-linux_x86" - echo "Default: NDK_ROOT=/usr/local/android-ndk-r6" -fi - -if [ $# -ge "2" ] ; then -ANDROID_SDK_HOME=$1 -shift -NDK_ROOT=$1 -shift -fi - -echo $ANDROID_SDK_HOME -echo $NDK_ROOT +echo ANDROID_SDK_HOME $ANDROID_SDK_HOME +echo NDK_ROOT $NDK_ROOT if [ -z "$NDK_ROOT" ] ; then - NDK_ROOT=/usr/local/android-ndk-r6 + if [ -e /usr/local/android-ndk-r6 ] ; then + NDK_ROOT=/usr/local/android-ndk-r6 + elif [ -e /opt-linux-x86/android-ndk-r6 ] ; then + NDK_ROOT=/opt-linux-x86/android-ndk-r6 + elif [ -e /opt/android-ndk-r6 ] ; then + NDK_ROOT=/opt/android-ndk-r6 + else + echo NDK_ROOT is not specified and does not exist in default locations + exit 1 + fi +elif [ ! -e $NDK_ROOT ] ; then + echo NDK_ROOT $NDK_ROOT does not exist + exit 1 fi export NDK_ROOT NDK_TOOLCHAIN=$NDK_ROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/arm-linux-androideabi if [ -z "$ANDROID_SDK_HOME" ] ; then - ANDROID_SDK_HOME=/usr/local/android-sdk-linux_x86 -fi + if [ -e /usr/local/android-sdk-linux_x86 ] ; then + ANDROID_SDK_HOME=/usr/local/android-sdk-linux_x86 + elif [ -e /opt-linux-x86/android-sdk-linux_x86 ] ; then + ANDROID_SDK_HOME=/opt-linux-x86/android-sdk-linux_x86 + elif [ -e /opt/android-sdk-linux_x86 ] ; then + ANDROID_SDK_HOME=/opt/android-sdk-linux_x86 + else + echo ANDROID_SDK_HOME is not specified and does not exist in default locations + exit 1 + fi +elif [ ! -e $ANDROID_SDK_HOME ] ; then + echo ANDROID_SDK_HOME $ANDROID_SDK_HOME does not exist + exit 1 +fi export ANDROID_SDK_HOME export PATH="$NDK_TOOLCHAIN/bin:$ANDROID_SDK_HOME/platform-tools:$PATH" |