-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·102 lines (83 loc) · 2.33 KB
/
build.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
#!/usr/bin/env bash
##########################################################################
# This is EOS bootstrapper script for Linux and OS X.
# This file was downloaded from https://github.com/EOSIO/eos
# Feel free to change this file to fit your needs.
##########################################################################
VERSION=1.0
ulimit -u
# Define directories.
WORK_DIR=$PWD
BUILD_DIR=${WORK_DIR}/build
TEMP_DIR=/tmp
# Target architectures
ARCH=$1
TARGET_ARCHS="ubuntu darwin"
# Check ARCH
if [[ $# > 2 ]]; then
echo ""
echo "Error: too many arguments"
exit 1
fi
if [[ $# < 1 ]]; then
echo ""
echo "Usage: bash build.sh TARGET [full|build]"
echo ""
echo "Targets: $TARGET_ARCHS"
exit 1
fi
if [[ $ARCH =~ [[:space:]] || ! $TARGET_ARCHS =~ (^|[[:space:]])$ARCH([[:space:]]|$) ]]; then
echo ""
echo ">>> WRONG ARCHITECTURE \"$ARCH\""
exit 1
fi
if [ -z "$2" ]; then
INSTALL_DEPS=1
else
if [ "$2" == "full" ]; then
INSTALL_DEPS=1
elif [ "$2" == "build" ]; then
INSTALL_DEPS=0
else
echo ">>> WRONG mode use full or build"
exit 1
fi
fi
echo ""
echo ">>> ARCHITECTURE \"$ARCH\""
if [ $ARCH == "ubuntu" ]; then
BOOST_ROOT=${HOME}/opt/boost_1_64_0
BINARYEN_BIN=${HOME}/opt/binaryen/bin
OPENSSL_ROOT_DIR=/usr/local/opt/openssl
OPENSSL_LIBRARIES=/usr/local/opt/openssl/lib
WASM_LLVM_CONFIG=${HOME}/opt/wasm/bin/llvm-config
fi
if [ $ARCH == "darwin" ]; then
OPENSSL_ROOT_DIR=/usr/local/opt/openssl
OPENSSL_LIBRARIES=/usr/local/opt/openssl/lib
BINARYEN_BIN=/usr/local/binaryen/bin/
WASM_LLVM_CONFIG=/usr/local/wasm/bin/llvm-config
fi
# Debug flags
COMPILE_EOS=1
COMPILE_CONTRACTS=1
# Define default arguments.
CMAKE_BUILD_TYPE=RelWithDebugInfo
# Install dependencies
if [ ${INSTALL_DEPS} == "1" ]; then
echo ">> Install dependencies"
. ${WORK_DIR}/scripts/install_dependencies.sh
fi
# Create the build dir
cd ${WORK_DIR}
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
CXX_COMPILER=clang++-4.0
C_COMPILER=clang-4.0
if [ $ARCH == "darwin" ]; then
CXX_COMPILER=clang++
C_COMPILER=clang
fi
# Build EOS
cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DWASM_LLVM_CONFIG=${WASM_LLVM_CONFIG} -DBINARYEN_BIN=${BINARYEN_BIN} -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} -DOPENSSL_LIBRARIES=${OPENSSL_LIBRARIES} ..
make -j4