Skip to content

Instantly share code, notes, and snippets.

@khernyo
Last active March 20, 2016 09:20
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khernyo/6612979 to your computer and use it in GitHub Desktop.
Save khernyo/6612979 to your computer and use it in GitHub Desktop.
Make it build the android version properly
#!/bin/bash
set -e
SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd )
# the location of a clean racket repo which will be copied to avoid "git clone"-ing
REPO=$SCRIPT_DIR/../tools/racket
PLATFORM=linux-x86_64
ANDROID_TARGET_VERSION=14
ANDROID_NDK_COMPILER_VERSION=4.6
HOST=arm-linux-androideabi
RACKET_COMMIT_ID=$( cd "$REPO" && git rev-parse HEAD )
RACKET_HOST=racket-host
RACKET_ANDROID=racket-android
ANDROID_NDK_PLATFORM=$ANDROID_NDK/platforms/android-$ANDROID_TARGET_VERSION/arch-arm/
ANDROID_NDK_BIN=$ANDROID_NDK/toolchains/$HOST-$ANDROID_NDK_COMPILER_VERSION/prebuilt/$PLATFORM/bin
ANDROID_NDK_INCLUDE=$ANDROID_NDK_PLATFORM/usr/include
ANDROID_NDK_LIB=$ANDROID_NDK_PLATFORM/usr/lib
#CROSS_COMPILER_PATH=~/dev/sdk/android-ndk-r8e-standalone-android-14/bin/
MAKE="make" #-j`nproc`"
(
cp -r $REPO $RACKET_HOST
cd $RACKET_HOST/racket/src
mkdir -p build
cd build
../configure
$MAKE
)
(
RACKET=$(readlink -f $RACKET_HOST/racket/src/build/racket/racket3m)
cp -r $REPO $RACKET_ANDROID
cd $RACKET_ANDROID/racket/src
mkdir -p build
cd build
export PATH=$ANDROID_NDK_BIN:$PATH
../configure --host=$HOST \
CPPFLAGS="-I$ANDROID_NDK_INCLUDE --sysroot=$ANDROID_NDK_PLATFORM" \
LDFLAGS="-L$ANDROID_NDK_LIB --sysroot=$ANDROID_NDK_PLATFORM" \
--disable-gracket \
--disable-places \
--disable-futures \
--disable-docs \
--enable-sgc \
--enable-origtree \
--enable-racket=$RACKET
$MAKE
)
@viperscape
Copy link

is it necessary to disable futures? do you have anymore info on this process of getting a racket program into android? I'm aiming to use sdl from racket and compile for android jni if possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment