- Add configure.android and cross compile configuration in src/.
authorEvrim Ulu <evrimulu@gmail.com>
Wed, 25 Mar 2015 10:53:50 +0000 (12:53 +0200)
committerEvrim Ulu <evrimulu@gmail.com>
Wed, 25 Mar 2015 10:53:50 +0000 (12:53 +0200)
configure.android [new file with mode: 0755]
src/android_cross_config.in [new file with mode: 0644]

diff --git a/configure.android b/configure.android
new file mode 100755 (executable)
index 0000000..9656724
--- /dev/null
@@ -0,0 +1,90 @@
+#!/bin/sh
+if [ "x$ANDROID_NDK" = "x" ]; then
+    echo "Please export ANDROID_NDK environment"
+    exit 1;
+fi
+
+INSTALL_DIR=`pwd`/android/install
+BUILD_DIR=`pwd`/android/build
+SRC_DIR=`pwd`/src
+mkdir -p $INSTALL_DIR
+mkdir -p $BUILD_DIR
+
+HOST_BUILD_DIR=${BUILD_DIR}/host
+HOST_INSTALL_DIR=${INSTALL_DIR}/host
+if [ -z ${HOST_BUILD_DIR}/bin/ecl ]; then
+
+# Build 32 bit crosscompiler host without longdouble
+ABI=32
+CFLAGS="-m32 -g -O2"
+LDFLAGS="-m32 -g -O2"
+mkdir -p ${HOST_BUILD_DIR} && cd ${HOST_BUILD_DIR};
+echo `pwd`;
+
+$SRC_DIR/configure \
+ABI=${ABI} CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
+    --enable-threads=yes \
+    --disable-longdouble \
+    --with-dffi=no \
+    --prefix=${HOST_INSTALL_DIR}
+
+make && make install 
+fi
+
+# Build 32bit arm android
+ANDROID_BUILD_DIR=${BUILD_DIR}/android
+ANDROID_INSTALL_DIR=${INSTALL_DIR}/android
+mkdir -p ${ANDROID_BUILD_DIR} && cd ${ANDROID_BUILD_DIR};
+
+ABI=arm-linux-androideabi
+TOOLCHAIN_VERSION=4.9
+API_LEVEL=19
+
+ANDROID_PREFIX=${ANDROID_NDK}/toolchains/arm-linux-androideabi-$TOOLCHAIN_VERSION/prebuilt/linux-x86_64
+SYSROOT=${ANDROID_NDK}/platforms/android-$API_LEVEL/arch-arm
+CROSS_PATH=${ANDROID_PREFIX}/bin/${ABI}
+CPP=${CROSS_PATH}-cpp
+AR=${CROSS_PATH}-ar
+AS=${CROSS_PATH}-as
+NM=${CROSS_PATH}-nm
+CC=${CROSS_PATH}-gcc
+CXX=${CROSS_PATH}-g++
+LD=${CROSS_PATH}-ld
+RANLIB=${CROSS_PATH}-ranlib
+OBJCOPY=${CROSS_PATH}-objcopy
+STRIP=${CROSS_PATH}-strip
+GRPROF=${CROSS_PATH}-gprof
+READELF=${CROSS_PATH}-readelf
+OBJDUMP=${CROSS_PATH}-objdump
+
+PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
+
+# http://stackoverflow.com/questions/24818902/running-a-native-library-on-android-l-error-only-position-independent-executab 
+
+CFLAGS="--sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${ANDROID_PREFIX}/include -I${DEV_PREFIX}/android/bionic"
+CPPFLAGS="${CFLAGS}"
+LDFLAGS="--sysroot=${SYSROOT} -L${SYSROOT}/usr/lib -L${ANDROID_PREFIX}/lib"
+
+${SRC_DIR}/configure \
+RANLIB="$RANLIB" LD="$LD" CXX="$CXX" CC="$CC" NM="$NM" \
+AS="$AS" AR="$AR" CPP="$CPP" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LDFLAGS="$LDFLAGS" OBJCOPY="$OBJCOPY" STRIP="$STRIP" \
+GPROF="$GPROF" READELF="$READELF" OBJDUMP="$OBJDUMP" \
+ECL_TO_RUN=${HOST_INSTALL_DIR}/bin/ecl \
+    --host=${ABI} \
+    --target=${ABI} \
+    --with-cross-config=${SRC_DIR}/android_cross_config.in \
+    --prefix=${ANDROID_INSTALL_DIR} \
+    --disable-longdouble \
+    --disable-shared \
+    --enable-threads=yes \
+    --with-dffi=no \
+    --with-cmp=no \
+    --with-asdf=builtin \
+    --with-bytecmp=builtin \
+    --with-serve-event=yes \
+    $@
+
+make && make install
+
+echo "ECL Android compiled in ${ANDROID_INSTALL_DIR}"
diff --git a/src/android_cross_config.in b/src/android_cross_config.in
new file mode 100644 (file)
index 0000000..2bb9e83
--- /dev/null
@@ -0,0 +1,63 @@
+###
+### YOU ARE TRYING TO CROSS COMPILE ECL.
+### PLEASE FOLLOW THESE INSTRUCTIONS:
+###
+### 1) Vital information cannot be determined at configuration time
+### because we are not able to run test programs. A file called
+###            
+### has been created, that you will have to fill out. Please do
+### it before invoking "configure" again.
+
+### 1.1) Direction of growth of the stack
+ECL_STACK_DIR=down
+
+### 1.2) Choose an integer datatype which is large enough to host a pointer
+CL_FIXNUM_TYPE=int
+CL_FIXNUM_BITS=32
+CL_FIXNUM_MAX=536870911L
+CL_FIXNUM_MIN=-536870912L
+CL_INT_BITS=32
+CL_LONG_BITS=32
+
+### 1.3) Order of bytes within a word
+ECL_BIGENDIAN=no
+
+### 1.4) What characters signal an end of line. May be LF (Linefeed or \n)
+###      CR (Carriage return or \r), and CRLF (CR followed by LF).
+ECL_NEWLINE=LF
+
+### 1.5) Can we guess how many characters are available for reading from
+###      the FILE structure?
+###          0 = no
+###          1 = (f)->_IO_read_end - (f)->_IO_read_ptr
+###          2 = (f)->_r
+###          3 = (f)->_cnt
+ECL_FILE_CNT=0
+
+###
+### 1.6) Other integer types (set to 'no' to disable)
+###
+ECL_STDINT_HEADER="#include <stdint.h>"
+ECL_UINT8_T=uint8_t
+ECL_UINT16_T=uint16_t
+ECL_UINT32_T=uint32_t
+ECL_UINT64_T=uint64_t
+ECL_INT8_T=int8_t
+ECL_INT16_T=int16_t
+ECL_INT32_T=int32_t
+ECL_INT64_T=int64_t
+ECL_LONG_LONG_BITS=64
+
+###
+### 1.7) Other features (set to 'no' to disable)
+###
+ECL_WORKING_SEM_INIT=no
+ECL_WORKING_ENVIRON=yes
+
+### 2) To cross-compile ECL so that it runs on the system
+###            arm-linux-eabi
+### you need to first compile ECL on the system in which you are building
+### the cross-compiled files, that is
+###            x86_64-unknown-linux-gnu
+### By default we assume that ECL can be accessed from some directory in
+### the path.