forked from couchbaselabs/Android-Couchbase-SourceBuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.openssl
executable file
·57 lines (41 loc) · 2.73 KB
/
build.openssl
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
#!/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
mkdir -p $COUCH_ANDROID_HOME/build/deps/openssl
cd $COUCH_ANDROID_HOME/build/deps/openssl
[[ -f android-platform_external_openssl.tar.gz ]] || wget -O android-platform_external_openssl.tar.gz https://github.com/android/platform_external_openssl/tarball/android-sdk-tools_r12
tar -zxf android-platform_external_openssl.tar.gz
ln -s android-platform_external_openssl-* android-platform_external_openssl
# now get patches to build with NDK
[[ -f guardianproject-openssl-android.tar.gz ]] || wget -O guardianproject-openssl-android.tar.gz https://github.com/guardianproject/openssl-android/tarball/master
tar -zxf guardianproject-openssl-android.tar.gz
ln -s guardianproject-openssl-android-* guardianproject-openssl-android
# copy files and apply patches
touch android-platform_external_openssl/AndroidManifest.xml
cp guardianproject-openssl-android/default.properties android-platform_external_openssl
cp guardianproject-openssl-android/openssl.config android-platform_external_openssl
mkdir android-platform_external_openssl/jni
cp guardianproject-openssl-android/jni/Application.mk android-platform_external_openssl/jni/
cp guardianproject-openssl-android/apps/Android.mk android-platform_external_openssl/apps/Android.mk
cp guardianproject-openssl-android/crypto/Android.mk android-platform_external_openssl/crypto/Android.mk
cp guardianproject-openssl-android/ssl/Android.mk android-platform_external_openssl/ssl/Android.mk
#rename some files
mv android-platform_external_openssl/crypto/aes/asm/aes-armv4.s android-platform_external_openssl/crypto/aes/asm/aes-armv4.S
mv android-platform_external_openssl/crypto/bn/asm/armv4-mont.s android-platform_external_openssl/crypto/bn/asm/armv4-mont.S
mv android-platform_external_openssl/crypto/bn/asm/mips3.s android-platform_external_openssl/crypto/bn/asm/mips3.S
mv android-platform_external_openssl/crypto/bn/asm/pa-risc2.s android-platform_external_openssl/crypto/bn/asm/pa-risc2.S
mv android-platform_external_openssl/crypto/bn/asm/pa-risc2W.s android-platform_external_openssl/crypto/bn/asm/pa-risc2W.S
mv android-platform_external_openssl/crypto/sha/asm/sha1-armv4-large.s android-platform_external_openssl/crypto/sha/asm/sha1-armv4-large.S
mv android-platform_external_openssl/crypto/sha/asm/sha256-armv4.s android-platform_external_openssl/crypto/sha/asm/sha256-armv4.S
mv android-platform_external_openssl/crypto/sha/asm/sha512-armv4.s android-platform_external_openssl/crypto/sha/asm/sha512-armv4.S
cd android-platform_external_openssl
$ANDROID_NDK_ROOT/ndk-build
# create a symbolic link to help erlang find the libs
ln -s libs/armeabi/ lib
LASTSTATUS=$?
exit $LASTSTATUS