-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·121 lines (106 loc) · 4.1 KB
/
build.sh
File metadata and controls
executable file
·121 lines (106 loc) · 4.1 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#! /bin/bash
printf "\t=========== Building eosforce.cdt ===========\n\n"
RED='\033[0;31m'
NC='\033[0m'
txtbld=$(tput bold)
bldred=${txtbld}$(tput setaf 1)
txtrst=$(tput sgr0)
export DISK_MIN=10
export TEMP_DIR="/tmp"
TEMP_DIR='/tmp'
DISK_MIN=10
# Use current directory's tmp directory if noexec is enabled for /tmp
if (mount | grep "/tmp " | grep --quiet noexec); then
mkdir -p $SOURCE_DIR/tmp
TEMP_DIR="${SOURCE_DIR}/tmp"
rm -rf $SOURCE_DIR/tmp/*
else # noexec wasn't found
TEMP_DIR="/tmp"
fi
unamestr=`uname`
if [[ "${unamestr}" == 'Darwin' ]]; then
BOOST=/usr/local
CXX_COMPILER=g++
export ARCH="Darwin"
bash ./scripts/eosio_build_darwin.sh
else
OS_NAME=$( cat /etc/os-release | grep ^NAME | cut -d'=' -f2 | sed 's/\"//gI' )
case "$OS_NAME" in
"Amazon Linux AMI")
export ARCH="Amazon Linux AMI"
bash ./scripts/eosio_build_amazon.sh
;;
"CentOS Linux")
export ARCH="Centos"
export CMAKE=${HOME}/opt/cmake/bin/cmake
bash ./scripts/eosio_build_centos.sh
;;
"elementary OS")
export ARCH="elementary OS"
bash ./scripts/eosio_build_ubuntu.sh
;;
"Fedora")
export ARCH="Fedora"
bash ./scripts/eosio_build_fedora.sh
;;
"Linux Mint")
export ARCH="Linux Mint"
bash ./scripts/eosio_build_ubuntu.sh
;;
"Ubuntu")
export ARCH="Ubuntu"
bash ./scripts/eosio_build_ubuntu.sh
;;
"Debian GNU/Linux")
export ARCH="Debian"
bash ./scripts/eosio_build_ubuntu.sh
;;
*)
printf "\\n\\tUnsupported Linux Distribution. Exiting now.\\n\\n"
exit 1
esac
fi
if [[ `uname` == 'Darwin' ]]; then
FREE_MEM=`vm_stat | grep "Pages free:"`
read -ra FREE_MEM <<< "$FREE_MEM"
FREE_MEM=$((${FREE_MEM[2]%?}*(4096))) # free pages * page size
else
FREE_MEM=`LC_ALL=C free | grep "Mem:" | awk '{print $4}'`
fi
CORES_AVAIL=`getconf _NPROCESSORS_ONLN`
MEM_CORES=$(( ${FREE_MEM}/4000000 )) # 4 gigabytes per core
MEM_CORES=$(( $MEM_CORES > 0 ? $MEM_CORES : 1 ))
CORES=$(( $CORES_AVAIL < $MEM_CORES ? $CORES_AVAIL : $MEM_CORES ))
#check submodules
if [ $(( $(git submodule status --recursive | grep -c "^[+\-]") )) -gt 0 ]; then
printf "\\n\\tgit submodules are not up to date.\\n"
printf "\\tPlease run the command 'git submodule update --init --recursive'.\\n"
exit 1
fi
mkdir -p build
pushd build &> /dev/null
if [ -z "$CMAKE" ]; then
CMAKE=$( command -v cmake )
fi
"$CMAKE" -DCMAKE_INSTALL_PREFIX=/usr/local/eosforce.cdt ../
if [ $? -ne 0 ]; then
exit -1;
fi
make -j${CORES}
if [ $? -ne 0 ]; then
exit -1;
fi
popd &> /dev/null
printf "\n${bldred}\t ___ ___ ___ ___ ___ ___ ___ ___ \n"
printf "\t /\ \ /\ \ /\ \ /\ \ /\ \ /\ \ /\ \ /\ \ \n"
printf "\t /::\ \ /::\ \ /::\ \ /::\ \ /::\ \ /::\ \ /::\ \ /::\ \ \n"
printf "\t /:/\:\ \ /:/\:\ \ /:/\ \ \ /:/\:\ \ /:/\:\ \ /:/\:\ \ /:/\:\ \ /:/\:\ \ \n"
printf "\t /::\~\:\ \ /:/ \:\ \ _\:\~\ \ \ /::\~\:\ \ /:/ \:\ \ /::\~\:\ \ /:/ \:\ \ /::\~\:\ \ \n"
printf "\t /:/\:\ \:\__\ /:/__/ \:\__\ /\ \:\ \ \__\ /:/\:\ \:\__\ /:/__/ \:\__\ /:/\:\ \:\__\ /:/__/ \:\__\ /:/\:\ \:\__\\n"
printf "\t \:\~\:\ \/__/ \:\ \ /:/ / \:\ \:\ \/__/ \/__\:\ \/__/ \:\ \ /:/ / \/_|::\/:/ / \:\ \ \/__/ \:\~\:\ \/__/\n"
printf "\t \:\ \:\__\ \:\ /:/ / \:\ \:\__\ \:\__\ \:\ /:/ / |:|::/ / \:\ \ \:\ \:\__\ \n"
printf "\t \:\ \/__/ \:\/:/ / \:\/:/ / \/__/ \:\/:/ / |:|\/__/ \:\ \ \:\ \/__/ \n"
printf "\t \:\__\ \::/ / \::/ / \::/ / |:| | \:\__\ \:\__\ \n"
printf "\t \/__/ \/__/ \/__/ \/__/ \|__| \/__/ \/__/ \n${txtrst}"
printf "\\tFor more information:\\n"
printf "\\tEOSIO website: https://eosforce.io\\n"