Skip to content

Commit

Permalink
updated to package tgz/jpg and overlay.zip correctly
Browse files Browse the repository at this point in the history
includes binary builds of:
libcrypto_nif.so
crypto beams
ssl beams
to be removed once we build ssl from the NDK

Change-Id: Icd8f607fdb159c059658e1061fb7ff0abbdddad9
Reviewed-on: http://review.couchbase.org/9673
Reviewed-by: Marty Schoch <marty.schoch@gmail.com>
Reviewed-by: Dale Harvey <daleharvey@arandomurl.com>
Tested-by: Dale Harvey <daleharvey@arandomurl.com>
  • Loading branch information
mschoch authored and Dale Harvey committed Sep 27, 2011
1 parent 843d427 commit 8f138e3
Show file tree
Hide file tree
Showing 38 changed files with 354 additions and 84 deletions.
2 changes: 2 additions & 0 deletions build.all
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ do
exit 1
fi
done

./build.final 1.0-dp >& build.log.final
175 changes: 94 additions & 81 deletions build.final
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ fi
DATE=$(date +"%Y-%m-%d_%H-%M-%S")
REL_NAME="release-$DATE"
REL_PATH="out/$REL_NAME"
OVERLAY_NAME="overlay-$DATE"
OVERLAY_PATH="out/$OVERLAY_NAME"

mkdir -p $REL_PATH

Expand Down Expand Up @@ -67,33 +69,36 @@ cd $COUCH_ANDROID_HOME
# Finally move things into place
#

cp -Rdp /data/data/%app_name%/couchdb $REL_PATH/couchdb
mv build/deps/otp_rel.package $REL_PATH/erlang
mkdir -p $REL_PATH/couchdb/bin/
mkdir -p $REL_PATH/couchdb/etc/
cp -Rdp /data/data/%app_name%/couchdb/etc/couchdb $REL_PATH/couchdb/etc/couchdb
mkdir -p $REL_PATH/couchdb/etc/
cp -Rdp /data/data/%app_name%/couchdb/etc/default $REL_PATH/couchdb/etc/default
mkdir -p $REL_PATH/couchdb/lib/couchdb/bin/
cp -Rdp /data/data/%app_name%/couchdb/lib/couchdb/bin/couchjs $REL_PATH/couchdb/lib/couchdb/bin/couchjs
mkdir -p $REL_PATH/couchdb/share/couchdb/
cp -Rdp /data/data/%app_name%/couchdb/share/couchdb/server $REL_PATH/couchdb/share/couchdb/server

mv $REL_PATH/couchdb/lib/couchdb/erlang/lib/couch-* $REL_PATH/couchdb/lib/couchdb/erlang/lib/couch
cp -Rdp /data/data/%app_name%/couchdb/lib/couchdb/erlang/lib/couch-1.2.0a-8899be7-git/priv/couchspawnkillable $REL_PATH

# We need the shared lib because our toolchain does not support the static lib (libstdc++ stuff)
cp build/deps/mozilla-current/mozilla-central/js/src/libmozjs.so $REL_PATH/couchdb/bin
mkdir -p $REL_PATH/erlang/bin/

mkdir $REL_PATH/erlang/lib/geocouch
cp $GEOCOUCH_HOME/build/*.beam $REL_PATH/erlang/lib/geocouch
# Generate start.boot
[[ -f patches/start.boot ]] && rm patches/start.boot
cd patches
sh script2boot.sh
cd ..

###
# 2) Create couchjs_wrapper script (because we can't link to libmozjs.a and so need LD_LIBRARY_PATH set)
# 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
#
[[ -f release ]] && rm release
ln -s $REL_PATH release
mkdir -p release/couchdb/lib/couchdb/android_icu
cp -r android_icu release/couchdb/lib/couchdb
patch -lp0 < patches/release.patch
rm release
cp patches/start.boot $REL_PATH/erlang/bin/start.boot
cp build/deps/otp_rel.package/erts-5.8.5/bin/child_setup $REL_PATH/erlang/bin/child_setup
cp build/deps/otp_rel.package/erts-5.8.5/bin/inet_gethost $REL_PATH/erlang/bin/inet_gethost

# Create an android default config file

ANDROID_DEFAULT='[couchdb]
database_dir = %couch_data_dir%/db
view_index_dir = %couch_data_dir%/db
util_driver_dir = %couch_installation_dir%/couchdb/lib/couchdb/android_icu/%sdk_int%
util_driver_dir = %couch_installation_dir%/
uri_file = %couch_data_dir%/db/couch.uri
file_compression = none
Expand Down Expand Up @@ -129,77 +134,24 @@ _spatiallist = {couch_httpd_spatial_list, handle_spatial_list_req_deprecated}'
echo "$ANDROID_DEFAULT" >> $REL_PATH/couchdb/etc/couchdb/android.default.ini
touch $REL_PATH/couchdb/etc/couchdb/overrides.ini

COUCHDB_WRAPPER='#!/system/bin/sh -e
export HOME=%couch_installation_dir%
COUCHDB_DIR=$HOME/couchdb
COUCHDB_BINDIR=$COUCHDB_DIR/bin
ERLANG_DIR=$HOME/erlang
ERLANG_BINDIR=$ERLANG_DIR/bin
ERLANG_LIBDIR=$ERLANG_DIR/erts-5.8.5/bin
export LD_LIBRARY_PATH=$ERLANG_LIBDIR:$COUCHDB_BINDIR:$COUCHDB_DIR/lib/couchdb/bin
export PATH=$ERLANG_BINDIR:$COUCHDB_BINDIR:$PATH
export ERL_INETRC=$ERLANG_DIR/bin/erl_inetrc
export EMU=beam
export ROOTDIR=$ERLANG_DIR
export BINDIR=$ERLANG_LIBDIR
export PROGNAME="${0##*/}"
exec $BINDIR/erlexec $@'

echo "$COUCHDB_WRAPPER" >> $REL_PATH/couchdb/bin/couchdb_wrapper
# Create couchjs_wrapper script (because we can't link to libmozjs.a and so need LD_LIBRARY_PATH set)

COUCHJS_WRAPPER='#!/system/bin/sh
export LD_LIBRARY_PATH=%couch_installation_dir%/couchdb/bin
export LD_LIBRARY_PATH=%couch_installation_dir%/lib
exec %couch_installation_dir%/couchdb/lib/couchdb/bin/couchjs $@'

echo "$COUCHJS_WRAPPER" >> $REL_PATH/couchdb/bin/couchjs_wrapper

chmod +x $REL_PATH/couchdb/bin/couchjs_wrapper
chmod +x $REL_PATH/couchdb/bin/couchdb_wrapper

# Build ICU for whatever version of Android was compiled in ~/software/android/sdk/sources
agcc \
-shared \
-o $REL_PATH/couchdb/lib/couchdb/couch_icu_driver.so $COUCH_HOME/src/couchdb/priv/.libs/libcouch_icu_driver.a \
-licuuc \
-licudata \
-licui18n \
-L$COUCH_ANDROID_HOME/build/deps/otp_rel/erts-5.8.5/bin \
-lbeam

##
# Remove vestigal files from Couch directory
# (Futon is in www)
###
# 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
#
cd $REL_PATH/couchdb
rm -rf share/couchdb/www
rm -rf share/doc
rm -rf share/man
rm -rf var
rm -rf etc/init.d
rm -rf etc/logrotate.d
rm -rf etc/couchdb/local.d
rm -rf etc/couchdb/default.d
rm -rf lib/couchdb/erlang/lib/etap/
rm bin/couchjs
rm bin/couchdb
rm lib/couchdb/erlang/lib/couch/priv/lib/couch_icu_driver.la
rm /lib/couchdb/erlang/lib/couch/ebin/couch.app

# Location to ICU will be determined dynamically when Couch is initialized by the Couch-dependant app.
# See libcouch-android and android_icu/ for more information.
rm lib/couchdb/couch_icu_driver.so

cd ..

# Strip beam files of debugging symbols
$ERL_HOME/bootstrap/bin/erl -eval "erlang:display(beam_lib:strip_release(\"couchdb/lib/couchdb/erlang\"))" -s init stop
$ERL_HOME/bootstrap/bin/erl -eval "erlang:display(beam_lib:strip_release(\"erlang\"))" -s init stop

cd $COUCH_ANDROID_HOME
[[ -f release ]] && rm release
ln -s $REL_PATH release
patch -lp0 < patches/release.patch
rm release

##
# Archive the release
Expand All @@ -210,3 +162,64 @@ touch filecount.$(find | wc -l)
tar -czf ../$RELEASE_FILE filecount.* !(filecount.*)
cp ../$RELEASE_FILE ../$RELEASE_FILE.jpg
cd ..


# Now build the overlay.zip

cd $COUCH_ANDROID_HOME

mkdir -p $OVERLAY_PATH
mkdir -p $OVERLAY_PATH/assets/lib/couch/
cp -Rdp /data/data/%app_name%/couchdb/lib/couchdb/erlang/lib/couch-1.2.0a-361a925-git/ebin $OVERLAY_PATH/assets/lib/couch/ebin
mkdir -p $OVERLAY_PATH/assets/lib/crypto-2.0.3/
cp -Rdp patches/crypto/crypto-2.0.3/ebin $OVERLAY_PATH/assets/lib/crypto-2.0.3/ebin
mkdir -p $OVERLAY_PATH/assets/lib/ejson-0.1.0/
cp -Rdp /data/data/%app_name%/couchdb/lib/couchdb/erlang/lib/ejson-0.1.0/ebin $OVERLAY_PATH/assets/lib/ejson-0.1.0/ebin
mkdir -p $OVERLAY_PATH/assets/lib/erlang-oauth/
cp -Rdp /data/data/%app_name%/couchdb/lib/couchdb/erlang/lib/erlang-oauth/ebin $OVERLAY_PATH/assets/lib/erlang-oauth/ebin
mkdir -p $OVERLAY_PATH/assets/lib/ibrowse-2.2.0/
cp -Rdp /data/data/%app_name%/couchdb/lib/couchdb/erlang/lib/ibrowse-2.2.0/ebin $OVERLAY_PATH/assets/lib/ibrowse-2.2.0/ebin
mkdir -p $OVERLAY_PATH/assets/lib/inets-5.7/ebin
cp -Rdp build/deps/otp_rel.package/otp_rel/lib/inets-5.7/ebin/httpd_util.beam $OVERLAY_PATH/assets/lib/inets-5.7/ebin
cp -Rdp build/deps/otp_rel.package/otp_rel/lib/inets-5.7/ebin/inets.app $OVERLAY_PATH/assets/lib/inets-5.7/ebin
mkdir -p $OVERLAY_PATH/assets/lib/kernel-2.14.5/
cp -Rdp build/deps/otp_rel.package/otp_rel/lib/kernel-2.14.5/ebin $OVERLAY_PATH/assets/lib/kernel-2.14.5/ebin
mkdir -p $OVERLAY_PATH/assets/lib/mochiweb-1.4.1/
cp -Rdp /data/data/%app_name%/couchdb/lib/couchdb/erlang/lib/mochiweb-1.4.1/ebin $OVERLAY_PATH/assets/lib/mochiweb-1.4.1/ebin
mkdir -p $OVERLAY_PATH/assets/lib/os_mon-2.2.6/
cp -Rdp build/deps/otp_rel.package/otp_rel/lib/os_mon-2.2.6/ebin $OVERLAY_PATH/assets/lib/os_mon-2.2.6/ebin
mkdir -p $OVERLAY_PATH/assets/lib/public_key-0.12/
cp -Rdp build/deps/otp_rel.package/otp_rel/lib/public_key-0.12/ebin $OVERLAY_PATH/assets/lib/public_key-0.12/ebin
mkdir -p $OVERLAY_PATH/assets/lib/sasl-2.1.9.4/
cp -Rdp build/deps/otp_rel.package/otp_rel/lib/sasl-2.1.9.4/ebin $OVERLAY_PATH/assets/lib/sasl-2.1.9.4/ebin
mkdir -p $OVERLAY_PATH/assets/lib/snappy-1.0.3/
cp -Rdp /data/data/%app_name%/couchdb/lib/couchdb/erlang/lib/snappy-1.0.3/ebin $OVERLAY_PATH/assets/lib/snappy-1.0.3/ebin
mkdir -p $OVERLAY_PATH/assets/lib/ssl-4.1.6/
cp -Rdp patches/crypto/ssl-4.1.6/ebin $OVERLAY_PATH/assets/lib/ssl-4.1.6/ebin
mkdir -p $OVERLAY_PATH/assets/lib/stdlib-1.17.5/
cp -Rdp build/deps/otp_rel.package/otp_rel/lib/stdlib-1.17.5/ebin $OVERLAY_PATH/assets/lib/stdlib-1.17.5/ebin
mkdir -p $OVERLAY_PATH/assets/lib/xmerl-1.2.9/ebin/
cp -Rdp build/deps/otp_rel.package/otp_rel/lib/xmerl-1.2.9/ebin/xmerl_ucs.beam $OVERLAY_PATH/assets/lib/xmerl-1.2.9/ebin/xmerl_ucs.beam

# Geocouch
mkdir -p $OVERLAY_PATH/assets/lib/geocouch
cp $GEOCOUCH_HOME/build/*.beam $OVERLAY_PATH/assets/lib/geocouch

#libs
mkdir -p $OVERLAY_PATH/libs/armeabi
cp -Rdp build/deps/otp_rel.package/otp_rel/erts-5.8.5/bin/libbeam.so $OVERLAY_PATH/libs/armeabi
cp -Rdp patches/crypto/libcrypto_nif.so $OVERLAY_PATH/libs/armeabi
cp -Rdp build/deps/mozilla-current/mozilla-central/js/src/libmozjs.so $OVERLAY_PATH/libs/armeabi

# Strip beam files of debugging symbols
$ERL_HOME/bootstrap/bin/erl -eval "erlang:display(beam_lib:strip_release(\"$OVERLAY_PATH/assets\"))" -s init stop

##
# Archive the overlay
#
cd $OVERLAY_PATH
OVERLAY_FILE=overlay-$1-$BUILD_VERSION.zip
zip -r ../$OVERLAY_FILE *
cd ..

cd $COUCH_ANDROID_HOME
31 changes: 31 additions & 0 deletions patches/crypto/crypto-2.0.3/ebin/crypto.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%%
%% %CopyrightEnd%
%%
{application, crypto,
[{description, "CRYPTO version 2"},
{vsn, "2.0.3"},
{modules, [crypto,
crypto_app,
crypto_sup,
crypto_server]},
{registered, [crypto_sup, crypto_server]},
{applications, [kernel, stdlib]},
{env, []},
{mod, {crypto_app, []}}]}.


22 changes: 22 additions & 0 deletions patches/crypto/crypto-2.0.3/ebin/crypto.appup
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 1999-2009. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%%
%% %CopyrightEnd%
%%
{"2.0.3",
[],
[]
}.
Binary file added patches/crypto/crypto-2.0.3/ebin/crypto.beam
Binary file not shown.
Binary file added patches/crypto/crypto-2.0.3/ebin/crypto_app.beam
Binary file not shown.
Binary file added patches/crypto/crypto-2.0.3/ebin/crypto_server.beam
Binary file not shown.
Binary file added patches/crypto/crypto-2.0.3/ebin/crypto_sup.beam
Binary file not shown.
Binary file added patches/crypto/libcrypto_nif.so
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/inet_ssl_dist.beam
Binary file not shown.
36 changes: 36 additions & 0 deletions patches/crypto/ssl-4.1.6/ebin/ssl.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{application, ssl,
[{description, "Erlang/OTP SSL application"},
{vsn, "4.1.6"},
{modules, [ssl,
ssl_app,
ssl_sup,
ssl_server,
ssl_broker,
ssl_broker_sup,
ssl_prim,
inet_ssl_dist,
ssl_tls1,
ssl_ssl3,
ssl_ssl2,
ssl_session,
ssl_session_cache_api,
ssl_session_cache,
ssl_record,
ssl_manager,
ssl_handshake,
ssl_debug,
ssl_connection_sup,
ssl_connection,
ssl_cipher,
ssl_certificate_db,
ssl_certificate,
ssl_alert
]},
{registered, [ssl_sup, ssl_server, ssl_broker_sup]},
{applications, [crypto, public_key, kernel, stdlib]},
{env, []},
{mod, {ssl_app, []}}]}.




21 changes: 21 additions & 0 deletions patches/crypto/ssl-4.1.6/ebin/ssl.appup
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
%% -*- erlang -*-
{"4.1.6",
[
{"4.1.5", [{restart_application, ssl}]},
{"4.1.4", [{restart_application, ssl}]},
{"4.1.3", [{restart_application, ssl}]},
{"4.1.2", [{restart_application, ssl}]},
{"4.1.1", [{restart_application, ssl}]},
{"4.1", [{restart_application, ssl}]},
{"4.0.1", [{restart_application, ssl}]}
],
[
{"4.1.5", [{restart_application, ssl}]},
{"4.1.4", [{restart_application, ssl}]},
{"4.1.3", [{restart_application, ssl}]},
{"4.1.2", [{restart_application, ssl}]},
{"4.1.1", [{restart_application, ssl}]},
{"4.1", [{restart_application, ssl}]},
{"4.0.1", [{restart_application, ssl}]}
]}.

Binary file added patches/crypto/ssl-4.1.6/ebin/ssl.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_alert.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_app.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_broker.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_broker_sup.beam
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_cipher.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_connection.beam
Binary file not shown.
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_debug.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_handshake.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_manager.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_prim.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_record.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_server.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_session.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_session_cache.beam
Binary file not shown.
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_ssl2.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_ssl3.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_sup.beam
Binary file not shown.
Binary file added patches/crypto/ssl-4.1.6/ebin/ssl_tls1.beam
Binary file not shown.
6 changes: 3 additions & 3 deletions patches/release.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff -ruN release.bak/couchdb/lib/couchdb/erlang/lib/couch/priv/couchspawnkillable release/couchdb/lib/couchdb/erlang/lib/couch/priv/couchspawnkillable
--- release.bak/couchdb/lib/couchdb/erlang/lib/couch/priv/couchspawnkillable 2011-02-05 01:26:00.000000000 -0700
+++ release/couchdb/lib/couchdb/erlang/lib/couch/priv/couchspawnkillable 2011-02-05 01:48:49.000000000 -0700
diff -ruN release.bak/couchspawnkillable release/couch/priv/couchspawnkillable
--- release.bak/couchspawnkillable 2011-02-05 01:26:00.000000000 -0700
+++ release/couchspawnkillable 2011-02-05 01:48:49.000000000 -0700
@@ -1,4 +1,4 @@
-#! /bin/sh -e
+#!/system/bin/sh -e
Expand Down
1 change: 1 addition & 0 deletions patches/script2boot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../../erlang/bootstrap/bin/erl -eval 'systools:script2boot("start").' -s init stop
Loading

0 comments on commit 8f138e3

Please sign in to comment.