forked from onepaylabs/react-native-fast-crypto
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild-deps
executable file
·63 lines (53 loc) · 1.72 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
#!/bin/bash
set -u
set -e
echo Build Started
date
# 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:
touch native-libs/deps/recipes/nativecrypto/nativecrypto.recipe
(
targets=""
targets="$targets nativecrypto.package-ios-universal"
targets="$targets nativecrypto.build-android-arm"
targets="$targets nativecrypto.build-android-arm64"
targets="$targets nativecrypto.build-android-x86"
targets="$targets nativecrypto.build-android-x86_64"
cd native-libs/deps
make $targets $@
)
# Copy the results locally:
mkdir -m 0775 -p ios/Headers
mkdir -m 0775 -p ios/Libraries
cp -aL $BUILD_DIR/nativecrypto/nativecrypto-ios-universal/include/* ios/Headers
cp -a $BUILD_DIR/nativecrypto/nativecrypto-ios-universal/lib/* ios/Libraries
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/includes
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 & fix header:
cp native-libs/src/native-crypto.h $JNI_BUILD_DIR/includes
sed -e 's/const char *\*/const char *const /' $JNI_BUILD_DIR/includes/native-crypto.h \
> $JNI_BUILD_DIR/includes/native-crypto-const.h
# 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/
}
copy_so arm armeabi-v7a
copy_so arm64 arm64-v8a
copy_so x86 x86
copy_so x86_64 x86_64
echo Build Finished
date