summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJames Cowgill <james410@cowgill.org.uk>2014-12-09 20:21:40 +0000
committerJames Cowgill <james410@cowgill.org.uk>2014-12-09 20:21:40 +0000
commitfa21c65d0c764705cfc377bf0d0de08fac26874e (patch)
treedbc9e87bbd8684d15e79fc0c8b7a8985389c3b35 /tools
parentdd835931261c340acd5f0409341d13fa2670423e (diff)
Imported Upstream version 2.2.0+dfsg
Diffstat (limited to 'tools')
-rwxr-xr-xtools/android/clean_all.sh6
-rwxr-xr-xtools/android/compile_arm-v7a.sh12
-rwxr-xr-xtools/android/compile_arm.sh12
-rwxr-xr-xtools/android/compile_libs.sh63
-rwxr-xr-xtools/android/compile_mips.sh12
-rwxr-xr-xtools/android/compile_x86.sh12
-rwxr-xr-xtools/android/create_toolchains.sh46
-rwxr-xr-xtools/android/download_sources.sh64
-rwxr-xr-xtools/android/make_all.sh38
-rw-r--r--tools/android/patches/remove-so-version-suffix.diff13
-rw-r--r--tools/android/readme.txt27
11 files changed, 305 insertions, 0 deletions
diff --git a/tools/android/clean_all.sh b/tools/android/clean_all.sh
new file mode 100755
index 0000000..c144387
--- /dev/null
+++ b/tools/android/clean_all.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+rm -rf tmp
+rm -rf build
+rm -rf src
+rm -rf toolchains
diff --git a/tools/android/compile_arm-v7a.sh b/tools/android/compile_arm-v7a.sh
new file mode 100755
index 0000000..b7b883f
--- /dev/null
+++ b/tools/android/compile_arm-v7a.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+DESTDIR=$PWD/tmp/arm-v7a
+
+PATH=$PWD/toolchains/arm/bin:$PATH
+CC=arm-linux-androideabi-gcc
+CXX=arm-linux-androideabi-g++
+CFLAGS="-I$DESTDIR/usr/include -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16"
+CPPFLAGS="-I$DESTDIR/usr/include -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16"
+LDFLAGS="-L$DESTDIR/usr/lib -march=armv7-a -Wl,--fix-cortex-a8"
+
+./compile_libs.sh arm-v7a $PATH $CC $CXX "$CFLAGS" "$CPPFLAGS" "$LDFLAGS"
diff --git a/tools/android/compile_arm.sh b/tools/android/compile_arm.sh
new file mode 100755
index 0000000..ee30109
--- /dev/null
+++ b/tools/android/compile_arm.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+DESTDIR=$PWD/tmp/arm
+
+PATH=$PWD/toolchains/arm/bin:$PATH
+CC=arm-linux-androideabi-gcc
+CXX=arm-linux-androideabi-g++
+CFLAGS=-I$DESTDIR/usr/include
+CPPFLAGS=-I$DESTDIR/usr/include
+LDFLAGS=-L$DESTDIR/usr/lib
+
+./compile_libs.sh arm $PATH $CC $CXX $CFLAGS $CPPFLAGS $LDFLAGS
diff --git a/tools/android/compile_libs.sh b/tools/android/compile_libs.sh
new file mode 100755
index 0000000..dbd3914
--- /dev/null
+++ b/tools/android/compile_libs.sh
@@ -0,0 +1,63 @@
+#!/usr/bin/env bash
+
+DESTDIR=$PWD/tmp
+LOCALDIR=$PWD
+
+OPATH=$PATH
+
+export PATH=$2
+export CC=$3
+export CXX=$4
+export CFLAGS=$5
+export CPPFLAGS=$6
+export LDFLAGS=$7
+
+if [ "$1" = "arm" ]
+then
+ ARCH=arm-linux
+ ANDROID_ABI=armeabi
+
+elif [ "$1" = "arm-v7a" ]
+then
+ ARCH=arm-linux
+ ANDROID_ABI=armeabi-v7a
+
+elif [ "$1" = "x86" ]
+then
+ ARCH=i686-linux
+ ANDROID_ABI=x86
+
+elif [ "$1" = "mips" ]
+then
+ ARCH=mips-linux
+ ANDROID_ABI=mips
+fi
+
+HOST="--host=$ARCH"
+PREFIX="--prefix=$DESTDIR/$1/usr need_version=no"
+
+# Compile OGG
+cd $LOCALDIR/build/libogg-* && sed -i 's/-version-info/-avoid-version/g' src/Makefile.in src/Makefile.am && ./configure $HOST $PREFIX --enable-shared=no && make && make install
+rm $DESTDIR/$1/usr/lib/libogg*.so*
+
+# Compile FLAC
+cd $LOCALDIR/build/flac-* && sed -i 's/-version-info/-avoid-version/g' src/libFLAC/Makefile.in src/libFLAC/Makefile.am && ./configure $HOST $PREFIX --enable-shared=no && make && make install
+rm $DESTDIR/$1/usr/lib/libFLAC*.so*
+
+# Compile VORBIS
+cd $LOCALDIR/build/libvorbis-* && sed -i 's/-version-info/-avoid-version/g' lib/Makefile.in lib/Makefile.am && ./configure $HOST $PREFIX --enable-shared=no && make && make install
+rm $DESTDIR/$1/usr/lib/libvorbis*.so*
+
+# Compile libsndfile (important: --disable-sqlite)
+cd $LOCALDIR/build/libsndfile-* && sed -i 's/-version-info/-avoid-version/g' src/Makefile.in src/Makefile.am && ./configure $HOST $PREFIX --disable-sqlite && make && make install
+
+# Compile JPEG
+cd $LOCALDIR/build/jpeg-* && sed -i 's/-version-info/-avoid-version/g' Makefile.in Makefile.am && ./configure $HOST $PREFIX && make && make install
+
+# Compile freetype
+cd $LOCALDIR/build/freetype-* && sed -i 's/-version-info/-avoid-version/g' builds/unix/unix-cc.in && ./configure $HOST $PREFIX && make && make install
+
+# Compile OpenAL-Soft
+cd $LOCALDIR/build/openal-soft-android-master && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_CMAKE_TOOLCHAIN -DANDROID_ABI=$ANDROID_ABI -DANDROID_NATIVE_API_LEVEL=android-9 -DANDROID_USE_STLPORT=1 .. && make openal && mv libopenal.so $DESTDIR/$1/usr/lib
+
+export PATH=$OPATH
diff --git a/tools/android/compile_mips.sh b/tools/android/compile_mips.sh
new file mode 100755
index 0000000..96985b9
--- /dev/null
+++ b/tools/android/compile_mips.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+DESTDIR=$PWD/tmp/mips
+
+PATH=$PWD/toolchains/mips/bin:$PATH
+CC=mipsel-linux-android-gcc
+CXX=mipsel-linux-android-g++
+CFLAGS=-I$DESTDIR/usr/include
+CPPFLAGS=-I$DESTDIR/usr/include
+LDFLAGS=-L$DESTDIR/usr/lib
+
+./compile_libs.sh mips $PATH $CC $CXX $CFLAGS $CPPFLAGS $LDFLAGS
diff --git a/tools/android/compile_x86.sh b/tools/android/compile_x86.sh
new file mode 100755
index 0000000..20f9fbb
--- /dev/null
+++ b/tools/android/compile_x86.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+DESTDIR=$PWD/tmp/x86
+
+PATH=$PWD/toolchains/x86/bin:$PATH
+CC=i686-linux-android-gcc
+CXX=i686-linux-android-g++
+CFLAGS=-I$DESTDIR/usr/include
+CPPFLAGS=-I$DESTDIR/usr/include
+LDFLAGS=-L$DESTDIR/usr/lib
+
+./compile_libs.sh x86 $PATH $CC $CXX $CFLAGS $CPPFLAGS $LDFLAGS
diff --git a/tools/android/create_toolchains.sh b/tools/android/create_toolchains.sh
new file mode 100755
index 0000000..dc6ed4e
--- /dev/null
+++ b/tools/android/create_toolchains.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+
+create_toolchain () {
+
+ # abort if already created
+ if [ -d "$PWD/toolchains/$2" ]
+ then
+ return
+ fi
+
+ # save the working directory and move to the NDK directory
+ WORKING_DIRECTORY=$PWD
+ cd $NDK
+
+ # prepare the command according to chosen options
+ PLATFORM=--platform=android-$1
+ DIR=--install-dir=$WORKING_DIRECTORY/toolchains/$2
+ MAKE=$NDK/build/tools/make-standalone-toolchain.sh
+
+ if [ "$2" = "arm" ]
+ then
+ TOOLCHAIN=--toolchain=arm-linux-androideabi-4.8
+ elif [ "$2" = "x86" ]
+ then
+ TOOLCHAIN=--toolchain=x86-4.8
+ elif [ "$2" = "mips" ]
+ then
+ TOOLCHAIN=--toolchain=mipsel-linux-android-4.8
+ else
+ echo "Abort."
+ exit 1
+ fi
+
+ # create the standalone toolchain
+ $MAKE $PLATFORM $TOOLCHAIN $DIR --stl=libc++
+
+ # go back to our working directory
+ cd $WORKING_DIRECTORY
+
+ # move linux/soundcard.h to sys/soundcard.h
+ mv $PWD/toolchains/$2/sysroot/usr/include/linux/soundcard.h $PWD/toolchains/$2/sysroot/usr/include/sys
+}
+
+create_toolchain 9 arm
+create_toolchain 9 x86
+create_toolchain 9 mips
diff --git a/tools/android/download_sources.sh b/tools/android/download_sources.sh
new file mode 100755
index 0000000..2fc56a3
--- /dev/null
+++ b/tools/android/download_sources.sh
@@ -0,0 +1,64 @@
+#!/usr/bin/env bash
+
+FLAC_VERSION=1.2.1
+VORBIS_VERSION=1.3.3
+OGG_VERSION=1.3.1
+
+FLAC=flac-$FLAC_VERSION
+VORBIS=libvorbis-$VORBIS_VERSION
+OGG=libogg-$OGG_VERSION
+
+SNDFILE_VERSION=1.0.25
+SNDFILE=libsndfile-$SNDFILE_VERSION
+
+JPEG_VERSION=9
+JPEG=jpeg-$JPEG_VERSION
+
+FREETYPE_VERSION=2.4.0
+FREETYPE=freetype-$FREETYPE_VERSION
+
+mkdir build
+
+wget -nc -P src http://downloads.xiph.org/releases/flac/$FLAC.tar.gz
+if [ ! -d "$PWD/tmp/$FLAC" ]
+then
+ tar -C build -xf src/$FLAC.tar.gz
+fi
+
+wget -nc -P src http://downloads.xiph.org/releases/vorbis/$VORBIS.tar.gz
+if [ ! -d "$PWD/tmp/$VORBIS" ]
+then
+ tar -C build -xf src/$VORBIS.tar.gz
+fi
+
+wget -nc -P src http://downloads.xiph.org/releases/ogg/$OGG.tar.gz
+if [ ! -d "$PWD/tmp/$OGG" ]
+then
+ tar -C build -xf src/$OGG.tar.gz
+fi
+
+wget -nc -P src http://www.mega-nerd.com/libsndfile/files/$SNDFILE.tar.gz
+if [ ! -d "$PWD/tmp/$SNDFILE" ]
+then
+ tar -C build -xf src/$SNDFILE.tar.gz
+fi
+
+wget -nc -P src http://www.ijg.org/files/jpegsrc.v$JPEG_VERSION.tar.gz
+if [ ! -d "$PWD/tmp/$JPEG" ]
+then
+ tar -C build -xf src/jpegsrc.v$JPEG_VERSION.tar.gz
+fi
+
+wget -nc -P src http://download.savannah.gnu.org/releases/freetype/$FREETYPE.tar.gz
+if [ ! -d "$PWD/tmp/$FREETYPE" ]
+then
+ tar -C build -xf src/$FREETYPE.tar.gz
+fi
+
+wget -nc -P src https://github.com/AerialX/openal-soft-android/archive/master.tar.gz
+if [ ! -d "$PWD/tmp/openal-soft-android-master" ]
+then
+ tar -C build -xf src/master.tar.gz
+fi
+
+patch build/openal-soft-android-master/CMakeLists.txt patches/remove-so-version-suffix.diff
diff --git a/tools/android/make_all.sh b/tools/android/make_all.sh
new file mode 100755
index 0000000..2281aa2
--- /dev/null
+++ b/tools/android/make_all.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+
+# Abort if no known installation of NDK
+if [ "$NDK" == "" ]
+then
+ echo "Where is the NDK location ?"
+ echo -n "NDK: "; read NDK
+ export NDK=$NDK
+fi
+
+export ANDROID_NDK=$NDK
+
+# Abort if we don't know the Android CMake toolchain location
+if [ "$ANDROID_CMAKE_TOOLCHAIN" == "" ]
+then
+ echo "Where is the Android CMake toolchain ?"
+ echo -n "ANDROID_CMAKE_TOOLCHAIN: "; read ANDROID_CMAKE_TOOLCHAIN
+ export ANDROID_CMAKE_TOOLCHAIN=$ANDROID_CMAKE_TOOLCHAIN
+fi
+
+./clean_all.sh
+
+./create_toolchains.sh
+
+./download_sources.sh
+./compile_arm.sh
+
+rm -r $PWD/build
+./download_sources.sh
+./compile_x86.sh
+
+rm -r $PWD/build
+./download_sources.sh
+./compile_mips.sh
+
+rm -r $PWD/build
+./download_sources.sh
+./compile_arm-v7a.sh
diff --git a/tools/android/patches/remove-so-version-suffix.diff b/tools/android/patches/remove-so-version-suffix.diff
new file mode 100644
index 0000000..257d553
--- /dev/null
+++ b/tools/android/patches/remove-so-version-suffix.diff
@@ -0,0 +1,13 @@
+--- CMakeLists.txt.orig 2013-09-21 15:23:49.305453804 +0200
++++ CMakeLists.txt 2013-09-21 15:24:08.621454210 +0200
+@@ -717,9 +717,7 @@
+ # Build a library
+ ADD_LIBRARY(${LIBNAME} ${LIBTYPE} ${OPENAL_OBJS} ${ALC_OBJS})
+ SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES DEFINE_SYMBOL AL_BUILD_LIBRARY
+- COMPILE_FLAGS -DAL_ALEXT_PROTOTYPES
+- VERSION ${LIB_VERSION}.0
+- SOVERSION ${LIB_MAJOR_VERSION})
++ COMPILE_FLAGS -DAL_ALEXT_PROTOTYPES)
+ IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC")
+ SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "")
+ ENDIF()
diff --git a/tools/android/readme.txt b/tools/android/readme.txt
new file mode 100644
index 0000000..23949d1
--- /dev/null
+++ b/tools/android/readme.txt
@@ -0,0 +1,27 @@
+Compiling external libraries for Android can be a tedious task, especially for
+those who aren't familiar with the NDK, that's why we provide these scripts.
+
+IMPORTANT: Please, be careful when using these scripts! They are unpolished at
+the moment and you'll have to respect a simple rule: call these scripts from
+where they are. So, in that case, head yourself to tools/android, then call
+./make_all.sh.
+
+Feel free to improve them or send patches.
+
+HOW-TO-USE:
+-----------
+1) Some of these scripts need an environement variable to work ($NDK) as well
+as the Android CMake toolchain you'll find in cmake/toolchains (android.toolchain.cmake)
+export NDK=/path/to/your/ndk
+export ANDROID_CMAKE_TOOLCHAIN=/path/to/android.toolchain.cmake
+
+2) You'll need to make them executable, so:
+chmod +x *.sh
+
+3) Type: ./make_all.sh which should create standalone toolchains, download the
+external libraries and compile them.
+
+These scripts will be improved over time. Meanwhile, you'll have to play with
+them if you want a customized behavior.
+
+Good luck!