forked from EOSIO/eosio.exchange
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·47 lines (39 loc) · 1.73 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
#! /bin/bash
CONTRACT_NAME="eosio.exchange"
unamestr=`uname`
if [[ "${unamestr}" == 'Darwin' ]]; then
PREFIX=/usr/local
BOOST=/usr/local/include
else
PREFIX=~/opt
BOOST=~/opt/boost/include
fi
mkdir -p bin/${CONTRACT_NAME}
### BUILD THE CONTRACT
EOSCLANG="${PREFIX}/wasm/bin/clang++ -Iinclude -I/usr/local/include/libc++/upstream/include -I/usr/local/include/musl/upstream/include -I/usr/local/include -I${BOOST} "
LINK="${PREFIX}/wasm/bin/llvm-link -only-needed "
LLC="${PREFIX}/wasm/bin/llc -thread-model=single --asm-verbose=false"
S2W="/usr/local/bin/eosio-s2wasm "
W2W="/usr/local/bin/eosio-wast2wasm "
deps=()
exit 0
### Currently fails to build
#${EOSCLANG} -Iinclude -c -emit-llvm -O3 --std=c++14 --target=wasm32 -nostdinc -DBOOST_DISABLE_ASSERTS -DBOOST_EXCEPTION_DISABLE -nostdlib -nostdlibinc -ffreestanding -nostdlib -fno-threadsafe-statics -fno-rtti -fno-exceptions -o ${CONTRACT_NAME}.bc src/${CONTRACT_NAME}.cpp
#${LINK} -o linked.bc ${CONTRACT_NAME}.bc /usr/local/usr/share/eosio/contractsdk/lib/eosiolib.bc /usr/local/usr/share/eosio/contractsdk/lib/libc++.bc /usr/local/usr/share/eosio/contractsdk/lib/libc.bc
#${LLC} -o ${CONTRACT_NAME}.s linked.bc
#${S2W} -o ${CONTRACT_NAME}.wast -s 16384 ${CONTRACT_NAME}.s
#${W2W} ${CONTRACT_NAME}.wast bin/${CONTRACT_NAME}/${CONTRACT_NAME}.wasm -n
#cp abi/${CONTRACT_NAME}.abi bin/${CONTRACT_NAME}/${CONTRACT_NAME}.abi
for dep in "${deps[@]}"; do
echo ${dep}
pushd ./deps/${dep} &> /dev/null
./build.sh $1
popd &> /dev/null
done
if [[ "$1" == 'noinstall' ]]; then
rm ${CONTRACT_NAME}.bc linked.bc ${CONTRACT_NAME}.wast ${CONTRACT_NAME}.s
exit 0
fi
### INSTALL THE HEADERS
cp -r include/* /usr/local/include
rm ${CONTRACT_NAME}.bc linked.bc ${CONTRACT_NAME}.wast ${CONTRACT_NAME}.s