forked from ethereum/solidity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathosx_install_dependencies.sh
executable file
·137 lines (126 loc) · 4.91 KB
/
osx_install_dependencies.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#! /bin/bash
#------------------------------------------------------------------------------
# Bash script to install osx dependencies
#
# The documentation for solidity is hosted at:
#
# https://docs.soliditylang.org
#
# ------------------------------------------------------------------------------
# This file is part of solidity.
#
# solidity is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# solidity is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with solidity. If not, see <http://www.gnu.org/licenses/>
#
# (c) 2016-2019 solidity contributors.
# ------------------------------------------------------------------------------
# note that the following directories may be cached by circleci:
# - /usr/local
# - /opt/homebrew
set -eu
function validate_checksum {
local package="$1"
local expected_checksum="$2"
local actual_checksum
actual_checksum=$(sha256sum "$package")
if [[ $actual_checksum != "${expected_checksum} ${package}" ]]
then
>&2 echo "ERROR: Wrong checksum for package $package."
>&2 echo "Actual: $actual_checksum"
>&2 echo "Expected: $expected_checksum"
exit 1
fi
}
if [ ! -f /usr/local/lib/libz3.a ] # if this file does not exists (cache was not restored), rebuild dependencies
then
brew update
brew upgrade
brew install cmake
brew install wget
brew install coreutils
brew install diffutils
brew install grep
# JRE is required to run eldarica solver
brew install openjdk@11
brew install unzip
# writing to /usr/local/lib need administrative privileges.
sudo ./scripts/install_obsolete_jsoncpp_1_7_4.sh
# boost
boost_version="1.84.0"
boost_package="boost_${boost_version//./_}.tar.bz2"
boost_dir="boost_${boost_version//./_}"
wget "https://boostorg.jfrog.io/artifactory/main/release/$boost_version/source/$boost_package"
tar xf "$boost_package"
rm "$boost_package"
cd "$boost_dir"
./bootstrap.sh --with-toolset=clang --with-libraries=thread,system,filesystem,program_options,serialization,test
# the default number of jobs that b2 is taking, is the number of detected available CPU threads.
sudo ./b2 -a address-model=64 architecture=arm+x86 install
cd ..
sudo rm -rf "$boost_dir"
# eldarica
eldarica_version="2.1"
wget "https://github.com/uuverifiers/eldarica/releases/download/v${eldarica_version}/eldarica-bin-${eldarica_version}.zip" -O /tmp/eld_binaries.zip
validate_checksum /tmp/eld_binaries.zip 0ac43f45c0925383c9d2077f62bbb515fd792375f3b2b101b30c9e81dcd7785c
unzip /tmp/eld_binaries.zip -d /tmp
sudo mv /tmp/eldarica/{eld,eld-client,target,eldEnv} /usr/local/bin
rm -rf /tmp/{eldarica,eld_binaries.zip}
#cvc5
cvc5_version="1.1.2"
wget "https://github.com/cvc5/cvc5/releases/download/cvc5-${cvc5_version}/cvc5-macOS-arm64-static.zip" -O /tmp/cvc5.zip
validate_checksum /tmp/cvc5.zip 2017d683d924676cb713865c6d4fcf70115c65b7ec2848f242ab938902f115b5
unzip /tmp/cvc5.zip -x "cvc5-macOS-arm64-static/lib/cmake/*" -d /tmp
sudo mv /tmp/cvc5-macOS-arm64-static/bin/* /usr/local/bin
sudo mv /tmp/cvc5-macOS-arm64-static/include/* /usr/local/include
sudo mv /tmp/cvc5-macOS-arm64-static/lib/* /usr/local/lib
rm -rf /tmp/{cvc5-macOS-arm64-static,cvc5.zip}
# z3
z3_version="4.12.1"
z3_dir="z3-z3-$z3_version"
z3_package="z3-$z3_version.tar.gz"
wget "https://github.com/Z3Prover/z3/archive/refs/tags/$z3_package"
validate_checksum "$z3_package" a3735fabf00e1341adcc70394993c05fd3e2ae167a3e9bb46045e33084eb64a3
tar xf "$z3_package"
rm "$z3_package"
cd "$z3_dir"
mkdir build
cd build
cmake -DCMAKE_OSX_ARCHITECTURES:STRING="x86_64;arm64" -DZ3_BUILD_LIBZ3_SHARED=false ..
make -j
sudo make install
cd ../..
rm -rf "$z3_dir"
# evmone
evmone_version="0.11.0"
if [[ $(uname -m) == 'arm64' ]]
then
# evmone does not provide any builds for apple silicon yet. so lets just build it locally.
# be aware that we are only building the arm version here, we don't build a universal binary.
git clone https://github.com/ethereum/evmone.git
cd evmone
git checkout "v${evmone_version}"
git submodule update --init
cmake -S . -B build
cmake --build build
cd build
sudo make install
cd ../..
rm -rf evmone
else
evmone_package="evmone-${evmone_version}-darwin-x86_64.tar.gz"
wget "https://github.com/ethereum/evmone/releases/download/v${evmone_version}/${evmone_package}"
validate_checksum "$evmone_package" 83ed20676681d9a31bd30cac399ab7c615ccab8adb8087cc2c7e9cd22b4d2efc
tar xzpf "$evmone_package" -C /usr/local
rm "$evmone_package"
fi
fi