aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/platform/android/android.mk193
-rw-r--r--dists/android/custom_rules.xml31
-rw-r--r--dists/android/jni/Android.mk9
-rw-r--r--dists/android/project.properties11
-rw-r--r--dists/android/res/layout/main.xml4
5 files changed, 102 insertions, 146 deletions
diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk
index 69aa9d8303..f9a2bc9813 100644
--- a/backends/platform/android/android.mk
+++ b/backends/platform/android/android.mk
@@ -2,183 +2,92 @@
# These must be incremented for each market upload
ANDROID_VERSIONCODE = 6
-ANDROID_PLUGIN_VERSIONCODE = 6
-JAVA_FILES = \
- ScummVM.java \
- ScummVMEvents.java \
- ScummVMEventsHoneycomb.java \
- ScummVMApplication.java \
- ScummVMActivity.java \
- EditableSurfaceView.java \
- MouseHelper.java \
- Unpacker.java
+ANDROID_TARGET_VERSION = 14
-JAVA_FILES_PLUGIN = \
- PluginProvider.java
-
-JAVA_FILES_GEN = \
- Manifest.java \
- R.java
+NDK_BUILD = $(ANDROID_NDK)/ndk-build
+SDK_ANDROID = $(ANDROID_SDK)/tools/android
PATH_DIST = $(srcdir)/dists/android
PATH_RESOURCES = $(PATH_DIST)/res
PORT_DISTFILES = $(PATH_DIST)/README.Android
+DIST_JAVA_SRC_DIR = $(srcdir)/backends/platform/android/org
RESOURCES = \
- $(PATH_RESOURCES)/values/strings.xml \
- $(PATH_RESOURCES)/values/margins.xml \
- $(PATH_RESOURCES)/values-television/margins.xml \
- $(PATH_RESOURCES)/layout/main.xml \
- $(PATH_RESOURCES)/layout/splash.xml \
- $(PATH_RESOURCES)/drawable/gradient.xml \
- $(PATH_RESOURCES)/drawable/scummvm.png \
- $(PATH_RESOURCES)/drawable/scummvm_big.png \
- $(PATH_RESOURCES)/drawable-xhdpi/ouya_icon.png
-
-PLUGIN_RESOURCES = \
- $(PATH_RESOURCES)/values/strings.xml \
- $(PATH_RESOURCES)/drawable/scummvm.png
-
-# FIXME: find/mark plugin entry points and add all this back again:
-#LDFLAGS += -Wl,--gc-sections
-#CXXFLAGS += -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden
-
-AAPT = $(ANDROID_SDK)/$(ANDROID_BTOOLS)/aapt
-ADB = $(ANDROID_SDK)/platform-tools/adb
-DX = $(ANDROID_SDK)/$(ANDROID_BTOOLS)/dx
-APKBUILDER = java -Xmx128M -classpath $(ANDROID_SDK)/tools/lib/sdklib.jar com.android.sdklib.build.ApkBuilderMain
-JAVAC ?= javac
-JAVACFLAGS = -source 1.5 -target 1.5
-
-ANDROID_JAR = $(ANDROID_SDK)/platforms/android-14/android.jar
+ $(PATH_BUILD_RES)/values/strings.xml \
+ $(PATH_BUILD_RES)/values-television/margins.xml \
+ $(PATH_BUILD_RES)/layout/main.xml \
+ $(PATH_BUILD_RES)/layout/splash.xml \
+ $(PATH_BUILD_RES)/drawable/gradient.xml \
+ $(PATH_BUILD_RES)/drawable/scummvm.png \
+ $(PATH_BUILD_RES)/drawable/scummvm_big.png \
+ $(PATH_BUILD_RES)/drawable-xhdpi/ouya_icon.png
+
+DIST_ANDROID_MK = $(PATH_DIST)/jni/Android.mk
+DIST_BUILD_XML = $(PATH_DIST)/custom_rules.xml
PATH_BUILD = ./build.tmp
PATH_BUILD_ASSETS = $(PATH_BUILD)/assets
-PATH_BUILD_CLASSES_MAIN_TOP = $(PATH_BUILD)/classes.main
-PATH_BUILD_CLASSES_PLUGIN_TOP = $(PATH_BUILD)/classes.plugin
-
-PATH_STAGE_PREFIX = build.stage
-PATH_STAGE_MAIN = $(PATH_STAGE_PREFIX).main
-
-PATH_REL = org/scummvm/scummvm
-PATH_SRC_TOP = $(srcdir)/backends/platform/android
-PATH_SRC = $(PATH_SRC_TOP)/$(PATH_REL)
-
-PATH_GEN_TOP = $(PATH_BUILD)/java
-PATH_GEN = $(PATH_GEN_TOP)/$(PATH_REL)
-PATH_CLASSES_MAIN = $(PATH_BUILD_CLASSES_MAIN_TOP)/$(PATH_REL)
-PATH_CLASSES_PLUGIN = $(PATH_BUILD_CLASSES_PLUGIN_TOP)/$(PATH_REL)
+PATH_BUILD_RES = $(PATH_BUILD)/res
+PATH_BUILD_LIBSCUMMVM = $(PATH_BUILD)/mylib/armeabi/libscummvm.so
FILE_MANIFEST_SRC = $(srcdir)/dists/android/AndroidManifest.xml
FILE_MANIFEST = $(PATH_BUILD)/AndroidManifest.xml
-FILE_DEX = $(PATH_BUILD)/classes.dex
-FILE_DEX_PLUGIN = $(PATH_BUILD)/plugins/classes.dex
-FILE_RESOURCES = resources.ap_
-FILE_RESOURCES_MAIN = $(PATH_BUILD)/$(FILE_RESOURCES)
-
-SRC_GEN = $(addprefix $(PATH_GEN)/, $(JAVA_FILES_GEN))
-
-CLASSES_MAIN = $(addprefix $(PATH_CLASSES_MAIN)/, $(JAVA_FILES:%.java=%.class))
-CLASSES_GEN = $(addprefix $(PATH_CLASSES_MAIN)/, $(JAVA_FILES_GEN:%.java=%.class))
-CLASSES_PLUGIN = $(addprefix $(PATH_CLASSES_PLUGIN)/, $(JAVA_FILES_PLUGIN:%.java=%.class))
-APK_MAIN = scummvm.apk
+APK_MAIN = ScummVM-debug.apk
+APK_MAIN_RELEASE = ScummVM-release-unsigned.apk
APK_PLUGINS = $(patsubst plugins/lib%.so, scummvm-engine-%.apk, $(PLUGINS))
-$(FILE_MANIFEST): $(FILE_MANIFEST_SRC)
+$(FILE_MANIFEST): $(FILE_MANIFEST_SRC) | $(PATH_BUILD)
@$(MKDIR) -p $(@D)
sed "s/@ANDROID_VERSIONCODE@/$(ANDROID_VERSIONCODE)/" < $< > $@
-$(SRC_GEN): $(FILE_MANIFEST) $(filter %.xml,$(RESOURCES)) $(ANDROID_JAR)
- @$(MKDIR) -p $(PATH_GEN_TOP)
- $(AAPT) package -m -J $(PATH_GEN_TOP) -M $< -S $(PATH_RESOURCES) -I $(ANDROID_JAR)
-
-$(PATH_CLASSES_MAIN)/%.class: $(PATH_GEN)/%.java $(SRC_GEN)
+$(PATH_BUILD)/res/%: $(PATH_DIST)/res/% | $(PATH_BUILD)
@$(MKDIR) -p $(@D)
- $(JAVAC) $(JAVACFLAGS) -cp $(PATH_SRC_TOP) -d $(PATH_BUILD_CLASSES_MAIN_TOP) -bootclasspath $(ANDROID_JAR) $<
+ $(CP) $< $@
-$(PATH_CLASSES_MAIN)/%.class: $(PATH_SRC)/%.java $(SRC_GEN)
+$(PATH_BUILD)/libs/%: $(PATH_DIST)/libs/% | $(PATH_BUILD)
@$(MKDIR) -p $(@D)
- $(JAVAC) $(JAVACFLAGS) -cp $(PATH_SRC_TOP):$(PATH_GEN_TOP) -d $(PATH_BUILD_CLASSES_MAIN_TOP) -bootclasspath $(ANDROID_JAR) $<
+ $(CP) $< $@
-$(PATH_CLASSES_PLUGIN)/%.class: $(PATH_SRC)/%.java
- @$(MKDIR) -p $(@D)
- $(JAVAC) $(JAVACFLAGS) -cp $(PATH_SRC_TOP) -d $(PATH_BUILD_CLASSES_PLUGIN_TOP) -bootclasspath $(ANDROID_JAR) $<
+$(PATH_BUILD_ASSETS): $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(DIST_FILES_SHADERS) $(DIST_BUILD_XML) | $(PATH_BUILD)
+ $(INSTALL) -d $(PATH_BUILD_ASSETS)
+ $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(PATH_BUILD_ASSETS)/
+ $(INSTALL) -d $(PATH_BUILD)/jni
+ $(INSTALL) -c -m 644 $(DIST_ANDROID_MK) $(PATH_BUILD)/jni
+ $(INSTALL) -c -m 644 $(DIST_BUILD_XML) $(PATH_BUILD)
-$(FILE_DEX): $(CLASSES_MAIN) $(CLASSES_GEN)
- $(DX) --dex --output=$@ $(PATH_BUILD_CLASSES_MAIN_TOP)
+$(PATH_BUILD): $(DIST_ANDROID_MK)
+ $(MKDIR) -p $(PATH_BUILD) $(PATH_BUILD)/res
+ $(MKDIR) -p $(PATH_BUILD)/libs
-$(FILE_DEX_PLUGIN): $(CLASSES_PLUGIN)
- @$(MKDIR) -p $(@D)
- $(DX) --dex --output=$@ $(PATH_BUILD_CLASSES_PLUGIN_TOP)
+$(PATH_BUILD_LIBSCUMMVM): libscummvm.so | $(PATH_BUILD)
+ $(INSTALL) -c -m 644 libscummvm.so $(PATH_BUILD)
+ $(STRIP) $(PATH_BUILD)/libscummvm.so
+ cd $(PATH_BUILD); $(NDK_BUILD)
-$(PATH_BUILD)/%/AndroidManifest.xml: $(PATH_DIST)/mkplugin.sh $(srcdir)/configure $(PATH_DIST)/plugin-manifest.xml
- @$(MKDIR) -p $(@D)
- $(PATH_DIST)/mkplugin.sh $(srcdir)/configure $* $(PATH_DIST)/plugin-manifest.xml $(ANDROID_PLUGIN_VERSIONCODE) $@
+$(PATH_BUILD_RES): $(RESOURCES) | $(PATH_BUILD)
-$(PATH_STAGE_PREFIX).%/res/values/strings.xml: $(PATH_DIST)/mkplugin.sh $(srcdir)/configure $(PATH_DIST)/plugin-manifest.xml
- @$(MKDIR) -p $(@D)
- $(PATH_DIST)/mkplugin.sh $(srcdir)/configure $* $(PATH_DIST)/plugin-strings.xml $(ANDROID_PLUGIN_VERSIONCODE) $@
+setupapk: $(FILE_MANIFEST) $(PATH_BUILD_RES) $(PATH_BUILD_ASSETS) $(PATH_BUILD_LIBSCUMMVM) | $(PATH_BUILD)
+ $(SDK_ANDROID) update project -p $(PATH_BUILD) -t android-$(ANDROID_TARGET_VERSION) -n ScummVM
-$(PATH_STAGE_PREFIX).%/res/drawable/scummvm.png: $(PATH_RESOURCES)/drawable/scummvm.png
- @$(MKDIR) -p $(@D)
- $(CP) $< $@
+$(APK_MAIN): setupapk | $(PATH_BUILD)
+ (cd $(PATH_BUILD); ant debug -Dsource.dir="$(realpath $(DIST_JAVA_SRC_DIR))")
+ $(CP) $(PATH_BUILD)/bin/ScummVM-debug.apk $@
-$(FILE_RESOURCES_MAIN): $(FILE_MANIFEST) $(RESOURCES) $(ANDROID_JAR) $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA)
- $(INSTALL) -d $(PATH_BUILD_ASSETS)
- $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(PATH_BUILD_ASSETS)/
- work_dir=`pwd`; \
- for i in $(PATH_BUILD_ASSETS)/*.zip; do \
- echo "recompress $$i"; \
- cd "$$work_dir"; \
- $(RM) -rf $(PATH_BUILD_ASSETS)/tmp; \
- $(MKDIR) $(PATH_BUILD_ASSETS)/tmp; \
- unzip -q $$i -d $(PATH_BUILD_ASSETS)/tmp; \
- cd $(PATH_BUILD_ASSETS)/tmp; \
- zip -r ../`basename $$i` *; \
- done
- @$(RM) -rf $(PATH_BUILD_ASSETS)/tmp
- $(AAPT) package -f -0 zip -M $< -S $(PATH_RESOURCES) -A $(PATH_BUILD_ASSETS) -I $(ANDROID_JAR) -F $@
-
-$(PATH_BUILD)/%/$(FILE_RESOURCES): $(PATH_BUILD)/%/AndroidManifest.xml $(PATH_STAGE_PREFIX).%/res/values/strings.xml $(PATH_STAGE_PREFIX).%/res/drawable/scummvm.png plugins/lib%.so $(ANDROID_JAR)
- $(AAPT) package -f -M $< -S $(PATH_STAGE_PREFIX).$*/res -I $(ANDROID_JAR) -F $@
-
-# Package installer won't delete old libscummvm.so on upgrade so
-# replace it with a zero size file
-$(APK_MAIN): $(EXECUTABLE) $(FILE_RESOURCES_MAIN) $(FILE_DEX)
- $(INSTALL) -d $(PATH_STAGE_MAIN)/common/lib/armeabi
- touch $(PATH_STAGE_MAIN)/common/lib/armeabi/libscummvm.so
- $(INSTALL) -d $(PATH_STAGE_MAIN)/common/mylib/armeabi
- $(INSTALL) -c -m 644 libscummvm.so $(PATH_STAGE_MAIN)/common/mylib/armeabi/
- $(STRIP) $(PATH_STAGE_MAIN)/common/mylib/armeabi/libscummvm.so
- $(APKBUILDER) $@ -z $(FILE_RESOURCES_MAIN) -f $(FILE_DEX) -rf $(PATH_STAGE_MAIN)/common || { $(RM) $@; exit 1; }
-
-scummvm-engine-%.apk: plugins/lib%.so $(PATH_BUILD)/%/$(FILE_RESOURCES) $(FILE_DEX_PLUGIN)
- $(INSTALL) -d $(PATH_STAGE_PREFIX).$*/apk/mylib/armeabi/
- $(INSTALL) -c -m 644 plugins/lib$*.so $(PATH_STAGE_PREFIX).$*/apk/mylib/armeabi/
- $(STRIP) $(PATH_STAGE_PREFIX).$*/apk/mylib/armeabi/lib$*.so
- $(APKBUILDER) $@ -z $(PATH_BUILD)/$*/$(FILE_RESOURCES) -f $(FILE_DEX_PLUGIN) -rf $(PATH_STAGE_PREFIX).$*/apk || { $(RM) $@; exit 1; }
-
-all: $(APK_MAIN) $(APK_PLUGINS)
+$(APK_MAIN_RELEASE): setupapk | $(PATH_BUILD)
+ (cd $(PATH_BUILD); ant release -Dsource.dir="$(realpath $(DIST_JAVA_SRC_DIR))")
+ $(CP) $(PATH_BUILD)/bin/ScummVM-release-unsigned.apk $@
+
+all: $(APK_MAIN)
clean: androidclean
androidclean:
- @$(RM) -rf $(PATH_BUILD) $(PATH_STAGE_PREFIX).* *.apk release
-
-# remove debugging signature
-release/%.apk: %.apk
- @$(MKDIR) -p $(@D)
- @$(RM) $@
- $(CP) $< $@.tmp
- zip -d $@.tmp META-INF/\*
- jarsigner $(JARSIGNER_FLAGS) $@.tmp release
- zipalign 4 $@.tmp $@
- $(RM) $@.tmp
+ @$(RM) -rf $(PATH_BUILD) *.apk release
-androidrelease: $(addprefix release/, $(APK_MAIN) $(APK_PLUGINS))
+androidrelease: $(APK_MAIN_RELEASE)
androidtestmain: $(APK_MAIN)
$(ADB) install -r $(APK_MAIN)
@@ -198,4 +107,4 @@ androiddistdebug: all
sed 's/$$/\r/' < $$i > debug/`basename $$i`.txt; \
done
-.PHONY: androidrelease androidtest
+.PHONY: androidrelease androidtest $(PATH_BUILD_SRC)
diff --git a/dists/android/custom_rules.xml b/dists/android/custom_rules.xml
new file mode 100644
index 0000000000..5ed81b7273
--- /dev/null
+++ b/dists/android/custom_rules.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="custom_rules">
+ <!-- Override the built-in aapt task, don't compress assets. -->
+ <target name="-package-resources" depends="-crunch">
+ <!-- only package resources if *not* a library project -->
+ <do-only-if-not-library elseText="Library project: do not package resources..." >
+ <aapt executable="${aapt}"
+ command="package"
+ versioncode="${version.code}"
+ versionname="${version.name}"
+ debug="${build.is.packaging.debug}"
+ manifest="${out.manifest.abs.file}"
+ assets="${asset.absolute.dir}"
+ androidjar="${project.target.android.jar}"
+ apkfolder="${out.absolute.dir}"
+ nocrunch="${build.packaging.nocrunch}"
+ resourcefilename="${resource.package.file.name}"
+ resourcefilter="${aapt.resource.filter}"
+ libraryResFolderPathRefid="project.library.res.folder.path"
+ libraryPackagesRefid="project.library.packages"
+ libraryRFileRefid="project.library.bin.r.file.path"
+ previousBuildType="${build.last.target}"
+ buildType="${build.target}"
+ ignoreAssets="${aapt.ignore.assets}">
+ <res path="${out.res.absolute.dir}" />
+ <res path="${resource.absolute.dir}" />
+ <nocompress /> <!-- forces no compression on any files in assets or res/raw -->
+ </aapt>
+ </do-only-if-not-library>
+ </target>
+</project>
diff --git a/dists/android/jni/Android.mk b/dists/android/jni/Android.mk
new file mode 100644
index 0000000000..d5b398412f
--- /dev/null
+++ b/dists/android/jni/Android.mk
@@ -0,0 +1,9 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+APP_ABI := armeabi
+LOCAL_MODULE := scummvm
+LOCAL_SRC_FILES := ../libscummvm.so
+
+include $(PREBUILT_SHARED_LIBRARY)
diff --git a/dists/android/project.properties b/dists/android/project.properties
new file mode 100644
index 0000000000..730e911f2f
--- /dev/null
+++ b/dists/android/project.properties
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-14
diff --git a/dists/android/res/layout/main.xml b/dists/android/res/layout/main.xml
index 31aa345cc7..8b0d515d62 100644
--- a/dists/android/res/layout/main.xml
+++ b/dists/android/res/layout/main.xml
@@ -9,8 +9,4 @@
android:keepScreenOn="true"
android:focusable="true"
android:focusableInTouchMode="true"
- android:layout_marginTop="@dimen/verticalMargin"
- android:layout_marginLeft="@dimen/horizontalMargin"
- android:layout_marginBottom="@dimen/verticalMargin"
- android:layout_marginRight="@dimen/horizontalMargin"
/>