-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.couch
executable file
·58 lines (49 loc) · 1.72 KB
/
build.couch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash -x
#
source scripts/env
# Make sure we have a valid environment before we continue
./scripts/checkenv
if [[ $? -ne 0 ]]; then
exit 1
fi
if [[ ! -d /data ]]; then
WHOAMI=$(whoami)
echo "The /data directory required by this build script does not exist!"
echo "Please run the following command as root and re-run this script."
echo "# mkdir /data; chown $WHOAMI:$WHOAMI /data"
exit 1
fi
cd $COUCH_HOME
# 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@radicaldynamic.com
./bootstrap
ERL_LIBS=$ERL_HOME/lib \
ERL=$ERL_HOME/bootstrap/bin/erl \
ERLC=$ERL_HOME/bootstrap/bin/erlc \
CXX=agcc \
CXXFLAGS="-fno-rtti -fno-exceptions -I$COUCH_ANDROID_HOME/build/deps/otp_rel/usr/include -I$ANDROID_NDK_ROOT/sources/cxx-stl/stlport/stlport/" \
CFLAGS="-I$ERL_HOME/erts/emulator/beam/ -I$ERL_HOME/erts/include/arm-unknown-eabi/" \
CC=agcc \
./configure \
--with-ejson-compare=no \
--host=arm-eabi \
--prefix=/data/data/%app_name%/couchdb \
--with-erlang=$COUCH_ANDROID_HOME/build/deps/otp_rel/usr/include \
--with-js-include=$COUCH_ANDROID_HOME/build/deps/mozilla-current/mozilla-central/js/src/dist/include \
--with-js-lib="$COUCH_ANDROID_HOME/build/deps/mozilla-current/mozilla-central/js/src"
export ERL_LIBS=$ERL_HOME/lib
make -s
make install
# fix up the snappy nif
cd src/snappy
agcc -shared -o .libs/snappy_nif.so \
snappy_nif.o snappy.o snappy-sinksource.o snappy-stubs-internal.o \
-L../../../Android-Couchbase-SourceBuild/build/deps/otp_rel/erts-5.8.5/bin/ \
-lbeam \
-L$ANDROID_NDK_ROOT/sources/cxx-stl/stlport/libs/armeabi \
-lstlport_static \
-lgcc \
-lstdc++
make -s
make install