Commits

Ivan Vučica committed 391beae

Initial commit. Working up to installation of gnustep-make.

  • Participants

Comments (0)

Files changed (1)

File android-gnustep.sh

+# wget http://dl.google.com/android/adt/adt-bundle-linux-x86-20130219.zip
+# apt-get install unzip
+
+export ANDROID_GNUSTEP_INSTALL_ROOT=`pwd`
+
+# we need build-essential for Make
+sudo apt-get install build-essential
+
+# add-apt-repository is in python-software-properties
+sudo apt-get install python-software-properties
+
+# android needs sun java
+if false ; then
+	sudo add-apt-repository "deb http://archive.canonical.com/ precise partner"
+	sudo apt-get update
+	sudo apt-get install sun-java6-jdk
+else
+	sudo add-apt-repository ppa:webupd8team/java
+	sudo apt-get update
+	sudo apt-get install oracle-java6-installer
+fi
+
+# gnustep needs svn
+sudo apt-get install subversion
+
+# libobjc2 needs cmake
+sudo apt-get install cmake
+
+# fetch android tools
+cd "${ANDROID_GNUSTEP_INSTALL_ROOT}"
+echo " ==> FETCHING ANDROID TOOLS"
+wget http://dl.google.com/android/android-sdk_r21.1-linux.tgz
+echo " ==> UNPACKING ANDROID TOOLS"
+tar xfz android-sdk_r21.1-linux.tgz
+
+# fetch android sdk
+echo " ==> FETCHING ANDROID SDK"
+cd "${ANDROID_GNUSTEP_INSTALL_ROOT}"
+cd android-sdk-linux/tools
+if false ; then
+	# fetch everything
+	./android update sdk -u
+else
+	# try to fetch just newest platform sdk
+	export NEWEST_API=$(./android list sdk -a | grep "SDK Platform Android" | head -n 1 | sed 's/.*API \(.\+\),.*/\1/')
+	./android update sdk -u --filter platform-tools,android-${NEWEST_API}
+fi
+
+# fetch android ndk
+cd "${ANDROID_GNUSTEP_INSTALL_ROOT}"
+echo " ==> FETCHING ANDROID NDK"
+wget http://dl.google.com/android/ndk/android-ndk-r8d-linux-x86.tar.bz2
+tar xfj android-ndk-r8d-linux-x86.tar.bz2
+export ANDROID_NDK="${ANDROID_GNUSTEP_INSTALL_ROOT}/android-ndk-r8d"
+export ANDROID_NDK_LLVM="${ANDROID_GNUSTEP_INSTALL_ROOT}/android-ndk-r8d/toolchains/llvm-3.1/prebuilt/linux-x86/bin/"
+
+# bootstrap a standalone toolchain
+cd "${ANDROID_GNUSTEP_INSTALL_ROOT}"
+rm -rf /tmp/my-android-toolchain
+${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh --platform=android-5 --install-dir=/tmp/my-android-toolchain --toolchain=arm-linux-androideabi-clang3.1
+export PATH=/tmp/my-android-toolchain/bin:$PATH
+
+# fetch gnustep and libobjc2
+cd "${ANDROID_GNUSTEP_INSTALL_ROOT}"
+if false ; then
+	# fetch all
+	echo " ==> FETCHING GNUSTEP"
+	svn co http://svn.gna.org/svn/gnustep/modules gnustep
+else
+	# fetch just gnustep-make, gnustep-base and libobjc2
+	mkdir -p gnustep/core
+	mkdir -p gnustep/dev-libs
+	cd gnustep/core
+	echo " ==> FETCHING GNUSTEP MAKE & BASE"
+	svn co http://svn.gna.org/svn/gnustep/tools/make/trunk/ make
+	svn co http://svn.gna.org/svn/gnustep/libs/base/trunk/ base
+	cd ../..
+	cd gnustep/dev-libs
+	echo " ==> FETCHING LIBOBJC2"
+	svn co http://svn.gna.org/svn/gnustep/libs/libobjc2/trunk libobjc2
+	cd ../../
+fi
+
+# fetch android-cmake toolchain file
+cd "${ANDROID_GNUSTEP_INSTALL_ROOT}"
+if false ; then
+	# not used; no clang support
+	wget http://android-cmake.googlecode.com/hg/toolchain/android.toolchain.cmake
+else
+	# source: http://root.cern.ch/svn/root/trunk/interpreter/llvm/src/cmake/platforms/Android.cmake
+	# modified to replace CMAKE_C_COMPILER's reference to CMAKE_BINARY_DIR with LLVM_ANDROID_TOOLCHAIN_DIR
+	# also, changed sysroot
+	cat > android.toolchain.cmake << _EOF
+	# Toolchain config for Android NDK.
+	# This is expected to be used with a standalone Android toolchain (see
+	# docs/STANDALONE-TOOLCHAIN.html in the NDK on how to get one).
+	#
+	# Usage:
+	# mkdir build; cd build
+	# cmake ..; make
+	# mkdir android; cd android
+	# cmake -DLLVM_ANDROID_TOOLCHAIN_DIR=/path/to/android/ndk \
+	#   -DCMAKE_TOOLCHAIN_FILE=../../cmake/platforms/Android.cmake ../..
+	# make <target>
+
+	SET(CMAKE_SYSTEM_NAME Linux)
+	SET(CMAKE_C_COMPILER \${LLVM_ANDROID_TOOLCHAIN_DIR}/bin/clang)
+	SET(CMAKE_CXX_COMPILER \${LLVM_ANDROID_TOOLCHAIN_DIR}/bin/clang++)
+	SET(ANDROID "1" CACHE STRING "ANDROID" FORCE)
+
+	SET(ANDROID_COMMON_FLAGS "-target arm-linux-androideabi -B\${LLVM_ANDROID_TOOLCHAIN_DIR}") # -mllvm -arm-enable-ehabi")
+	SET(CMAKE_C_FLAGS "\${ANDROID_COMMON_FLAGS}" CACHE STRING "toolchain_cflags" FORCE)
+	SET(CMAKE_CXX_FLAGS "\${ANDROID_COMMON_FLAGS}" CACHE STRING "toolchain_cxxflags" FORCE)
+	SET(CMAKE_LINK_FLAGS "\${ANDROID_COMMON_FLAGS}" CACHE STRING "toolchain_linkflags" FORCE)
+_EOF
+fi
+
+
+
+# build libobjc2
+cd "${ANDROID_GNUSTEP_INSTALL_ROOT}"
+cd gnustep/dev-libs/libobjc2
+
+rm -rf build
+mkdir -p build && cd build
+#cmake -DCMAKE_TOOLCHAIN_FILE="${ANDROID_GNUSTEP_INSTALL_ROOT}/android.toolchain.cmake" -DCOMPILER_FAMILY=clang -DCOMPILER_FAMILY_PP=clang++ ..
+cmake -DCMAKE_TOOLCHAIN_FILE="${ANDROID_GNUSTEP_INSTALL_ROOT}/android.toolchain.cmake" -DLLVM_ANDROID_TOOLCHAIN_DIR="/tmp/my-android-toolchain/" -DTESTS=FALSE ..
+make -j8 objc objcxx
+make install
+
+# update gnustep-make's config.sub to recognize androideabi
+cd "${ANDROID_GNUSTEP_INSTALL_ROOT}"
+cd gnustep/core/make
+
+rm config.sub
+wget "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" -O config.sub
+
+# build gnustep-make
+cd "${ANDROID_GNUSTEP_INSTALL_ROOT}"
+cd gnustep/core/make
+
+./configure --host=arm-linux-androideabi
+make
+make install
+
+
+# 'source' GNUstep.sh
+. /usr/local/share/GNUstep/Makefiles/GNUstep.sh
+
+# build gnustep-base
+cd "${ANDROID_GNUSTEP_INSTALL_ROOT}"
+cd gnustep/core/base
+
+./configure --host=arm-linux-androideabi --enable-nxconstantstring --disable-invocations --disable-iconv --disable-tls --disable-icu
+make
+make install