forked from ethereum/solidity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_deps.sh
executable file
·409 lines (360 loc) · 16.8 KB
/
install_deps.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
#!/usr/bin/env sh
#------------------------------------------------------------------------------
# Shell script for installing pre-requisite packages for solidity on a
# variety of Linux and other UNIX-derived platforms.
#
# This is an "infrastucture-as-code" alternative to the manual build
# instructions pages which we previously maintained at:
# http://solidity.readthedocs.io/en/latest/installing-solidity.html
#
# The aim of this script is to simplify things down to the following basic
# flow for all supported operating systems:
#
# - git clone --recursive
# - ./scripts/install_deps.sh
# - cmake && make
#
# TODO - There is no support here yet for cross-builds in any form, only
# native builds. Expanding the functionality here to cover the mobile,
# wearable and SBC platforms covered by doublethink and EthEmbedded would
# also bring in support for Android, iOS, watchOS, tvOS, Tizen, Sailfish,
# Maemo, MeeGo and Yocto.
#
# The documentation for solidity is hosted at:
#
# http://solidity.readthedocs.io/
#
# ------------------------------------------------------------------------------
# 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 solidity contributors.
#------------------------------------------------------------------------------
set -e
# Check for 'uname' and abort if it is not available.
uname -v > /dev/null 2>&1 || { echo >&2 "ERROR - solidity requires 'uname' to identify the platform."; exit 1; }
# See http://unix.stackexchange.com/questions/92199/how-can-i-reliably-get-the-operating-systems-name
detect_linux_distro() {
if [ $(command -v lsb_release) ]; then
DISTRO=$(lsb_release -is)
elif [ -f /etc/os-release ]; then
# extract 'foo' from NAME=foo, only on the line with NAME=foo
DISTRO=$(sed -n -e 's/^NAME="\(.*\)\"/\1/p' /etc/os-release)
elif [ -f /etc/centos-release ]; then
DISTRO=CentOS
else
DISTRO=''
fi
echo $DISTRO
}
case $(uname -s) in
#------------------------------------------------------------------------------
# macOS
#------------------------------------------------------------------------------
Darwin)
case $(sw_vers -productVersion | awk -F . '{print $1"."$2}') in
10.9)
echo "Installing solidity dependencies on OS X 10.9 Mavericks."
;;
10.10)
echo "Installing solidity dependencies on OS X 10.10 Yosemite."
;;
10.11)
echo "Installing solidity dependencies on OS X 10.11 El Capitan."
;;
10.12)
echo "Installing solidity dependencies on macOS 10.12 Sierra."
;;
*)
echo "Unsupported macOS version."
echo "We only support Mavericks, Yosemite and El Capitan, with work-in-progress on Sierra."
exit 1
;;
esac
# Check for Homebrew install and abort if it is not installed.
brew -v > /dev/null 2>&1 || { echo >&2 "ERROR - solidity requires a Homebrew install. See http://brew.sh."; exit 1; }
brew update
brew install boost
brew install cmake
if [ "$CI" = true ]; then
brew upgrade cmake
brew tap ethereum/ethereum
brew install cpp-ethereum
brew linkapps cpp-ethereum
else
brew upgrade
fi
;;
#------------------------------------------------------------------------------
# FreeBSD
#------------------------------------------------------------------------------
FreeBSD)
echo "Installing solidity dependencies on FreeBSD."
echo "ERROR - 'install_deps.sh' doesn't have FreeBSD support yet."
echo "Please let us know if you see this error message, and we can work out what is missing."
echo "Drop us a message at https://gitter.im/ethereum/solidity-dev."
exit 1
;;
#------------------------------------------------------------------------------
# Linux
#------------------------------------------------------------------------------
Linux)
case $(detect_linux_distro) in
#------------------------------------------------------------------------------
# Arch Linux
#------------------------------------------------------------------------------
Arch)
#Arch
echo "Installing solidity dependencies on Arch Linux."
# All our dependencies can be found in the Arch Linux official repositories.
# See https://wiki.archlinux.org/index.php/Official_repositories
# Also adding ethereum-git to allow for testing with the `eth` client
sudo pacman -Sy \
base-devel \
boost \
cmake \
git \
ethereum-git \
;;
#------------------------------------------------------------------------------
# Alpine Linux
#------------------------------------------------------------------------------
"Alpine Linux")
#Alpine
echo "Installing solidity dependencies on Alpine Linux."
# All our dependencies can be found in the Alpine Linux official repositories.
# See https://pkgs.alpinelinux.org/
apk update
apk add boost-dev build-base cmake
;;
#------------------------------------------------------------------------------
# Debian
#------------------------------------------------------------------------------
Debian)
#Debian
install_z3=""
case $(lsb_release -cs) in
wheezy)
#wheezy
echo "Installing solidity dependencies on Debian Wheezy (7.x)."
echo "ERROR - 'install_deps.sh' doesn't have Debian Wheezy support yet."
echo "See http://solidity.readthedocs.io/en/latest/installing-solidity.html for manual instructions."
echo "If you would like to get 'install_deps.sh' working for Debian Wheezy, that would be fantastic."
echo "Drop us a message at https://gitter.im/ethereum/solidity-dev."
echo "See also https://github.com/ethereum/webthree-umbrella/issues/495 where we are working through Alpine support."
exit 1
;;
jessie)
#jessie
echo "Installing solidity dependencies on Debian Jesse (8.x)."
;;
stretch)
#stretch
echo "Installing solidity dependencies on Debian Stretch (9.x)."
install_z3="libz3-dev"
;;
buster)
#buster
echo "Installing solidity dependencies on Debian Buster (10.x)."
install_z3="libz3-dev"
;;
*)
#other Debian
echo "Installing solidity dependencies on unknown Debian version."
echo "ERROR - This might not work, but we are trying anyway."
echo "Drop us a message at https://gitter.im/ethereum/solidity-dev"
install_z3="libz3-dev"
;;
esac
# Install "normal packages"
sudo apt-get -y update
sudo apt-get -y install \
build-essential \
cmake \
g++ \
gcc \
git \
libboost-all-dev \
unzip \
"$install_z3"
;;
#------------------------------------------------------------------------------
# Fedora
#------------------------------------------------------------------------------
Fedora)
#Fedora
echo "Installing solidity dependencies on Fedora."
# Install "normal packages"
# See https://fedoraproject.org/wiki/Package_management_system.
dnf install \
autoconf \
automake \
boost-devel \
boost-static \
cmake \
gcc \
gcc-c++ \
git \
libtool
;;
#------------------------------------------------------------------------------
# OpenSUSE
#------------------------------------------------------------------------------
"openSUSE project")
#openSUSE
echo "Installing solidity dependencies on openSUSE."
echo "ERROR - 'install_deps.sh' doesn't have openSUSE support yet."
echo "See http://solidity.readthedocs.io/en/latest/installing-solidity.html for manual instructions."
echo "If you would like to get 'install_deps.sh' working for openSUSE, that would be fantastic."
echo "See https://github.com/ethereum/webthree-umbrella/issues/552."
exit 1
;;
#------------------------------------------------------------------------------
# Ubuntu
#
#------------------------------------------------------------------------------
Ubuntu)
#Ubuntu
install_z3=""
case $(lsb_release -cs) in
trusty)
#trusty
echo "Installing solidity dependencies on Ubuntu Trusty Tahr (14.04)."
;;
utopic)
#utopic
echo "Installing solidity dependencies on Ubuntu Utopic Unicorn (14.10)."
;;
vivid)
#vivid
echo "Installing solidity dependencies on Ubuntu Vivid Vervet (15.04)."
;;
wily)
#wily
echo "Installing solidity dependencies on Ubuntu Wily Werewolf (15.10)."
;;
xenial)
#xenial
echo "Installing solidity dependencies on Ubuntu Xenial Xerus (16.04)."
install_z3="libz3-dev"
;;
yakkety)
#yakkety
echo "Installing solidity dependencies on Ubuntu Yakkety Yak (16.10)."
install_z3="libz3-dev"
;;
zesty)
#zesty
echo "Installing solidity dependencies on Ubuntu Zesty (17.04)."
install_z3="libz3-dev"
;;
artful)
#artful
echo "Installing solidity dependencies on Ubuntu Artful (17.10)."
install_z3="libz3-dev"
;;
*)
#other Ubuntu
echo "ERROR - Unknown or unsupported Ubuntu version (" $(lsb_release -cs) ")"
echo "ERROR - This might not work, but we are trying anyway."
echo "Please drop us a message at https://gitter.im/ethereum/solidity-dev."
echo "We only support Trusty, Utopic, Vivid, Wily, Xenial, Yakkety, Zesty and Artful."
install_z3="libz3-dev"
;;
esac
sudo apt-get -y update
sudo apt-get -y install \
build-essential \
cmake \
git \
libboost-all-dev \
"$install_z3"
if [ "$CI" = true ]; then
# install Z3 from PPA if the distribution does not provide it
if ! dpkg -l libz3-dev > /dev/null 2>&1
then
sudo apt-add-repository -y ppa:hvr/z3
sudo apt-get -y update
sudo apt-get -y install libz3-dev
fi
# Install 'eth', for use in the Solidity Tests-over-IPC.
# We will not use this 'eth', but its dependencies
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
sudo apt-get -y update
sudo apt-get -y install eth
fi
;;
#------------------------------------------------------------------------------
# CentOS
# CentOS needs some more testing. This is the general idea of packages
# needed, but some tweaking/improvements can definitely happen
#------------------------------------------------------------------------------
CentOS)
read -p "This script will heavily modify your system in order to allow for compilation of Solidity. Are you sure? [Y/N]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Make Sure we have the EPEL repos
sudo yum -y install epel-release
# Get g++ 4.8
sudo rpm --import http://ftp.scientificlinux.org/linux/scientific/5x/x86_64/RPM-GPG-KEYs/RPM-GPG-KEY-cern
wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
sudo yum -y install devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils
# Enable the devtoolset2 usage so global gcc/g++ become the 4.8 one.
# As per https://gist.github.com/stephenturner/e3bc5cfacc2dc67eca8b, what you should do afterwards is
# to add this line:
# source /opt/rh/devtoolset-2/enable
# to your bashrc so that this happens automatically at login
scl enable devtoolset-2 bash
# Get cmake
sudo yum -y remove cmake
sudo yum -y install cmake3
sudo ln -s /usr/bin/cmake3 /usr/bin/cmake
# Get latest boost thanks to this guy: http://vicendominguez.blogspot.de/2014/04/boost-c-library-rpm-packages-for-centos.html
sudo yum -y remove boost-devel
sudo wget http://repo.enetres.net/enetres.repo -O /etc/yum.repos.d/enetres.repo
sudo yum install boost-devel
else
echo "Aborted CentOS Solidity Dependency Installation";
exit 1
fi
;;
*)
#------------------------------------------------------------------------------
# Other (unknown) Linux
# Major and medium distros which we are missing would include Mint, CentOS,
# RHEL, Raspbian, Cygwin, OpenWrt, gNewSense, Trisquel and SteamOS.
#------------------------------------------------------------------------------
#other Linux
echo "ERROR - Unsupported or unidentified Linux distro."
echo "See http://solidity.readthedocs.io/en/latest/installing-solidity.html for manual instructions."
echo "If you would like to get your distro working, that would be fantastic."
echo "Drop us a message at https://gitter.im/ethereum/solidity-dev."
exit 1
;;
esac
;;
#------------------------------------------------------------------------------
# Other platform (not Linux, FreeBSD or macOS).
# Not sure what might end up here?
# Maybe OpenBSD, NetBSD, AIX, Solaris, HP-UX?
#------------------------------------------------------------------------------
*)
#other
echo "ERROR - Unsupported or unidentified operating system."
echo "See http://solidity.readthedocs.io/en/latest/installing-solidity.html for manual instructions."
echo "If you would like to get your operating system working, that would be fantastic."
echo "Drop us a message at https://gitter.im/ethereum/solidity-dev."
;;
esac