aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.md41
-rw-r--r--cmake/glibc-compat-symbols.h33
-rw-r--r--cmake/toolchain.android.cmake170
-rw-r--r--cmake/toolchain.clang-default.cmake13
-rw-r--r--cmake/toolchain.clang-x86_32.cmake17
-rw-r--r--cmake/toolchain.gcc-armv6.cmake13
-rw-r--r--cmake/toolchain.gcc-armv6hf.cmake13
-rw-r--r--cmake/toolchain.gcc-default.cmake13
-rw-r--r--cmake/toolchain.gcc-x86_32.cmake17
-rw-r--r--cmake/toolchain.windows.cmake30
l---------scripts/arm-linux-gnueabi1
l---------scripts/arm-linux-gnueabihf1
-rwxr-xr-xscripts/make.gcc-armv6-cross.sh13
-rwxr-xr-xscripts/make.gcc-armv6hf-cross.sh11
l---------scripts/sys-arm-linux-gnueabi/bin/gcc1
l---------scripts/sys-arm-linux-gnueabi/bin/ld1
l---------scripts/sys-arm-linux-gnueabi/bin/objdump1
l---------scripts/sys-arm-linux-gnueabi/bin/strip1
l---------scripts/sys-arm-linux-gnueabihf/bin/gcc1
l---------scripts/sys-arm-linux-gnueabihf/bin/ld1
l---------scripts/sys-arm-linux-gnueabihf/bin/objdump1
l---------scripts/sys-arm-linux-gnueabihf/bin/strip1
l---------scripts/xtools-armhf-linux-gnueabi/bin/gcc1
l---------scripts/xtools-armhf-linux-gnueabi/bin/ld1
l---------scripts/xtools-armhf-linux-gnueabi/bin/objdump1
l---------scripts/xtools-armhf-linux-gnueabi/bin/strip1
l---------scripts/xtools-armsf-linux-gnueabi/bin/gcc1
l---------scripts/xtools-armsf-linux-gnueabi/bin/ld1
l---------scripts/xtools-armsf-linux-gnueabi/bin/objdump1
l---------scripts/xtools-armsf-linux-gnueabi/bin/strip1
30 files changed, 402 insertions, 0 deletions
diff --git a/Android.md b/Android.md
new file mode 100644
index 00000000..115d5300
--- /dev/null
+++ b/Android.md
@@ -0,0 +1,41 @@
+# How To Rebuild OpenAL-soft for Android
+
+This was completed on a Debian Squeeze 6 system.
+This produces an ARMv6 libopenal.so file ready to be used with Jogamp's JOAL on Android devices.
+
+## Prequisites
+
+Here is the necessary tools needed
+
+* git
+* latest Android NDK (http://dl.google.com/android/ndk/android-ndk-r8d-linux-x86.tar.bz2)
+* CMake (2.8)
+
+We'll suppose the NDK is installed in ~/android-ndk-r8d/:
+
+```bash
+export ANDROID_NDK=~/android-ndk-r8d/
+```
+
+
+## Clone the OpenAL repository
+
+```bash
+git clone git://repo.or.cz/openal-soft.git
+ or
+git clone git://jogamp.org/srv/scm/openal-soft.git
+```
+## Add the toolchain.android.cmake
+
+Included in ```git://jogamp.org/srv/scm/openal-soft.git```
+at ```cmake/toolchain.android.cmake```.
+
+## Build
+
+```bash
+cd build
+cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain.android.cmake -DANDROID_API_LEVEL=9
+make
+```
+
+The result should be available in the "build" directory.
diff --git a/cmake/glibc-compat-symbols.h b/cmake/glibc-compat-symbols.h
new file mode 100644
index 00000000..5dc1a18b
--- /dev/null
+++ b/cmake/glibc-compat-symbols.h
@@ -0,0 +1,33 @@
+#ifndef __GLIBC_COMPAT_SYMBOLS_H__
+#define __GLIBC_COMPAT_SYMBOLS_H__ 1
+
+/**
+ *
+ * Note: Patching a specific glibc symbol version is only required if *not* statically linking glibc,
+ * which should be preferred.
+ *
+ * Note: JogAmp's minimum GLIBC is 2.4 due to '__stack_chk_fail' (stack overflow checking)
+ *
+ * GLIBC 2.4 - March 2006 - Standard for LSB 4.0, Used in SLES 10
+ *
+ * We could add compile/link option '-fno-stack-protector', however stack protection seems reasonable
+ * and a pre 2006 distribution a bit too 'far fetched' for our multimedia bindings anyway.
+ *
+ * Check build-in macro definitions via 'gcc -dM -E - < /dev/null'
+ */
+#if defined(__GNUC__) && !defined(__clang__)
+ #if defined(__arm__)
+ #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.4");
+ #elif defined(__amd64__)
+ #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.2.5");
+ #else
+ #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.2.5");
+ #endif /*__amd64__*/
+#else
+ #warning GLIBC_COMPAT_SYMBOL not supported with current compiler
+ #define GLIBC_COMPAT_SYMBOL(FFF)
+#endif
+
+GLIBC_COMPAT_SYMBOL(memcpy)
+
+#endif /*__GLIBC_COMPAT_SYMBOLS_H__*/
diff --git a/cmake/toolchain.android.cmake b/cmake/toolchain.android.cmake
new file mode 100644
index 00000000..7ed01286
--- /dev/null
+++ b/cmake/toolchain.android.cmake
@@ -0,0 +1,170 @@
+# Adapted from http://code.google.com/p/android-cmake/
+
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_VERSION 1)
+
+if(APPLE)
+ set(HOST_APPLE true)
+elseif(UNIX)
+ set(HOST_UNIX true)
+endif()
+
+set(APPLE false)
+set(UNIX true)
+
+set(ANDROID_NDK_DEFAULT_SEARCH_PATH /opt/android-ndk)
+set(ANDROID_NDK_SUPPORTED_VERSIONS -r8d -r8 -r7 -r6 -r5c -r5b -r5 "")
+set(ANDROID_NDK_TOOLCHAIN_DEFAULT_SEARCH_PATH /opt/android-toolchain)
+set(TOOL_OS_SUFFIX "")
+
+if(NOT DEFINED ANDROID_NDK)
+ set(ANDROID_NDK "$ENV{ANDROID_NDK}")
+endif()
+
+if(NOT DEFINED ANDROID_NDK_TOOLCHAIN_ROOT)
+ set(ANDROID_NDK_TOOLCHAIN_ROOT $ENV{ANDROID_NDK_TOOLCHAIN_ROOT})
+endif()
+
+if(NOT EXISTS "${ANDROID_NDK}")
+ foreach(ndk_version ${ANDROID_NDK_SUPPORTED_VERSIONS})
+ if(EXISTS ${ANDROID_NDK_DEFAULT_SEARCH_PATH}${ndk_version})
+ set(ANDROID_NDK "${ANDROID_NDK_DEFAULT_SEARCH_PATH}${ndk_version}")
+ message(STATUS "Using default path for android NDK ${ANDROID_NDK}")
+ message(STATUS " If you prefer to use a different location, please define the variable: ANDROID_NDK")
+ break()
+ endif()
+ endforeach()
+endif()
+
+if(EXISTS "${ANDROID_NDK}")
+ if(APPLE)
+ set(ANDROID_TOOLCHAIN_SYSTEM "darwin-x86")
+ elseif(WIN32)
+ set(ANDROID_TOOLCHAIN_SYSTEM "windows")
+ set(TOOL_OS_SUFFIX ".exe")
+ elseif(UNIX)
+ set(ANDROID_TOOLCHAIN_SYSTEM "linux-x86")
+ else()
+ message(FATAL_ERROR "Your platform is not supported")
+ endif()
+
+ if(NOT ANDROID_API_LEVEL GREATER 2)
+ if(NDK_CPU_X86)
+ set(ANDROID_API_LEVEL 9)
+ else()
+ set(ANDROID_API_LEVEL 5)
+ endif()
+ message(STATUS "Using default android API level android-${ANDROID_API_LEVEL}")
+ message(STATUS " If you prefer to use a different API level, please define the variable: ANDROID_API_LEVEL")
+ endif()
+
+ if (NDK_CPU_X86)
+ set(ANDROID_TOOLCHAIN_PREFIX "i686-android-linux")
+ set(ANDROID_TOOLCHAIN_NAME "x86")
+ set(ANDROID_TOOLCHAIN_PLATFORM_NAME "x86")
+ else()
+ set(ANDROID_TOOLCHAIN_PREFIX "arm-linux-androideabi")
+ set(ANDROID_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_PREFIX}")
+ set(ANDROID_TOOLCHAIN_PLATFORM_NAME "arm")
+ endif()
+
+ if (NOT DEFINED ANDROID_TOOLCHAIN_VERSION)
+ set(SUPPORTED_TOOLCHAIN_VERSIONS 4.4.0 4.4.3 4.6.0 4.6.1 4.6.2 4.6.3 4.7)
+ foreach(gcc_version ${SUPPORTED_TOOLCHAIN_VERSIONS})
+ if (EXISTS "${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}-${gcc_version}")
+ set(ANDROID_TOOLCHAIN_VERSION ${gcc_version})
+ endif()
+ endforeach()
+ if(NOT DEFINED ANDROID_TOOLCHAIN_VERSION)
+ message(FATAL_ERROR "Unable to find toolchain")
+ else()
+ message(STATUS "Using auto-detected toolchain ${ANDROID_TOOLCHAIN_NAME}-${ANDROID_TOOLCHAIN_VERSION}")
+ endif()
+ endif()
+ if (EXISTS "${ANDROID_NDK}/toolchains/clang-android-${ANDROID_TOOLCHAIN_VERSION}")
+ set (ANDROID_TOOLCHAIN_NAME "clang-android")
+ message(STATUS "Found clang toolchain ${ANDROID_TOOLCHAIN_NAME}-${ANDROID_TOOLCHAIN_VERSION}")
+ endif()
+
+ set(ANDROID_NDK_SYSROOT "${ANDROID_NDK}/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_TOOLCHAIN_PLATFORM_NAME}")
+ set(ANDROID_NDK_TOOLCHAIN_ROOT "${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}-${ANDROID_TOOLCHAIN_VERSION}/prebuilt/${ANDROID_TOOLCHAIN_SYSTEM}")
+endif()
+
+set(CMAKE_C_COMPILER "${ANDROID_NDK_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_PREFIX}-gcc${TOOL_OS_SUFFIX}" CACHE PATH "gcc" FORCE)
+set(CMAKE_CXX_COMPILER "${ANDROID_NDK_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_PREFIX}-g++${TOOL_OS_SUFFIX}" CACHE PATH "g++" FORCE)
+set(CMAKE_AR "${ANDROID_NDK_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_PREFIX}-ar${TOOL_OS_SUFFIX}" CACHE PATH "archive" FORCE)
+set(CMAKE_LINKER "${ANDROID_NDK_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_PREFIX}-ld${TOOL_OS_SUFFIX}" CACHE PATH "linker" FORCE)
+set(CMAKE_NM "${ANDROID_NDK_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_PREFIX}-nm${TOOL_OS_SUFFIX}" CACHE PATH "nm" FORCE)
+set(CMAKE_OBJCOPY "${ANDROID_NDK_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_PREFIX}-objcopy${TOOL_OS_SUFFIX}" CACHE PATH "objcopy" FORCE)
+set(CMAKE_OBJDUMP "${ANDROID_NDK_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_PREFIX}-objdump${TOOL_OS_SUFFIX}" CACHE PATH "objdump" FORCE)
+set(CMAKE_STRIP "${ANDROID_NDK_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_PREFIX}-strip${TOOL_OS_SUFFIX}" CACHE PATH "strip" FORCE)
+set(CMAKE_RANLIB "${ANDROID_NDK_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_PREFIX}-ranlib${TOOL_OS_SUFFIX}" CACHE PATH "ranlib" FORCE)
+
+if(NDK_CPU_X86)
+ set(ANDROID_NDK_CPU_NAME "x86")
+ set(CMAKE_SYSTEM_PROCESSOR "x86")
+elseif(NDK_CPU_ARM_V7A)
+ set(NDK_CPU_ARM_NEON false)
+ set(NDK_CPU_ARM_VFPV3 false)
+ set(NDK_CPU_ARM true)
+ set(ANDROID_NDK_CPU_NAME "armeabi-v7a")
+ set(CMAKE_SYSTEM_PROCESSOR "armv7-a")
+else()
+ set(NDK_CPU_ARM true)
+ set(ANDROID_NDK_CPU_NAME "armeabi")
+ set(NDK_CPU_ARM_NEON false)
+ set(CMAKE_SYSTEM_PROCESSOR "armv5te")
+endif()
+
+set(CMAKE_FIND_ROOT_PATH "${ANDROID_NDK_TOOLCHAIN_ROOT}/bin" "${ANDROID_NDK_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_PREFIX}" "${ANDROID_NDK_SYSROOT}" "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_PREFIX}/share")
+
+set(STL_PATH "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++")
+set(STL_LIBRARIES_PATH "${STL_PATH}/libs/${ANDROID_NDK_CPU_NAME}")
+include_directories(SYSTEM "${STL_PATH}/include" "${STL_LIBRARIES_PATH}/include")
+link_directories("${ANDROID_NDK_SYSROOT}/usr/lib")
+
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+set(CMAKE_C_FLAGS "-fPIC -DANDROID -Wno-psabi -fsigned-char")
+
+set(FORCE_ARM OFF CACHE BOOL "Use 32-bit ARM instructions instead of Thumb-1")
+if(NDK_CPU_X86)
+elseif(NOT FORCE_ARM)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthumb")
+else()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm")
+endif()
+
+set(CMAKE_C_FLAGS "--sysroot=${ANDROID_NDK_SYSROOT} ${CMAKE_C_FLAGS}")
+
+include(CMakeForceCompiler)
+CMAKE_FORCE_C_COMPILER("${CMAKE_C_COMPILER}" GNU)
+CMAKE_FORCE_CXX_COMPILER("${CMAKE_CXX_COMPILER}" GNU)
+
+if(NDK_CPU_ARM_V7A)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -mfloat-abi=softfp")
+ if(NDK_CPU_ARM_NEON)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon")
+ elseif(NDK_CPU_ARM_VFPV3)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfpv3")
+ endif()
+endif()
+
+set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c++ flags")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
+
+set(LINKER_FLAGS "-L\"${STL_LIBRARIES_PATH}\" -L\"${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_CPU_NAME}\"")
+if(NDK_CPU_ARM OR NDK_CPU_ARM_V7A)
+ set(LINKER_FLAGS "-Wl,--fix-cortex-a8 ${LINKER_FLAGS}")
+endif()
+
+set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_MODULE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+
+set(ANDROID true)
+set(BUILD_ANDROID true)
+
+MARK_AS_ADVANCED(FORCE_ARM NO_UNDEFINED)
diff --git a/cmake/toolchain.clang-default.cmake b/cmake/toolchain.clang-default.cmake
new file mode 100644
index 00000000..693f55c8
--- /dev/null
+++ b/cmake/toolchain.clang-default.cmake
@@ -0,0 +1,13 @@
+# For normal clang compilation
+
+# set(CMAKE_C_FLAGS "-include ${CMAKE_MODULE_PATH}/glibc-compat-symbols.h")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c++ flags")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
+
+# set(LINKER_FLAGS "-static-libgcc")
+
+set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_MODULE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+
diff --git a/cmake/toolchain.clang-x86_32.cmake b/cmake/toolchain.clang-x86_32.cmake
new file mode 100644
index 00000000..db2b7a27
--- /dev/null
+++ b/cmake/toolchain.clang-x86_32.cmake
@@ -0,0 +1,17 @@
+# For multiarch gcc crosscompile, i.e. x86_32 target on x86_64 host
+
+set(CMAKE_SYSTEM_PROCESSOR "x86")
+
+link_directories("/usr/lib32")
+
+# set(CMAKE_C_FLAGS "-m32 -include ${CMAKE_MODULE_PATH}/glibc-compat-symbols.h")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c++ flags")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
+
+# set(LINKER_FLAGS "-m32 -static-libgcc")
+
+set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_MODULE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+
diff --git a/cmake/toolchain.gcc-armv6.cmake b/cmake/toolchain.gcc-armv6.cmake
new file mode 100644
index 00000000..f09eae27
--- /dev/null
+++ b/cmake/toolchain.gcc-armv6.cmake
@@ -0,0 +1,13 @@
+# For normal gcc compilation, but use static-libgcc
+
+set(CMAKE_C_FLAGS "-fpic -march=armv5te -marm -mfloat-abi=softfp -include ${CMAKE_MODULE_PATH}/glibc-compat-symbols.h -I/usr/include")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c++ flags")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
+
+set(LINKER_FLAGS "-fpic -march=armv5te -marm -mfloat-abi=softfp -static-libgcc")
+
+set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_MODULE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+
diff --git a/cmake/toolchain.gcc-armv6hf.cmake b/cmake/toolchain.gcc-armv6hf.cmake
new file mode 100644
index 00000000..3d197126
--- /dev/null
+++ b/cmake/toolchain.gcc-armv6hf.cmake
@@ -0,0 +1,13 @@
+# For normal gcc compilation, but use static-libgcc
+
+set(CMAKE_C_FLAGS "-fpic -march=armv6 -marm -mfloat-abi=hard -include ${CMAKE_MODULE_PATH}/glibc-compat-symbols.h -I/usr/include")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c++ flags")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
+
+set(LINKER_FLAGS "-fpic -march=armv6 -marm -mfloat-abi=hard -static-libgcc")
+
+set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_MODULE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+
diff --git a/cmake/toolchain.gcc-default.cmake b/cmake/toolchain.gcc-default.cmake
new file mode 100644
index 00000000..3b2c9cfd
--- /dev/null
+++ b/cmake/toolchain.gcc-default.cmake
@@ -0,0 +1,13 @@
+# For normal gcc compilation, but use static-libgcc
+
+set(CMAKE_C_FLAGS "-include ${CMAKE_MODULE_PATH}/glibc-compat-symbols.h")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c++ flags")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
+
+set(LINKER_FLAGS "-static-libgcc")
+
+set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_MODULE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+
diff --git a/cmake/toolchain.gcc-x86_32.cmake b/cmake/toolchain.gcc-x86_32.cmake
new file mode 100644
index 00000000..890f6e11
--- /dev/null
+++ b/cmake/toolchain.gcc-x86_32.cmake
@@ -0,0 +1,17 @@
+# For multiarch gcc crosscompile, i.e. x86_32 target on x86_64 host
+
+set(CMAKE_SYSTEM_PROCESSOR "x86")
+
+link_directories("/usr/lib32")
+
+set(CMAKE_C_FLAGS "-m32 -include ${CMAKE_MODULE_PATH}/glibc-compat-symbols.h")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c++ flags")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
+
+set(LINKER_FLAGS "-m32 -static-libgcc")
+
+set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_MODULE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+
diff --git a/cmake/toolchain.windows.cmake b/cmake/toolchain.windows.cmake
new file mode 100644
index 00000000..4a4f2718
--- /dev/null
+++ b/cmake/toolchain.windows.cmake
@@ -0,0 +1,30 @@
+# Cross-compiling requires CMake 2.6 or newer. To use it from build/, call it
+# like this:
+# cmake .. -DCMAKE_TOOLCHAIN_FILE=../XCompile.txt -DHOST=i686-pc-mingw32
+# Where 'i686-pc-mingw32' is the host prefix for your cross-compiler. If you
+# already have a toolchain file setup, you may use that instead of this file.
+
+# the name of the target operating system
+SET(CMAKE_SYSTEM_NAME Windows)
+
+# which compilers to use for C and C++
+SET(CMAKE_C_COMPILER "gcc.exe")
+SET(CMAKE_CXX_COMPILER "g++.exe")
+
+# here is the target environment located
+#SET(CMAKE_FIND_ROOT_PATH "/usr/${HOST}")
+
+# here is where stuff gets installed to
+#SET(CMAKE_INSTALL_PREFIX "${CMAKE_FIND_ROOT_PATH}/usr" CACHE STRING "Install path prefix, prepended onto install directories." FORCE)
+
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search
+# programs in the host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+# set env vars so that pkg-config will look in the appropriate directory for
+# .pc files (as there seems to be no way to force using ${HOST}-pkg-config)
+set(ENV{PKG_CONFIG_LIBDIR} "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
+set(ENV{PKG_CONFIG_PATH} "")
diff --git a/scripts/arm-linux-gnueabi b/scripts/arm-linux-gnueabi
new file mode 120000
index 00000000..8b9c9e18
--- /dev/null
+++ b/scripts/arm-linux-gnueabi
@@ -0,0 +1 @@
+xtools-armsf-linux-gnueabi \ No newline at end of file
diff --git a/scripts/arm-linux-gnueabihf b/scripts/arm-linux-gnueabihf
new file mode 120000
index 00000000..cb71826d
--- /dev/null
+++ b/scripts/arm-linux-gnueabihf
@@ -0,0 +1 @@
+xtools-armhf-linux-gnueabi \ No newline at end of file
diff --git a/scripts/make.gcc-armv6-cross.sh b/scripts/make.gcc-armv6-cross.sh
new file mode 100755
index 00000000..2eaa1cdf
--- /dev/null
+++ b/scripts/make.gcc-armv6-cross.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+SDIR=`dirname $0`
+CDIR=$SDIR/../cmake
+
+PATH=$SDIR/arm-linux-gnueabi/bin:$PATH
+export PATH
+
+which gcc
+
+cmake .. -DCMAKE_TOOLCHAIN_FILE=$CDIR/toolchain.gcc-armv6.cmake
+make
+
diff --git a/scripts/make.gcc-armv6hf-cross.sh b/scripts/make.gcc-armv6hf-cross.sh
new file mode 100755
index 00000000..406e5241
--- /dev/null
+++ b/scripts/make.gcc-armv6hf-cross.sh
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+SDIR=`dirname $0`
+CDIR=$SDIR/../cmake
+
+PATH=$SDIR/arm-linux-gnueabihf/bin:$PATH
+export PATH
+
+cmake .. -DCMAKE_TOOLCHAIN_FILE=$CDIR/toolchain.gcc-armv6hf.cmake
+make
+
diff --git a/scripts/sys-arm-linux-gnueabi/bin/gcc b/scripts/sys-arm-linux-gnueabi/bin/gcc
new file mode 120000
index 00000000..edeaa99b
--- /dev/null
+++ b/scripts/sys-arm-linux-gnueabi/bin/gcc
@@ -0,0 +1 @@
+/usr/bin/arm-linux-gnueabi-gcc \ No newline at end of file
diff --git a/scripts/sys-arm-linux-gnueabi/bin/ld b/scripts/sys-arm-linux-gnueabi/bin/ld
new file mode 120000
index 00000000..68f4fae2
--- /dev/null
+++ b/scripts/sys-arm-linux-gnueabi/bin/ld
@@ -0,0 +1 @@
+/usr/bin/arm-linux-gnueabi-ld \ No newline at end of file
diff --git a/scripts/sys-arm-linux-gnueabi/bin/objdump b/scripts/sys-arm-linux-gnueabi/bin/objdump
new file mode 120000
index 00000000..a48d9ee9
--- /dev/null
+++ b/scripts/sys-arm-linux-gnueabi/bin/objdump
@@ -0,0 +1 @@
+/usr/bin/arm-linux-gnueabi-objdump \ No newline at end of file
diff --git a/scripts/sys-arm-linux-gnueabi/bin/strip b/scripts/sys-arm-linux-gnueabi/bin/strip
new file mode 120000
index 00000000..8dab56bf
--- /dev/null
+++ b/scripts/sys-arm-linux-gnueabi/bin/strip
@@ -0,0 +1 @@
+/usr/bin/arm-linux-gnueabi-strip \ No newline at end of file
diff --git a/scripts/sys-arm-linux-gnueabihf/bin/gcc b/scripts/sys-arm-linux-gnueabihf/bin/gcc
new file mode 120000
index 00000000..dca59c0f
--- /dev/null
+++ b/scripts/sys-arm-linux-gnueabihf/bin/gcc
@@ -0,0 +1 @@
+/usr/bin/arm-linux-gnueabihf-gcc \ No newline at end of file
diff --git a/scripts/sys-arm-linux-gnueabihf/bin/ld b/scripts/sys-arm-linux-gnueabihf/bin/ld
new file mode 120000
index 00000000..bce9f7fb
--- /dev/null
+++ b/scripts/sys-arm-linux-gnueabihf/bin/ld
@@ -0,0 +1 @@
+/usr/bin/arm-linux-gnueabihf-ld \ No newline at end of file
diff --git a/scripts/sys-arm-linux-gnueabihf/bin/objdump b/scripts/sys-arm-linux-gnueabihf/bin/objdump
new file mode 120000
index 00000000..ded739ce
--- /dev/null
+++ b/scripts/sys-arm-linux-gnueabihf/bin/objdump
@@ -0,0 +1 @@
+/usr/bin/arm-linux-gnueabihf-objdump \ No newline at end of file
diff --git a/scripts/sys-arm-linux-gnueabihf/bin/strip b/scripts/sys-arm-linux-gnueabihf/bin/strip
new file mode 120000
index 00000000..c941465e
--- /dev/null
+++ b/scripts/sys-arm-linux-gnueabihf/bin/strip
@@ -0,0 +1 @@
+/usr/bin/arm-linux-gnueabihf-strip \ No newline at end of file
diff --git a/scripts/xtools-armhf-linux-gnueabi/bin/gcc b/scripts/xtools-armhf-linux-gnueabi/bin/gcc
new file mode 120000
index 00000000..ad74056d
--- /dev/null
+++ b/scripts/xtools-armhf-linux-gnueabi/bin/gcc
@@ -0,0 +1 @@
+/usr/local/x-tools/armhf-unknown-linux-gnueabi/bin/armhf-unknown-linux-gnueabi-gcc \ No newline at end of file
diff --git a/scripts/xtools-armhf-linux-gnueabi/bin/ld b/scripts/xtools-armhf-linux-gnueabi/bin/ld
new file mode 120000
index 00000000..6d1bd138
--- /dev/null
+++ b/scripts/xtools-armhf-linux-gnueabi/bin/ld
@@ -0,0 +1 @@
+/usr/local/x-tools/armhf-unknown-linux-gnueabi/bin/armhf-unknown-linux-gnueabi-ld \ No newline at end of file
diff --git a/scripts/xtools-armhf-linux-gnueabi/bin/objdump b/scripts/xtools-armhf-linux-gnueabi/bin/objdump
new file mode 120000
index 00000000..9502840a
--- /dev/null
+++ b/scripts/xtools-armhf-linux-gnueabi/bin/objdump
@@ -0,0 +1 @@
+/usr/local/x-tools/armhf-unknown-linux-gnueabi/bin/armhf-unknown-linux-gnueabi-objdump \ No newline at end of file
diff --git a/scripts/xtools-armhf-linux-gnueabi/bin/strip b/scripts/xtools-armhf-linux-gnueabi/bin/strip
new file mode 120000
index 00000000..a4ce5087
--- /dev/null
+++ b/scripts/xtools-armhf-linux-gnueabi/bin/strip
@@ -0,0 +1 @@
+/usr/local/x-tools/armhf-unknown-linux-gnueabi/bin/armhf-unknown-linux-gnueabi-strip \ No newline at end of file
diff --git a/scripts/xtools-armsf-linux-gnueabi/bin/gcc b/scripts/xtools-armsf-linux-gnueabi/bin/gcc
new file mode 120000
index 00000000..171bfb69
--- /dev/null
+++ b/scripts/xtools-armsf-linux-gnueabi/bin/gcc
@@ -0,0 +1 @@
+/usr/local/x-tools/armsf-unknown-linux-gnueabi/bin/armsf-unknown-linux-gnueabi-gcc \ No newline at end of file
diff --git a/scripts/xtools-armsf-linux-gnueabi/bin/ld b/scripts/xtools-armsf-linux-gnueabi/bin/ld
new file mode 120000
index 00000000..f10f5b85
--- /dev/null
+++ b/scripts/xtools-armsf-linux-gnueabi/bin/ld
@@ -0,0 +1 @@
+/usr/local/x-tools/armsf-unknown-linux-gnueabi/bin/armsf-unknown-linux-gnueabi-ld \ No newline at end of file
diff --git a/scripts/xtools-armsf-linux-gnueabi/bin/objdump b/scripts/xtools-armsf-linux-gnueabi/bin/objdump
new file mode 120000
index 00000000..8e28b950
--- /dev/null
+++ b/scripts/xtools-armsf-linux-gnueabi/bin/objdump
@@ -0,0 +1 @@
+/usr/local/x-tools/armsf-unknown-linux-gnueabi/bin/armsf-unknown-linux-gnueabi-objdump \ No newline at end of file
diff --git a/scripts/xtools-armsf-linux-gnueabi/bin/strip b/scripts/xtools-armsf-linux-gnueabi/bin/strip
new file mode 120000
index 00000000..1e5fe910
--- /dev/null
+++ b/scripts/xtools-armsf-linux-gnueabi/bin/strip
@@ -0,0 +1 @@
+/usr/local/x-tools/armsf-unknown-linux-gnueabi/bin/armsf-unknown-linux-gnueabi-strip \ No newline at end of file