Difference between revisions of "Compiling ScummVM/Android"

From ScummVM :: Wiki
Jump to navigation Jump to search
m
(Mention required version of Platform-tools)
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
= Compiling ScummVM for Android =
= Compiling ScummVM for Android =


This page describes how you build Android packages from the ScummVM source tree.
This page describes how you build Android packages from the ScummVM source tree.  For help compiling this on Windows, see the separate article, [[Compiling ScummVM/Android (on Windows)]].


= Mandatory tools =
= Mandatory tools =


* [http://developer.android.com/sdk/index.html Android SDK] r09 as of this writing
* [http://developer.android.com/sdk/index.html Android SDK] r09 as of this writing - note that this requires JDK 6, '''NOT''' JDK 7 (which can cause build failures)
* [http://developer.android.com/sdk/ndk/index.html Android NDK] r5b as of this writing
* [http://developer.android.com/sdk/ndk/index.html Android NDK] r5b as of this writing


Use the SDK Manager to install:
Use the SDK Manager to install:
* Android SDK Tools
* Android SDK Tools
* Android SDK Platform-tools
* Android SDK Platform-tools r06 or later
* SDK Platform Android 1.6, API 4
* SDK Platform Android 4.0, API 14
* SDK Platform Android 2.2, API 8


Set the <tt>ANDROID_SDK</tt> environment variable to the root directory of the SDK, and <tt>ANDROID_NDK</tt> to the root directory of the NDK.
Set the <tt>ANDROID_SDK</tt> environment variable to the root directory of the SDK, and <tt>ANDROID_NDK</tt> to the root directory of the NDK.


= Optional libraries =
= Optional libraries =
* [http://svn.xiph.org/branches/lowmem-branch/Tremor/ Tremor] (lowmem branch) to play ''.ogg'' audio files
* [http://www.underbit.com/products/mad/ MAD] to play ''.mp3'' audio files
* [http://www.underbit.com/products/mad/ MAD] to play ''.mp3'' audio files
* [http://svn.xiph.org/branches/lowmem-branch/Tremor/ Tremor] (lowmem branch) to play ''.ogg'' audio files
* [http://flac.sourceforge.net/ FLAC] to play lossless ''.flac'' files
* [http://flac.sourceforge.net/ FLAC] to play lossless ''.flac'' files


Line 25: Line 24:
== Precompiled binaries ==
== Precompiled binaries ==


Get [http://static.hackmii.com/dhewg/3rd-android-4-armeabi.tar.bz2 this archive] and extract it to e.g. <tt>/opt/android</tt>.
Get [http://sourceforge.net/projects/scummvm/files/build/3rd-android-4.tar.bz2/download this archive] and extract it to e.g. <tt>/opt/android</tt>.


== Build the libraries yourself ==
== Build the libraries yourself ==
Line 42: Line 41:
  export STRIP=${PREFIX}strip
  export STRIP=${PREFIX}strip
  export OBJCOPY=${PREFIX}objcopy
  export OBJCOPY=${PREFIX}objcopy
export CPP=${PREFIX}cpp
   
   
  export MACHDEP="--sysroot=$ANDROID_NDK/platforms/android-4/arch-arm -g -mandroid -mthumb-interwork"
  export MACHDEP="--sysroot=$ANDROID_NDK/platforms/android-4/arch-arm -g -mandroid -mthumb-interwork"
Line 48: Line 48:
   
   
  export CXXFLAGS="${CFLAGS}"
  export CXXFLAGS="${CFLAGS}"
export CPPFLAGS="${CFLAGS}"
   
   
  export LDFLAGS="${MACHDEP}"
  export LDFLAGS="${MACHDEP}"
Line 68: Line 69:


  ./autogen.sh --host=arm --prefix=/opt/android/3rd-android-4-armeabi --enable-low-accuracy --enable-64kHz-limit
  ./autogen.sh --host=arm --prefix=/opt/android/3rd-android-4-armeabi --enable-low-accuracy --enable-64kHz-limit
and finally build & install it:
make
make install
=== MAD ===
Get a tarball of the latest stable version [http://sourceforge.net/projects/mad/files/libmad/ here] (v0.15.1b as of this writing) and extract it.
configure it:
./autogen.sh --host=arm --prefix=/opt/android/3rd-android-4-armeabi --enable-speed --enable-fpm=arm --disable-aso


and finally build & install it:
and finally build & install it:
Line 90: Line 104:
= Compiling =
= Compiling =


The Android port can be compiled with the <tt>configure</tt> script. The most basic way to accomplish this is to run:
The Android port can be compiled with the <tt>configure</tt> script.
 
Set the <tt>ANDROID_SDK</tt> environment variable to the root directory of the SDK, and <tt>ANDROID_NDK</tt> to the root directory of the NDK. Add the directory of the toolchain binaries from the NDK to your <tt>PATH</tt>. This directory differs, on Linux its <tt>$ANDROID_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin</tt>.
 
The most basic way to accomplish this is to run:


  ./configure --host=android --enable-plugins --default-dynamic
  ./configure --host=android --enable-plugins --default-dynamic

Revision as of 06:29, 27 June 2014

Compiling ScummVM for Android

This page describes how you build Android packages from the ScummVM source tree. For help compiling this on Windows, see the separate article, Compiling ScummVM/Android (on Windows).

Mandatory tools

  • Android SDK r09 as of this writing - note that this requires JDK 6, NOT JDK 7 (which can cause build failures)
  • Android NDK r5b as of this writing

Use the SDK Manager to install:

  • Android SDK Tools
  • Android SDK Platform-tools r06 or later
  • SDK Platform Android 4.0, API 14

Set the ANDROID_SDK environment variable to the root directory of the SDK, and ANDROID_NDK to the root directory of the NDK.

Optional libraries

  • Tremor (lowmem branch) to play .ogg audio files
  • MAD to play .mp3 audio files
  • FLAC to play lossless .flac files

Again, you have two options:

Precompiled binaries

Get this archive and extract it to e.g. /opt/android.

Build the libraries yourself

Here's a a simple script to set up a shell for crosscompiling:

#!/bin/sh

PREFIX=${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
export CC=${PREFIX}gcc
export CXX=${PREFIX}g++
export AS=${PREFIX}gcc
export LD=${PREFIX}gcc
export AR=${PREFIX}ar cru
export RANLIB=${PREFIX}ranlib
export STRIP=${PREFIX}strip
export OBJCOPY=${PREFIX}objcopy
export CPP=${PREFIX}cpp

export MACHDEP="--sysroot=$ANDROID_NDK/platforms/android-4/arch-arm -g -mandroid -mthumb-interwork"

export CFLAGS="${MACHDEP} -Os -Wall -mandroid -msoft-float -march=armv5te -mtune=xscale"

export CXXFLAGS="${CFLAGS}"
export CPPFLAGS="${CFLAGS}"

export LDFLAGS="${MACHDEP}"

echo "./configure --host=arm --prefix=/opt/android/3rd-android-4-armeabi"

Save it to a file (like android-4-eabi.sh) and run

. ./android-4-eabi.sh

in your shell. Build systems should now use the correct tools.

Tremor

Get a SVN checkout (r17852. as of this writing):

svn co http://svn.xiph.org/trunk/Tremor

configure it:

./autogen.sh --host=arm --prefix=/opt/android/3rd-android-4-armeabi --enable-low-accuracy --enable-64kHz-limit

and finally build & install it:

make
make install

MAD

Get a tarball of the latest stable version here (v0.15.1b as of this writing) and extract it.

configure it:

./autogen.sh --host=arm --prefix=/opt/android/3rd-android-4-armeabi --enable-speed --enable-fpm=arm --disable-aso

and finally build & install it:

make
make install

FLAC

Get a tarball of the latest stable version here (v1.2.1 as of this writing) and extract it.

configure it:

./configure --prefix=/opt/android/3rd-android-4-armeabi --disable-largefile --disable-thorough-tests --disable-doxygen-docs --disable-xmms-plugin --disable-cpplibs --disable-ogg --disable-oggtest --disable-rpath

and build & install the required parts:

make -C src/libFLAC
make -C src/libFLAC install
make -C include install

Compiling

The Android port can be compiled with the configure script.

Set the ANDROID_SDK environment variable to the root directory of the SDK, and ANDROID_NDK to the root directory of the NDK. Add the directory of the toolchain binaries from the NDK to your PATH. This directory differs, on Linux its $ANDROID_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin.

The most basic way to accomplish this is to run:

./configure --host=android --enable-plugins --default-dynamic
make

The script supports various arguments, which you can use to en- or disable features, see ./configure --help.

If you want support for additional libraries, you need cross-compiled binaries. If you followed the above description and have those libraries in /opt/android/3rd-android-4-armeabi, the configure command line would look like this:

./configure --host=android  --enable-plugins --default-dynamic --with-tremor-prefix=/opt/android/3rd-android-4-armeabi --with-mad-prefix=/opt/android/3rd-android-4-armeabi --with-flac-prefix=/opt/android/3rd-android-4-armeabi