forked from coronalabs/plugins-source-openssl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_sdk.sh
executable file
·130 lines (103 loc) · 3.15 KB
/
build_sdk.sh
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash
# This option is used to exit the script as
# soon as a command returns a non-zero value.
set -o errexit
path=`dirname $0`
BUILD_DIR=$1
PLUGIN_NAME=$2
PRODUCT=sdk
# Verify parameters.
if [ $# -ne 2 ]
then
echo Not enough parameters provided to: ${0}
exit 1
fi
#
# Canonicalize relative paths to absolute paths
#
pushd $path > /dev/null
dir=`pwd`
path=$dir
popd > /dev/null
#
# OUTPUT_DIR
#
OUTPUT_DIR=$BUILD_DIR/$PRODUCT
# Clean build
if [ -e "$OUTPUT_DIR" ]
then
rm -rf "$OUTPUT_DIR"
fi
# Plugins
OUTPUT_PLUGINS_DIR=$OUTPUT_DIR/plugins
OUTPUT_DIR_IOS=$OUTPUT_PLUGINS_DIR/iphone
OUTPUT_DIR_IOS_SIM=$OUTPUT_PLUGINS_DIR/iphone-sim
OUTPUT_DIR_MAC=$OUTPUT_PLUGINS_DIR/mac-sim
OUTPUT_DIR_ANDROID=$OUTPUT_PLUGINS_DIR/android
OUTPUT_DIR_WIN32=$OUTPUT_PLUGINS_DIR/win32-sim
# Docs
OUTPUT_DIR_DOCS=$OUTPUT_DIR/docs
# Samples
OUTPUT_DIR_SAMPLES=$OUTPUT_DIR/samples
# Create directories
mkdir "$OUTPUT_DIR"
mkdir -p "$OUTPUT_DIR_IOS"
mkdir -p "$OUTPUT_DIR_IOS_SIM"
mkdir -p "$OUTPUT_DIR_MAC"
mkdir -p "$OUTPUT_DIR_ANDROID"
mkdir -p "$OUTPUT_DIR_WIN32"
mkdir -p "$OUTPUT_DIR_SAMPLES"
#
# Build
#
echo "------------------------------------------------------------------------"
echo "[ios]"
cd "$path/ios"
./build.sh "$OUTPUT_DIR_IOS" $PLUGIN_NAME
cp -v metadata.lua "$OUTPUT_DIR_IOS"
cp -rv "$OUTPUT_DIR_IOS/" "$OUTPUT_DIR_IOS_SIM"
# Remove i386 from ios build
find "$OUTPUT_DIR_IOS" -name \*.a | xargs -n 1 -I % lipo -remove i386 % -output %
# Remove x86_64 from ios build
find "$OUTPUT_DIR_IOS" -name \*.a | xargs -n 1 -I % lipo -remove x86_64 % -output %
# Remove armv7 from ios-sim build
find "$OUTPUT_DIR_IOS_SIM" -name \*.a | xargs -n 1 -I % lipo -remove armv7 % -output %
# Remove arm64 from ios-sim build
find "$OUTPUT_DIR_IOS_SIM" -name \*.a | xargs -n 1 -I % lipo -remove arm64 % -output %
cd -
echo "------------------------------------------------------------------------"
echo "[mac]"
cd "$path/mac"
./build.sh "$OUTPUT_DIR_MAC" $PLUGIN_NAME
cd -
echo "------------------------------------------------------------------------"
echo "[android]"
cd "$path/android"
export OUTPUT_PLUGIN_DIR_ANDROID="$OUTPUT_DIR_ANDROID"
# The parameters of this build.sh are optional.
./build.sh
cp -v libs/armeabi-v7a/* "$OUTPUT_DIR_ANDROID"
cd -
echo "------------------------------------------------------------------------"
echo "[win32]"
cd "$path"
cp -v sdk-openssl/win32/bin/*.dll "$OUTPUT_DIR_WIN32"
cd -
echo "------------------------------------------------------------------------"
echo "[docs]"
cp -vrf "$path/docs" "$OUTPUT_DIR"
echo "------------------------------------------------------------------------"
echo "[samples]"
cp -vrf "$path/Corona/" "$OUTPUT_DIR_SAMPLES"
echo "------------------------------------------------------------------------"
echo "[metadata.json]"
cp -vrf "$path/metadata.json" "$OUTPUT_DIR"
echo "------------------------------------------------------------------------"
echo "Generating plugin zip"
ZIP_FILE=$BUILD_DIR/${PRODUCT}-${PLUGIN_NAME}.zip
cd "$OUTPUT_DIR"
zip -rv "$ZIP_FILE" *
cd -
echo "------------------------------------------------------------------------"
echo "Plugin build succeeded."
echo "Zip file located at: '$ZIP_FILE'"