Skip to content

Commit

Permalink
- Tweak or fix paths where appropriate; add old notes and patches for…
Browse files Browse the repository at this point in the history
… posterity.

- Use port 5984 so as not to collide with other things (this should be dynamic)

- Place variable state data in /sdcard/Android/data/namespace/db for easy upgrading
  • Loading branch information
mattadams committed Jun 7, 2011
1 parent ba4bfc1 commit 9ddb70a
Show file tree
Hide file tree
Showing 15 changed files with 2,046 additions and 25 deletions.
10 changes: 9 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ These instruction are for building the couchdb android binaries from source, thi

Android requires around 10GB of free space to complete its build.

It is currently aimed to work on Ubuntu 10.4, other platforms should be possible.
It is currently aimed to work on Ubuntu 10.4 and Debian Squeeze x86 32bit, other platforms should be possible.

Dependencies
============
Expand All @@ -22,3 +22,11 @@ Usage
$ ./build.otp
$ ./build.couch
$ ./build.final

Credits
=======
Original port by Aaron Miller (https://github.com/apage43).

Updated port, patches and build scripts by Matt Adams (http://radicaldynamic.com) based on Aaron's work and using patches to CouchDB from Chris C. Coulson (https://launchpad.net/~chrisccoulson) for compatibility with newer versions of libjs.

Further work on the build system by Dale Harvey (http://arandomurl.com) and Matt Adams.
6 changes: 3 additions & 3 deletions build.android
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
source scripts/env

cd $COUCH_ANDROID_HOME
mkdir -p build/deps/android
cd build/deps/android
mkdir -p build/deps/android/$ANDROID_TARGET
cd build/deps/android/$ANDROID_TARGET

repo init -u git://android.git.kernel.org/platform/manifest.git -b froyo
repo init -u git://android.git.kernel.org/platform/manifest.git -b $ANDROID_TARGET
repo sync

source build/envsetup.sh
Expand Down
6 changes: 3 additions & 3 deletions build.couch
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ source scripts/env

cd $COUCH_ANDROID_HOME/build/deps/
rm -rf couchdb
#rm -rf /sdcard/*
rm -rf /sdcard/*
git clone -b android git://github.com/daleharvey/couchdb.git -b android
cd couchdb

# Android Build Support from https://github.com/apage43/couchdb/tree/0.11.x-android
# Mozilla JS compatibility by chrisccoulson from jsapi@irc.mozilla.org
# Fixes for Android by matt.adams-couch@radicaldynamic.com
# Fixes for Android by matt.adams@radicaldynamic.com
./bootstrap

ANDROID_SDK=$COUCH_ANDROID_HOME/build/deps/android
ANDROID_SDK=$COUCH_ANDROID_HOME/build/deps/android/$ANDROID_TARGET

ERL=$COUCH_ANDROID_HOME/build/deps/otp/bootstrap/bin/erl \
ERLC=$COUCH_ANDROID_HOME/build/deps/otp/bootstrap/bin/erlc \
Expand Down
19 changes: 12 additions & 7 deletions build.final
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

source scripts/env

##
# Build release numbers should follow the convention expected by couch-android-launcher.
# E.g., 8-1.1 which translates to "build for froyo, version 1.1"
#
if [ -z "$1" ]; then
echo "Give me a release number bub!"
exit 1
Expand All @@ -28,7 +32,6 @@ rm Install
chmod -x erts-5.7.5/bin/start_erl.src erts-5.7.5/bin/start.src

# Remove unnecessary files

shopt -s extglob

rm -rf erts-5.7.5/doc erts-5.7.5/include erts-5.7.5/man erts-5.7.5/src misc releases usr
Expand Down Expand Up @@ -60,18 +63,20 @@ cp build/deps/mozilla-current/mozilla-central/js/src/libmozjs.so $REL_PATH/sdcar
# 3) Update #!/bin/sh in data/data/$APP_NAME/erlang/lib/couch-1.0.1/priv/couchspawnkillable
# 4) Reflect new locations and the Android environment
#
rm release
ln -s $REL_PATH release
patch -p0 < patches/release.patch
[[ -f release ]] && rm release
ln -s $REL_PATH release
patch -lp0 < patches/release.patch
rm release

chmod +x $REL_PATH/sdcard/Android/data/$ANDROID_APP_NAME/couchdb/bin/couchjs_wrapper

# Build ICU for whatever version of Android was compiled in ~/software/android/sdk/sources
# Store database and variable state in a directory that is safe from upgrades
mkdir $REL_PATH/sdcard/Android/data/$ANDROID_APP_NAME/db

# Build ICU for whatever version of Android was compiled in ~/software/android/sdk/sources
agcc \
-shared \
-o $REL_PATH/sdcard/Android/data/$ANDROID_APP_NAME/couchdb/lib/couchdb/couch_icu_driver.so couchdb/src/couchdb/priv/.libs/libcouch_icu_driver.a \
-o $REL_PATH/sdcard/Android/data/$ANDROID_APP_NAME/couchdb/lib/couchdb/couch_icu_driver.so $COUCH_ANDROID_HOME/build/deps/couchdb/src/couchdb/priv/.libs/libcouch_icu_driver.a \
-licuuc \
-licudata \
-licui18n \
Expand All @@ -92,5 +97,5 @@ cd $COUCH_ANDROID_HOME
#
cd $REL_PATH
touch filecount.$(find | wc -l)
tar -czf ../release-$1.tgz data sdcard
tar -czf ../release-$1.tgz filecount.* data sdcard
cd ..
5 changes: 2 additions & 3 deletions build.otp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ rm -rf otp_rel
git clone git://github.com/daleharvey/otp.git -b android
cd otp

export ANDROID_SDK=$HOME/build/deps/android/sdk
export ANDROID_SYS_ROOT=$ANDROID_SDK/sources
export ANDROID_SYS_ROOT=$COUCH_ANDROID_HOME/build/deps/android/$ANDROID_TARGET

./otp_build autoconf
./otp_build configure --xcomp-conf=xcomp/erl-xcomp-android.conf
./otp_build boot -a
./otp_build release -a $(pwd)/../otp_rel
./otp_build release -a $(pwd)/../otp_rel
91 changes: 91 additions & 0 deletions oldnotes/INSTALL.apage43
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
Taken from https://github.com/apage43/couch-android-launcher/wiki/CouchDB-Build-Notes-Dump.
These were used by Matt Adams to update the Couch on Android port but
are probably of little significance at this point.

----

warn: These are notes I was personally taking. Will clean them up
later, but may be of use if you are trying to build couchdb on android
yourself.

Curl
=======================================================================

./configure \
CC=arm-eabi-gcc \
--host=arm-linux
--disable-tftp \
--disable-sspi \
--disable-ipv6 \
--disable-ldaps \
--disable-ldap \
--disable-telnet \
--disable-pop3 \
--disable-ftp \
--with-ssl=$ANDROID_ROOT/external/openssl/ \
--disable-imap \
--disable-smtp \
--disable-pop3 \
--disable-rtsp \
--disable-ares \
--without-ca-bundle \
--disable-warnings \
--disable-manual \
--without-nss \
--enable-shared \
--with-zlib=$ANDROID_ROOT/external/zlib \
--without-random


SpiderMonkey
=======================================================================

There is cross-compile support for spidermonkey 1.8. Should work well
enough.

Hey, wait, Android Fennec has spidermonkey, let’s try building it
according to the JS only build instructions at
https://wiki.mozilla.org/Android

^-- Bleh, requires NSPR etc, isn’t really smaller. Also tough to build
against:

hg spidermonkey configure:

../configure \
--target=arm-android-eabi \
--with-android-ndk=/home/apage43/android-ndk-r3 \
--with-endian=little \
--with-arm-kuser \
--disable-tests

Don’t do this. Spidermonkey hg trunk doesn’t like evalcx in couchjs.

tests use STL so are disabled for android


Android CouchDB Notes
=======================================================================

Set ANDROID_SYS_ROOT before building erlang or crypto, ssl, etc will not build.

Build system libs live in android_build/out/target/product/generic
Headers live in android_build/external or in opencore

./configure \
--prefix=/sdcard/couch \
--with-js-include=/home/apage43/mcdb/js/src/build-rel/dist/include/ \
--with-js-lib=/home/apage43/mcdb/js/src/build-rel/dist/lib/ \
--host=arm-eabi \
CC=agcc \
--with-android=/home/apage43/android_build \
--with-erlang=/home/apage43/mcdb/otp_rel/usr/include/ \
--with-android-curl=/home/apage43/mcdb/curl


collation driver:

agcc -shared -o couch_icu_driver.so libcouch_icu_driver.a
-L/home/apage43/android_build/out/target/product/generic/system/lib
-licuuc -licudata -licui18n
-L/home/apage43/mcdb/otp_rel/erts-5.7.5/bin/ -lbeam
33 changes: 33 additions & 0 deletions oldnotes/README.openssl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
These notes pertain to building openssl without building the entire
Android ecosystem. Since we don't do this anymore these notes are for
hysterical raisins only.

----

# Get the source.
git clone git://android.git.kernel.org/platform/external/openssl.git

# Go into the directory.
cd openssl

# Trick the NDK into thinking this is the project dir. This is the easiest and only way I could find to do it.
touch AndroidManifest.xml

# Give the NDK build system the Application.mk it needs. I couldn't find a way to specify this manually, and it seems the jni bit is hardcoded.
mkdir jni
echo "APP_PROJECT_PATH := $(pwd)" >> jni/Application.mk
echo "APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/Android.mk" >> jni/Application.mk

# Edit all the Android.mk's.
nano crypto/Android.mk
nano apps/Android.mk
nano ssl/Android.mk

# In all of them you need to replace "external/openssl" with "$(NDK_PROJECT_PATH)". Also in crypto/Android.mk you need to comment out the assembly stuff so that it always uses aes/aes_core.c
# Obviously you won't have any assembly optimisations then, but I couldn't get them to work. :-/

# Finally run:
path/to/android-ndk-r4b/ndk-build -j2

# libcrypto.so and libssl.so are in
cd libs/armeabi
Loading

0 comments on commit 9ddb70a

Please sign in to comment.