1. Keigo Imai
  2. coq-on-android

Source

coq-on-android / build.sh

#!/bin/sh

TARGET_CAMLDIR=/Users/keigoi/usr/ocaml-android

NDK=/Users/keigoi/Documents/android-ndk-r7
GCCDIR=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86

TARGET_AR=$GCCDIR/bin/arm-linux-androideabi-ar
TARGET_RANLIB=$GCCDIR/bin/arm-linux-androideabi-ranlib

# make host's bin/coqdep_boot and bin/mkcoqtop
make_coqmktop() {
  # copy the tree
  cp -r coq-target coq-host
  pushd coq-host

  # make read-only
  find . -type f -exec chmod -w {} \;

  # build
  ./configure -local -coqide no -natdynlink no -with-doc no -with-geoproof no
  make bin/coqmktop
  cp bin/* ../coq-target/bin
  popd
  
  # a trick to make coqmktop refer to ocaml-android
  pushd coq-target
  mv bin/coqmktop bin/coqmktop.orig
  echo '#!/bin/sh' > bin/coqmktop
  echo '`dirname $0`/coqmktop.orig' "-camlbin $TARGET_CAMLDIR/bin" '-coqlib .' '$*' >> bin/coqmktop
  chmod +x bin/coqmktop
}

make_target() {
  cd coq-target
  make archclean
  ./configure -local -camldir $TARGET_CAMLDIR/bin -coqide no -with-doc no -with-ar $TARGET_AR -with-ranlib $TARGET_RANLIB
  make clean
  make bin/coqtop.opt bin/libcoq.opt.so
}

set -v

make_coqmktop
make_target