aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android
diff options
context:
space:
mode:
authorAngus Lees2010-07-05 01:00:59 +0000
committerAngus Lees2010-07-05 01:00:59 +0000
commitb8778fc7c382ec401409bbaafcb67355f0c566e3 (patch)
treeb451a4f2700dcb83eb729d8096f893d0c064f3ab /backends/platform/android
parentbb300ec671cfcd6fe7461dfd90615acfede2f1b9 (diff)
downloadscummvm-rg350-b8778fc7c382ec401409bbaafcb67355f0c566e3.tar.gz
scummvm-rg350-b8778fc7c382ec401409bbaafcb67355f0c566e3.tar.bz2
scummvm-rg350-b8778fc7c382ec401409bbaafcb67355f0c566e3.zip
Switch Android toolchain prefix from arm-android-eabi to
arm-*-linux-androideabi, since this is what the upcoming gcc-4.6 change uses. Work around Android 2.0 and newer dynamic linker bug by explicitly linking plugins against the core libscummvm.so. Mark Android packages as preferring to be on external storage. Move -lm from LDFLAGS to LIBS. svn-id: r50665
Diffstat (limited to 'backends/platform/android')
-rw-r--r--backends/platform/android/README.build41
-rw-r--r--backends/platform/android/android.mk9
-rw-r--r--backends/platform/android/module.mk22
-rw-r--r--backends/platform/android/video.cpp2
4 files changed, 47 insertions, 27 deletions
diff --git a/backends/platform/android/README.build b/backends/platform/android/README.build
index a834f8431b..0aa5c6eefd 100644
--- a/backends/platform/android/README.build
+++ b/backends/platform/android/README.build
@@ -4,12 +4,18 @@ Building the ScummVM Android port
You will need these things to build:
1. Android EGL headers and library
2. Android SDK
-3. An arm-android-eabi GCC toolchain
+3. An arm-oe-linux-androideabi GCC toolchain(*)
In the example commands, we are going to build against the Android 1.5
native ABI (but using the Android 1.6 SDK tools). Other version
combinations might/should be possible with a bit of tweaking.
+(*) Any other sane Android toolchain should be easy to use, but this
+is the toolchain prefix that is used by default. You can trivially
+find and modify the single location where it appears in ./configure if
+you have some other prefix variation.
+
+
In detail:
1. Android EGL headers and library
@@ -26,17 +32,17 @@ to just download the 3 Android EGL headers from here:
Download and install somewhere.
-3. arm-android-eabi GCC toolchain
+3. arm-*-linux-androideabi GCC toolchain
You have several choices for toolchains:
-- Use Google arm-eabi prebuilt toolchain.
+ - Use Google arm-eabi prebuilt toolchain.
This is shipped with both the Android source release and Android NDK.
The problem is that "arm-eabi-gcc" can't actually link anything
successfully without extra command line flags. To use this with the
ScummVM configure/build environment you will need to create a family
-of shell wrapper scripts that convert "arm-android-eabi-foo" to
+of shell wrapper scripts that convert "arm-oe-linux-androideabi-foo" to
"arm-eabi-foo -mandroid".
For example, I use this script:
@@ -44,17 +50,24 @@ For example, I use this script:
exec arm-eabi-${0##*-} -mandroid -DANDROID "$@"
... and create a family of symlinks/hardlinks pointing to it called
-arm-android-eabi-gcc, arm-android-eabi-g++, etc. For tools that don't
-take a "-mandroid" argument - like arm-eabi-strip - I bypass the shell
-wrapper and just create an arm-android-eabi-strip symlink to the tool
-directly.
+arm-oe-android-linuxeabi-gcc, arm-oe-android-linuxeabi-g++, etc. For
+tools that don't take a "-mandroid" argument - like arm-eabi-strip - I
+bypass the shell wrapper and just create an arm-oe-android-linuxeabi-strip
+symlink to the tool directly.
+
+In practice you will probably need significant linker command line
+massaging in order to get the crtbegin/end and libraries all linked in
+the right way. It's not hard to do manually, but it is annoying to
+script in a general purpose way.
-- Build your own arm-android-eabi toolchain from GCC source.
+ - Build your own arm-*-linux-androideabi toolchain from GCC source.
-This is lots of fun. I suggest my Android openembedded patches, see:
- http://wiki.github.com/anguslees/openembedded-android/
-(You just need to have lots of disk space and type a few commands)
-If you get stuck, ask
+This is lots of fun, but will become significantly easier once gcc-4.6
+is released. In the interim, I suggest using my precompiled Android
+openembedded-based toolchain:
+ wget http://commondatastorage.googleapis.com/anr/sdk/android-2.2-i686-linux-armv5te-linux-androideabi-toolchain-android.tar.bz2
+ sudo tar jxf android-2.2-i686-linux-armv5te-linux-androideabi-toolchain-android.tar.bz2 -C /
+ . /usr/local/android/arm/environment-setup
Alternatively, do a websearch - there are several other cross-compile
toolchains around.
@@ -78,7 +91,7 @@ Then build ScummVM:
export ANDROID_SDK=<root of Android SDK>
PATH=$ANDROID_SDK/platforms/android-1.6/tools:$ANDROID_SDK/tools:$PATH
- # You also want to ensure your arm-android-eabi toolchain is in your $PATH
+ # You also want to ensure your arm-oe-linux-androideabi toolchain is in $PATH
export ANDROID_TOP=<root of built Android source>
diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk
index 0bc8fa265e..95e848e0d9 100644
--- a/backends/platform/android/android.mk
+++ b/backends/platform/android/android.mk
@@ -4,7 +4,6 @@ AAPT = aapt
DX = dx
APKBUILDER = apkbuilder
ADB = adb -e
-ANDROID_JAR = $(ANDROID_SDK)/platforms/android-1.6/android.jar
JAVAC ?= javac
JAVACFLAGS = -source 1.5 -target 1.5
@@ -12,6 +11,14 @@ JAVACFLAGS = -source 1.5 -target 1.5
#LDFLAGS += -Wl,--gc-sections
#CXXFLAGS += -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden
+resources.ap_: $(srcdir)/dists/android/AndroidManifest.xml $(RESOURCES) $(ASSETS) $(ANDROID_JAR8) $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA)
+ $(INSTALL) -d build.tmp/assets/
+ $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) build.tmp/assets/
+ $(AAPT) package -f -M $< -S $(srcdir)/dists/android/res -A build.tmp/assets -I $(ANDROID_JAR8) -F $@
+
+build.tmp/%/resources.ap_: build.tmp/%/AndroidManifest.xml build.stage/%/res/values/strings.xml build.stage/%/res/drawable/scummvm.png $(ANDROID_JAR8)
+ $(AAPT) package -f -M $< -S build.stage/$*/res -I $(ANDROID_JAR8) -F $@
+
scummvm.apk: build.tmp/libscummvm.so resources.ap_ classes.dex
# Package installer won't delete old libscummvm.so on upgrade so
# replace it with a zero size file
diff --git a/backends/platform/android/module.mk b/backends/platform/android/module.mk
index fdb0ed2ac4..c7b98b996d 100644
--- a/backends/platform/android/module.mk
+++ b/backends/platform/android/module.mk
@@ -39,14 +39,22 @@ PLUGIN_RESOURCES = \
#ANDROID_VERSIONCODE = 6 Specified in dists/android/AndroidManifest.xml.in
ANDROID_PLUGIN_VERSIONCODE = 6
+# This is a bit silly. I want to compile against the 1.6 android.jar,
+# to make the compiler check that I don't use something that requires
+# a newer Android. However, in order to use android:installLocation,
+# we need to give aapt a version >=8 android.jar - even though the
+# result will work ok on 1.5+.
+ANDROID_JAR = $(ANDROID_SDK)/platforms/android-1.5/android.jar
+ANDROID_JAR8 = $(ANDROID_SDK)/platforms/android-8/android.jar
+
# This library contains scummvm proper
build.tmp/libscummvm.so: $(OBJS)
@$(MKDIR) -p $(@D)
- $(CXX) $(PLUGIN_LDFLAGS) -shared $(LDFLAGS) -Wl,-soname,$(@F) -Wl,--no-undefined -o $@ $(PRE_OBJS_FLAGS) $(OBJS) $(POST_OBJS_FLAGS) $(LIBS)
+ $(QUIET_LINK)$(CXX) -shared $(LDFLAGS) -Wl,-Bsymbolic -Wl,-soname,$(@F) -Wl,--no-undefined -o $@ $(PRE_OBJS_FLAGS) $(OBJS) $(POST_OBJS_FLAGS) $(LIBS)
-backends/platform/android/org/inodes/gus/scummvm/R.java backends/platform/android/org/inodes/gus/scummvm/Manifest.java: $(srcdir)/dists/android/AndroidManifest.xml $(filter %.xml,$(RESOURCES)) $(ANDROID_JAR)
- $(AAPT) package -m -J backends/platform/android -M $< -S $(srcdir)/dists/android/res -I $(ANDROID_JAR)
+backends/platform/android/org/inodes/gus/scummvm/R.java backends/platform/android/org/inodes/gus/scummvm/Manifest.java: $(srcdir)/dists/android/AndroidManifest.xml $(filter %.xml,$(RESOURCES)) $(ANDROID_JAR8)
+ $(AAPT) package -m -J backends/platform/android -M $< -S $(srcdir)/dists/android/res -I $(ANDROID_JAR8)
build.tmp/classes/%.class: $(srcdir)/backends/platform/android/%.java $(srcdir)/backends/platform/android/org/inodes/gus/scummvm/R.java
@$(MKDIR) -p $(@D)
@@ -63,14 +71,6 @@ build.tmp/plugins/classes.dex: $(JAVA_PLUGIN_SRC:backends/platform/android/%.jav
@$(MKDIR) -p $(@D)
$(DX) --dex --output=$@ build.tmp/classes.plugin
-resources.ap_: $(srcdir)/dists/android/AndroidManifest.xml $(RESOURCES) $(ASSETS) $(ANDROID_JAR) $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA)
- $(INSTALL) -d build.tmp/assets/
- $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) build.tmp/assets/
- $(AAPT) package -f -M $< -S $(srcdir)/dists/android/res -A build.tmp/assets -I $(ANDROID_JAR) -F $@
-
-build.tmp/%/resources.ap_: build.tmp/%/AndroidManifest.xml build.stage/%/res/values/strings.xml build.stage/%/res/drawable/scummvm.png $(ANDROID_JAR)
- $(AAPT) package -f -M $< -S build.stage/$*/res -I $(ANDROID_JAR) -F $@
-
build.tmp/%/AndroidManifest.xml build.stage/%/res/values/strings.xml: dists/android/mkmanifest.pl configure dists/android/AndroidManifest.xml
dists/android/mkmanifest.pl --id=$* --configure=configure \
--version-name=$(VERSION) \
diff --git a/backends/platform/android/video.cpp b/backends/platform/android/video.cpp
index 5d16410cea..d4c002fbd0 100644
--- a/backends/platform/android/video.cpp
+++ b/backends/platform/android/video.cpp
@@ -47,7 +47,7 @@
#define ENTER(args...) /**/
#endif
-#if 1
+#if 0
#define CHECK_GL_ERROR() checkGlError(__FILE__, __LINE__)
static const char* getGlErrStr(GLenum error) {
switch (error) {