forked from EdgeApp/react-native-fast-crypto
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild-deps
executable file
·101 lines (81 loc) · 2.49 KB
/
build-deps
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
#!/bin/bash
export ZERO_AR_DATE=1
export SOURCE_DATE_EPOCH=0
NATIVE_TESTS=$NATIVE_TESTS
# List of dependencies that should be rebuilt.
# If you specify dependency source that doesn't change (local directory)
# add this dependency there so new files are copied during a build.
reactive_deps=(
nativecrypto
jni-bridge
)
set -u
set -e
echo Build Started
date
if [ Darwin = $(uname -s) ]; then
MACOSV=$(sw_vers -productVersion)
XCODEV=$(xcodebuild -version)
echo "macOS $MACOSV - $XCODEV"
fi
# Pick up the current directory:
CURRENT_DIR=$(pwd)
export BUILD_DIR=$CURRENT_DIR/native-libs/deps/build
#if [ -z ${BUILD_DIR+x} ]; then
# export BUILD_DIR=${BUILD_DIR:-$CURRENT_DIR/native-libs/deps/build};
#fi
# Do the build:
for dep in "${reactive_deps[@]}"; do
touch native-libs/deps/recipes/$dep/$dep.recipe
done
(
targets=""
if [[ "$NATIVE_TESTS" -eq "1" ]]; then
targets="$targets nativecrypto.build-native"
else
if [ Darwin = $(uname -s) ]; then
targets="$targets nativecrypto.package-ios-universal"
fi
targets="$targets jni-bridge.build-android-arm"
targets="$targets jni-bridge.build-android-arm64"
targets="$targets jni-bridge.build-android-x86"
targets="$targets jni-bridge.build-android-x86_64"
fi
cd native-libs/deps
make $targets $@
)
if [[ "$NATIVE_TESTS" -eq "1" ]]; then
cd native-libs
make check V=1 T=1
echo "Finished running tests."
exit 0
fi
# Copy the results locally:
if [ Darwin = $(uname -s) ]; then
mkdir -m 0775 -p ios/Headers
mkdir -m 0775 -p ios/Frameworks
cp -aL $BUILD_DIR/nativecrypto/nativecrypto-ios-universal/include/* ios/Headers
cp -a $BUILD_DIR/nativecrypto/nativecrypto-ios-universal/*.xcframework ios/Frameworks
fi
BASE="./android"
JNI_DIR="$BASE/jni"
JNI_BUILD_DIR="$JNI_DIR/libs"
ANDROID_PATH="$BASE/src/main"
rm -rf $JNI_BUILD_DIR
mkdir -p $JNI_BUILD_DIR/armeabi-v7a
mkdir -p $JNI_BUILD_DIR/arm64-v8a
mkdir -p $JNI_BUILD_DIR/x86
mkdir -p $JNI_BUILD_DIR/x86_64
# Copy Android libraries:
copy_so() {
echo cp $BUILD_DIR/nativecrypto/android-$1/libnativecrypto.so $JNI_BUILD_DIR/$2/
cp $BUILD_DIR/nativecrypto/android-$1/libnativecrypto.so $JNI_BUILD_DIR/$2/
echo cp $BUILD_DIR/jni-bridge/android-$1/build/libcrypto_bridge.so $JNI_BUILD_DIR/$2/
cp $BUILD_DIR/jni-bridge/android-$1/build/libcrypto_bridge.so $JNI_BUILD_DIR/$2/
}
copy_so arm armeabi-v7a
copy_so arm64 arm64-v8a
copy_so x86 x86
copy_so x86_64 x86_64
echo Build Finished
date