[Scummvm-cvs-logs] SF.net SVN: scummvm:[50665] scummvm/trunk

anguslees at users.sourceforge.net anguslees at users.sourceforge.net
Mon Jul 5 03:00:59 CEST 2010


Revision: 50665
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50665&view=rev
Author:   anguslees
Date:     2010-07-05 01:00:59 +0000 (Mon, 05 Jul 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    scummvm/trunk/backends/platform/android/README.build
    scummvm/trunk/backends/platform/android/android.mk
    scummvm/trunk/backends/platform/android/module.mk
    scummvm/trunk/backends/platform/android/video.cpp
    scummvm/trunk/configure
    scummvm/trunk/dists/android/AndroidManifest.xml
    scummvm/trunk/dists/android/AndroidManifest.xml.in
    scummvm/trunk/dists/android/mkmanifest.pl

Modified: scummvm/trunk/backends/platform/android/README.build
===================================================================
--- scummvm/trunk/backends/platform/android/README.build	2010-07-05 00:09:41 UTC (rev 50664)
+++ scummvm/trunk/backends/platform/android/README.build	2010-07-05 01:00:59 UTC (rev 50665)
@@ -4,12 +4,18 @@
 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 @@
 
 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,18 +50,25 @@
  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.
 
-- Build your own arm-android-eabi toolchain from GCC source.
+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.
 
-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 
+ - Build your own arm-*-linux-androideabi toolchain from GCC source.
 
+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 @@
  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>
 

Modified: scummvm/trunk/backends/platform/android/android.mk
===================================================================
--- scummvm/trunk/backends/platform/android/android.mk	2010-07-05 00:09:41 UTC (rev 50664)
+++ scummvm/trunk/backends/platform/android/android.mk	2010-07-05 01:00:59 UTC (rev 50665)
@@ -4,7 +4,6 @@
 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 @@
 #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

Modified: scummvm/trunk/backends/platform/android/module.mk
===================================================================
--- scummvm/trunk/backends/platform/android/module.mk	2010-07-05 00:09:41 UTC (rev 50664)
+++ scummvm/trunk/backends/platform/android/module.mk	2010-07-05 01:00:59 UTC (rev 50665)
@@ -39,14 +39,22 @@
 #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 @@
 	@$(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) \

Modified: scummvm/trunk/backends/platform/android/video.cpp
===================================================================
--- scummvm/trunk/backends/platform/android/video.cpp	2010-07-05 00:09:41 UTC (rev 50664)
+++ scummvm/trunk/backends/platform/android/video.cpp	2010-07-05 01:00:59 UTC (rev 50665)
@@ -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) {

Modified: scummvm/trunk/configure
===================================================================
--- scummvm/trunk/configure	2010-07-05 00:09:41 UTC (rev 50664)
+++ scummvm/trunk/configure	2010-07-05 01:00:59 UTC (rev 50665)
@@ -1007,7 +1007,7 @@
 android)
 	_host_os=android
 	_host_cpu=arm
-	_host_alias=arm-android-eabi
+	_host_alias=arm-oe-linux-androideabi
 	;;
 *)
 	if test -n "$_host"; then
@@ -1687,7 +1687,6 @@
 			add_line_to_config_mk 'USE_ARM_COSTUME_ASM = 1'
 			_backend="android"
 			_port_mk="backends/platform/android/android.mk"
-			_build_hq_scalers="no"
 			;;
 		*)
 			echo "WARNING: Unknown target, continuing with auto-detected values"
@@ -1990,7 +1989,7 @@
 cat > $TMPC << EOF
 int main(void) { return 0; }
 EOF
-cc_check -lm && LDFLAGS="$LDFLAGS -lm"
+cc_check -lm && LIBS="$LIBS -lm"
 
 #
 # Check for Ogg Vorbis
@@ -2494,12 +2493,36 @@
 		LIBS="$LIBS -static -lSDL"
 		;;
 	android)
+		static_libs=''
+		system_libs=''
+		for lib in $LIBS; do
+			case $lib in
+			-lz|-lm)
+				system_libs="$system_libs $lib"
+				;;
+			*)
+				static_libs="$static_libs $lib"
+				;;
+			esac
+		done
+
 		# -lgcc is carefully placed here - we want to catch
 		# all toolchain symbols in *our* libraries rather
 		# than pick up anything unhygenic from the Android libs.
-		LIBS="$LIBS -lgcc -lstdc++ -llog -lGLESv1_CM -lEGL"
+		LIBS="-Wl,-Bstatic $static_libs -Wl,-Bdynamic -lgcc $system_libs -lstdc++ -llog -lGLESv1_CM -lEGL"
 		DEFINES="$DEFINES -D__ANDROID__ -DANDROID_BACKEND -DREDUCE_MEMORY_USAGE"
 		add_line_to_config_mk 'PLUGIN_LDFLAGS += $(LDFLAGS) -Wl,-shared,-Bsymbolic'
+
+		# Work around an Android 2.0+ run-time linker bug:
+		# The linker doesn't actually look in previously
+		# loaded libraries when trying to resolve symbols -
+		# effectively turning all dlopen(RTLD_GLOBAL) calls
+		# into dlopen(RTLD_LOCAL).  It *does* look in
+		# DT_NEEDED libraries, so the workaround is to add an
+		# (otherwise unnecessary) dependency from plugins back
+		# to the main libscummvm.so.
+		add_line_to_config_mk 'PLUGIN_LDFLAGS += -Lbuild.tmp -lscummvm'
+		add_line_to_config_mk 'PLUGIN_EXTRA_DEPS += build.tmp/libscummvm.so'
 		;;
 	*)
 		echo "support for $_backend backend not implemented in configure script yet"

Modified: scummvm/trunk/dists/android/AndroidManifest.xml
===================================================================
--- scummvm/trunk/dists/android/AndroidManifest.xml	2010-07-05 00:09:41 UTC (rev 50664)
+++ scummvm/trunk/dists/android/AndroidManifest.xml	2010-07-05 01:00:59 UTC (rev 50665)
@@ -2,16 +2,14 @@
 <!-- NB: android:versionCode needs to be bumped for formal releases -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="org.inodes.gus.scummvm"
-      android:versionCode="6" android:versionName="1.2.0svn">
+      android:versionCode="6" android:versionName="1.2.0svn"
+      android:installLocation="preferExternal">
 
   <!-- This version is built against a cupcake (and newer?) ABI.
-       It works on Android 1.5 (SDK 3) and Android 1.6 (SDK 4).
-       Native libraries changed around in Android 2.0 (SDK 5) so we
-       don't work on that yet.
+       It works on Android 1.5 (SDK 3) and newer.
     -->
   <uses-sdk android:minSdkVersion="3"
-	    android:maxSdkVersion="4"
-	    android:targetSdkVersion="4" />
+	    android:targetSdkVersion="8" />
 
   <application android:name=".ScummVMApplication"
     android:label="@string/app_name"

Modified: scummvm/trunk/dists/android/AndroidManifest.xml.in
===================================================================
--- scummvm/trunk/dists/android/AndroidManifest.xml.in	2010-07-05 00:09:41 UTC (rev 50664)
+++ scummvm/trunk/dists/android/AndroidManifest.xml.in	2010-07-05 01:00:59 UTC (rev 50665)
@@ -2,16 +2,14 @@
 <!-- NB: android:versionCode needs to be bumped for formal releases -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="org.inodes.gus.scummvm"
-      android:versionCode="6" android:versionName="@VERSION@">
+      android:versionCode="6" android:versionName="@VERSION@"
+      android:installLocation="preferExternal">
 
-  <!-- This version is built against a cupcake (and newer?) ABI.
-       It works on Android 1.5 (SDK 3) and Android 1.6 (SDK 4).
-       Native libraries changed around in Android 2.0 (SDK 5) so we
-       don't work on that yet.
+  <!-- This version works on Android 1.5 (SDK 3) and newer, but we
+       want Android 2.2 (SDK 8) defaults and features.
     -->
   <uses-sdk android:minSdkVersion="3"
-	    android:maxSdkVersion="4"
-	    android:targetSdkVersion="4" />
+	    android:targetSdkVersion="8" />
 
   <application android:name=".ScummVMApplication"
     android:label="@string/app_name"

Modified: scummvm/trunk/dists/android/mkmanifest.pl
===================================================================
--- scummvm/trunk/dists/android/mkmanifest.pl	2010-07-05 00:09:41 UTC (rev 50664)
+++ scummvm/trunk/dists/android/mkmanifest.pl	2010-07-05 01:00:59 UTC (rev 50665)
@@ -105,6 +105,7 @@
 	'package' => "org.inodes.gus.scummvm.plugin.$info->{name}",
 	[ANDROID, 'versionCode'] => $package_versionCode,
 	[ANDROID, 'versionName'] => $package_versionName,
+	[ANDROID, 'installLocation'] => 'preferExternal',
 	);
 
     $writer->startTag(


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list