-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
make.sh
executable file
·85 lines (70 loc) · 2.06 KB
/
make.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
#!/bin/bash
# Copyright: Theodore H. Smith, 2020.
### conf ##
ANDROID="$2"
if [ "$ANDROID" == "" ]; then
ANDROID="/Developer/android-chain/bin"
fi
set -e #exit on error
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ORIG="$( pwd )"
### params ###
if [ "$1" == "android64" ] || [ "$1" == "android" ]; then
cpp="$ANDROID/aarch64-linux-android21-clang++"
ar="$ANDROID/aarch64-linux-android-ar"
plat="android64"
plat_exe_flags="-static -lc++_static"
elif [ "$1" == "android32" ]; then
cpp="$ANDROID/armv7a-linux-androideabi21-clang++"
ar="$ANDROID/arm-linux-androideabi-ar"
plat="android32"
plat_exe_flags="-static -lc++_static"
elif [ "$1" == "android_x64" ]; then
cpp="$ANDROID/x86_64-linux-android21-clang++"
ar="$ANDROID/x86_64-linux-android-ar"
plat="android_x64"
plat_exe_flags="-static -lc++_static"
elif [ "$1" == "android_i686" ]; then
cpp="$ANDROID/i686-linux-android21-clang++"
ar="$ANDROID/i686-linux-android-ar"
plat="android_i686"
plat_exe_flags="-static -lc++_static"
else
cpp="g++"
ar="ar"
INSTALL="/usr/local/bin/temporal"
plat="`uname`"
if [ "$plat" == "Darwin" ]; then
plat="MacOSX"
elif [ "$plat" == "" ]; then
plat="Native"
fi
fi
BUILD="build/${plat}"
RESULT="result/${plat}"
### START ###
echo "Building '${plat}'"
echo "Creating folders"
mkdir -p build
mkdir -p result
mkdir -p "$RESULT"
mkdir -p "$BUILD"
cd "$DIR/${BUILD}"
echo "Compiling in: $( pwd )"
$cpp -fPIC -std=c++0x -O0 -c "$DIR/Src/gen.cpp"
$cpp -fPIC -std=c++0x -Os -c "$DIR/Src/temporal.cpp"
$cpp -fPIC -std=c++0x -Os -c "$DIR/Src/lib.cpp"
cd ../..
echo "Linking in: $( pwd )"
$cpp -fPIC -pthread ${plat_exe_flags} ${BUILD}/gen.o ${BUILD}/temporal.o -o ${RESULT}/temporal
$ar rcs ${RESULT}/TemporalLib.a ${BUILD}/gen.o ${BUILD}/lib.o
cp Src/TemporalLib.h ${RESULT}/TemporalLib.h # lets be nice... friendly
echo ""
echo "Created Product at: $( pwd )/${RESULT}"
echo ""
### FINISH ###
cd "$ORIG"
if [ "$1" != "noinstall" ] && [ "$INSTALL" != "" ]; then
echo "Installing temporal at: ${INSTALL}"
sudo cp "${RESULT}/temporal" "$INSTALL"
fi