forked from lyubo/react-native-sodium
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·77 lines (64 loc) · 1.71 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·77 lines (64 loc) · 1.71 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
sigfile=`ls -1 libsodium-*.tar.gz.sig`
srcfile=`basename $sigfile .sig`
srcdir=`basename $srcfile .tar.gz`
# --------------------------
# Download and verify source
# --------------------------
[ -f $srcfile ] && rm -f $srcfile
curl https://download.libsodium.org/libsodium/releases/$srcfile > $srcfile
gpg --no-default-keyring --keyring `pwd`/trusted.gpg --verify $sigfile $srcfile || exit 1
# --------------------------
# Extract sources
# --------------------------
[ -e $srcdir ] && rm -Rf $srcdir
tar -xzf $srcfile
cd $srcdir
targetPlatforms="$@"
[ "$targetPlatforms" ] || targetPlatforms="arm mips x86 ios"
for targetPlatform in $targetPlatforms
do
# --------------------------
# iOS build
# --------------------------
platform=`uname`
if [ "$platform" == 'Darwin' ] && [ "$targetPlatform" == 'ios' ]; then
IOS_VERSION_MIN=6.0 dist-build/ios.sh
fi
# --------------------------
# Android build
# --------------------------
case $targetPlatform in
"arm")
dist-build/android-arm.sh
dist-build/android-armv7-a.sh
dist-build/android-armv8-a.sh
;;
"mips")
dist-build/android-mips32.sh
dist-build/android-mips64.sh
;;
"x86")
dist-build/android-x86.sh
dist-build/android-x86_64.sh
;;
esac
done
cd ..
# --------------------------
# Move compiled libraries
# --------------------------
mkdir -p libsodium
rm -Rf libsodium/*
for dir in $srcdir/libsodium-android-*
do
mv $dir libsodium/
done
if [ "$platform" == 'Darwin' ] && [ -e $srcdir/libsodium-ios ]; then
mv $srcdir/libsodium-ios libsodium/
fi
# --------------------------
# Cleanup
# --------------------------
[ -e $srcdir ] && rm -Rf $srcdir
[ -e $srcfile ] && rm $srcfile