diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build_emscripten.sh | 34 | ||||
-rw-r--r-- | scripts/docs.sh | 33 | ||||
-rwxr-xr-x | scripts/fix_homebrew_paths_in_standalone_zip.py | 65 | ||||
-rw-r--r-- | scripts/install_deps.bat | 61 | ||||
-rwxr-xr-x | scripts/install_deps.sh | 363 | ||||
-rw-r--r-- | scripts/release.bat | 34 | ||||
-rwxr-xr-x | scripts/release.sh | 92 | ||||
-rwxr-xr-x | scripts/tests.sh | 69 | ||||
-rwxr-xr-x | scripts/travis-emscripten/build_emscripten.sh | 130 | ||||
-rw-r--r-- | scripts/travis-emscripten/deploy_key.enc | bin | 0 -> 1680 bytes | |||
-rwxr-xr-x | scripts/travis-emscripten/install_deps.sh | 44 | ||||
-rwxr-xr-x | scripts/travis-emscripten/publish_binary.sh | 70 |
12 files changed, 995 insertions, 0 deletions
diff --git a/scripts/build_emscripten.sh b/scripts/build_emscripten.sh new file mode 100755 index 00000000..6046978e --- /dev/null +++ b/scripts/build_emscripten.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +#------------------------------------------------------------------------------ +# Bash script for building Solidity for emscripten. +# +# The documentation for solidity is hosted at: +# +# https://solidity.readthedocs.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 solidity contributors. +#------------------------------------------------------------------------------ + +set -e + +if [[ "$OSTYPE" != "darwin"* ]]; then + ./scripts/travis-emscripten/install_deps.sh + docker run -v $(pwd):/src trzeci/emscripten:sdk-tag-1.35.4-64bit ./scripts/travis-emscripten/build_emscripten.sh +fi diff --git a/scripts/docs.sh b/scripts/docs.sh new file mode 100644 index 00000000..a674373a --- /dev/null +++ b/scripts/docs.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +#------------------------------------------------------------------------------ +# Bash script to build the Solidity Sphinx documentation locally. +# +# The documentation for solidity is hosted at: +# +# https://solidity.readthedocs.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 solidity contributors. +#------------------------------------------------------------------------------ + +if [[ "$OSTYPE" == "darwin"* ]]; then + # We aren't building docs locally for macOS at the moment +else + cd docs && sphinx-build -nW -b html -d _build/doctrees . _build/html && cd .. +fi diff --git a/scripts/fix_homebrew_paths_in_standalone_zip.py b/scripts/fix_homebrew_paths_in_standalone_zip.py new file mode 100755 index 00000000..38aa9685 --- /dev/null +++ b/scripts/fix_homebrew_paths_in_standalone_zip.py @@ -0,0 +1,65 @@ +# ------------------------------------------------------------------------------ +# This Python script is used within the OS X release process, to ensure +# that the standalone OS X ZIP files which we make are actually +# standalone, and not implicitly dependent on Homebrew installs for +# external libraries which we use. +# +# This implicit dependencies seem to show up only where we have +# external dependencies which are dependent on each other, and the +# path from one to another is an absolute path to "/usr/local/opt", +# the Homebrew install location. External dependencies which only +# depend on system libraries are fine. Our main applications seem +# to be fine. +# +# An example of a dependency which requires this fix-up at the time +# of writing is the following dependency edge: +# +# libjsonrpccpp-client.0.dylib +# -> /usr/local/opt/jsoncpp/lib/libjsoncpp.0.dylib +# +# See https://blogs.oracle.com/dipol/entry/dynamic_libraries_rpath_and_mac +# for a little overview of "install_name_tool" and "otool". +# +# ------------------------------------------------------------------------------ +# 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. +# ----------------------------------------------------------------------------- + +import os +import subprocess +import sys + + +def readDependencies(fname): + with open(fname) as f: + o = subprocess.Popen(['otool', '-L', fname], stdout=subprocess.PIPE) + for line in o.stdout: + if line[0] == '\t': + library = line.split(' ', 1)[0][1:] + if library.startswith("/usr/local/lib") or library.startswith("/usr/local/opt") or library.startswith("/Users/"): + if (os.path.basename(library) != os.path.basename(fname)): + command = "install_name_tool -change " + \ + library + " @executable_path/./" + \ + os.path.basename(library) + " " + fname + print command + os.system("chmod +w " + fname) + os.system(command) + +root = sys.argv[1] +for (dirpath, dirnames, filenames) in os.walk(root): + for filename in filenames: + readDependencies(os.path.join(root, filename)) diff --git a/scripts/install_deps.bat b/scripts/install_deps.bat new file mode 100644 index 00000000..512a28df --- /dev/null +++ b/scripts/install_deps.bat @@ -0,0 +1,61 @@ +@ECHO OFF + +REM --------------------------------------------------------------------------- +REM Batch file for installing pre-requisite packages for solidity on +REM Windows platforms. That is implemented using CMake targets which +REM extract pre-built ZIPs hosted on GitHub into "deps\install_deps". +REM +REM See https://github.com/ethereum/cpp-dependencies +REM +REM The CMake files then point into that directory as an alternative +REM to the Homebrew, PPA or other global package server locations +REM available on Linux and UNIX platforms. +REM +REM The lack of a standard C++ packaging system for Windows is problematic +REM for us, and we have considered various options for improving the +REM situation, such as the following: +REM +REM See "Windows - Add support for Chocolatey packages" +REM https://github.com/ethereum/webthree-umbrella/issues/345 +REM +REM See "Windows - Try to use NuGet C++ packages" +REM https://github.com/ethereum/webthree-umbrella/issues/509 +REM +REM See "CM - Can we switch to NuGet delivery for our external dependencies" +REM https://github.com/ethereum/webthree-umbrella/issues/376 +REM +REM Another possible option, which would benefit build robustness on +REM multiple platforms, not just Windows, is to add dependencies as +REM git-submodules (or downloading on demand) so that we aren'targets +REM depend on platform-specific packaging systems at all. We have +REM already done just that for LLVM within evmjit. The downside of +REM that approach is that those dependencies then need to be +REM built-from-source, which adds time to the build process. It +REM gives us an unbeatable degree of control, though, because we +REM then perfectly control versioning and build flags for the binaries +REM for those packages. +REM +REM The documentation for solidity is hosted at: +REM +REM http://solidity.readthedocs.org +REM +REM --------------------------------------------------------------------------- +REM This file is part of solidity. +REM +REM solidity is free software: you can redistribute it and/or modify +REM it under the terms of the GNU General Public License as published by +REM the Free Software Foundation, either version 3 of the License, or +REM (at your option) any later version. +REM +REM solidity is distributed in the hope that it will be useful, +REM but WITHOUT ANY WARRANTY; without even the implied warranty of +REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +REM GNU General Public License for more details. +REM +REM You should have received a copy of the GNU General Public License +REM along with solidity. If not, see <http://www.gnu.org/licenses/> +REM +REM Copyright (c) 2016 solidity contributors. +REM --------------------------------------------------------------------------- + +cmake -P deps\install_deps.cmake diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh new file mode 100755 index 00000000..f1585178 --- /dev/null +++ b/scripts/install_deps.sh @@ -0,0 +1,363 @@ +#!/usr/bin/env bash + +#------------------------------------------------------------------------------ +# Bash 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 +# - ./install_deps.sh +# - cmake && make +# +# At the time of writing we are assuming that 'lsb_release' is present for all +# Linux distros, which is not a valid assumption. We will need a variety of +# approaches to actually get this working across all the distros which people +# are using. +# +# See http://unix.stackexchange.com/questions/92199/how-can-i-reliably-get-the-operating-systems-name +# for some more background on this common problem. +# +# 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. +#------------------------------------------------------------------------------ + +# 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; } + +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 "" + echo "NOTE - You are in unknown territory with this preview OS." + echo "Even Homebrew doesn't have official support yet, and there are" + echo "known issues (see https://github.com/ethereum/webthree-umbrella/issues/614)." + echo "If you would like to partner with us to work through these issues, that" + echo "would be fantastic. Please just comment on that issue. Thanks!" + ;; + *) + 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 upgrade + + brew install boost + brew install cmake + brew install jsoncpp + + # We should really 'brew install' our eth client here, but at the time of writing + # the bottle is known broken, so we will just cheat and use a hardcoded ZIP for + # the time being, which is good enough. The cause of the breaks will go away + # when we commit the repository reorg changes anyway. + curl -L -O https://github.com/bobsummerwill/cpp-ethereum/releases/download/v1.3.0/cpp-ethereum-osx-mavericks-v1.3.0.zip + unzip cpp-ethereum-osx-mavericks-v1.3.0.zip + + ;; + +#------------------------------------------------------------------------------ +# 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." + exit 1 + ;; + +#------------------------------------------------------------------------------ +# Linux +#------------------------------------------------------------------------------ + + Linux) + case $(lsb_release -is) 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 + sudo pacman -Sy \ + base-devel \ + boost \ + cmake \ + git \ + ;; + +#------------------------------------------------------------------------------ +# Alpine Linux +#------------------------------------------------------------------------------ + + Alpine) + #Alpine + echo "Installing solidity dependencies on Alpine Linux." + echo "ERROR - 'install_deps.sh' doesn't have Alpine Linux 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 Alpine Linux, that would be fantastic." + echo "Drop us a message at https://gitter.im/ethereum/solidity." + echo "See also https://github.com/ethereum/webthree-umbrella/issues/495 where we are working through Alpine support." + exit 1 + ;; + +#------------------------------------------------------------------------------ +# Debian +#------------------------------------------------------------------------------ + + Debian) + #Debian + 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." + 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)." + echo "ERROR - 'install_deps.sh' doesn't have Debian Stretch 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 Stretch, that would be fantastic." + echo "Drop us a message at https://gitter.im/ethereum/solidity." + exit 1 + ;; + *) + #other Debian + echo "Installing solidity dependencies on unknown Debian version." + echo "ERROR - Debian Jessie is the only Debian version which solidity has been tested on." + echo "If you are using a different release and would like to get 'install_deps.sh'" + echo "working for that release that would be fantastic." + echo "Drop us a message at https://gitter.im/ethereum/solidity." + exit 1 + ;; + esac + + # Install "normal packages" + sudo apt-get -y update + sudo apt-get -y install \ + build-essential \ + cmake \ + g++ \ + gcc \ + git \ + libboost-all-dev \ + libjsoncpp-dev \ + unzip + + ;; + +#------------------------------------------------------------------------------ +# 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 \ + 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 +# +# TODO - I wonder whether all of the Ubuntu-variants need some special +# treatment? +# +# TODO - We should also test this code on Ubuntu Server, Ubuntu Snappy Core +# and Ubuntu Phone. +# +# TODO - Our Ubuntu build is only working for amd64 and i386 processors. +# It would be good to add armel, armhf and arm64. +# See https://github.com/ethereum/webthree-umbrella/issues/228. +#------------------------------------------------------------------------------ + + Ubuntu) + #Ubuntu + 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)." + ;; + yakkety) + #yakkety + echo "Installing solidity dependencies on Ubuntu Yakkety Yak (16.10)." + echo "" + echo "NOTE - You are in unknown territory with this preview OS." + echo "We will need to update the Ethereum PPAs, work through build and runtime breaks, etc." + echo "See https://github.com/ethereum/webthree-umbrella/issues/624." + echo "If you would like to partner with us to work through these, that" + echo "would be fantastic. Please just comment on that issue. Thanks!" + ;; + *) + #other Ubuntu + echo "ERROR - Unknown or unsupported Ubuntu version." + echo "We only support Trusty, Utopic, Vivid, Wily and Xenial, with work-in-progress on Yakkety." + exit 1 + ;; + esac + + sudo apt-get -y update + sudo apt-get -y install \ + build-essential \ + cmake \ + git \ + libboost-all-dev \ + libjsoncpp-dev + + # Install 'eth', for use in the Solidity Tests-over-IPC. + 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 + + # And install the English language package and reconfigure the locales. + # We really shouldn't need to do this, and should instead force our locales to "C" + # within our application runtimes, because this issue shows up on multiple Linux distros, + # and each will need fixing in the install steps, where we should really just fix it once + # in the code. + # + # See https://github.com/ethereum/webthree-umbrella/issues/169 + sudo apt-get -y install language-pack-en-base + sudo dpkg-reconfigure locales + + ;; + *) + +#------------------------------------------------------------------------------ +# 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." + 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." + ;; +esac diff --git a/scripts/release.bat b/scripts/release.bat new file mode 100644 index 00000000..6f0ef6b0 --- /dev/null +++ b/scripts/release.bat @@ -0,0 +1,34 @@ +@ECHO OFF + +REM --------------------------------------------------------------------------- +REM Batch file for implementing release flow for solidity for Windows. +REM +REM The documentation for solidity is hosted at: +REM +REM https://solidity.readthedocs.org +REM +REM --------------------------------------------------------------------------- +REM This file is part of solidity. +REM +REM solidity is free software: you can redistribute it and/or modify +REM it under the terms of the GNU General Public License as published by +REM the Free Software Foundation, either version 3 of the License, or +REM (at your option) any later version. +REM +REM solidity is distributed in the hope that it will be useful, +REM but WITHOUT ANY WARRANTY; without even the implied warranty of +REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +REM GNU General Public License for more details. +REM +REM You should have received a copy of the GNU General Public License +REM along with solidity. If not, see <http://www.gnu.org/licenses/> +REM +REM Copyright (c) 2016 solidity contributors. +REM --------------------------------------------------------------------------- + +set CONFIGURATION=%1 + +REM TODO - Add soltest\%CONFIGURATION%\soltest.exe, when that is buildable. +7z a solidity-develop-windows.zip ^ + .\build\solc\%CONFIGURATION%\solc.exe ^ + "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x86\Microsoft.VC140.CRT\msvc*.dll" diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 00000000..275e53bb --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash + +#------------------------------------------------------------------------------ +# Bash script implementing release flow for solidity for Linux and macOS. +# +# TODO - At the time of writing, we only have ZIPs working. Need to hook up +# support for Homebrew and PPAs. +# +# The documentation for solidity is hosted at: +# +# https://solidity.readthedocs.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 solidity contributors. +#------------------------------------------------------------------------------ + +ZIP_SUFFIX=$1 +ZIP_TEMP_DIR=$(pwd)/build/zip/ + +# There is an implicit assumption here that we HAVE to run from root directory. +REPO_ROOT=$(pwd) + +if [[ "$OSTYPE" == "darwin"* ]]; then + DLL_EXT=dylib +else + DLL_EXT=so +fi + +mkdir -p $ZIP_TEMP_DIR + +# Copy all the solidity executables into a temporary directory prior to ZIP creation + +cp $REPO_ROOT/build/lllc/lllc $ZIP_TEMP_DIR +cp $REPO_ROOT/build/solc/solc $ZIP_TEMP_DIR +cp $REPO_ROOT/build/soltest/soltest $ZIP_TEMP_DIR + +# Copy all the dynamic libraries into a temporary directory prior to ZIP creation. +# There are a lot of these, and it would be great if we didn't have to worry about them. +# There is work-in-progress to support static-linkage on the UNIX platforms, which +# is most promising on Alpine Linux using musl. macOS doesn't support statically +# linked binaries (ie. executables which make direct system calls to the kernel. +# +# See https://developer.apple.com/library/mac/qa/qa1118/_index.html. +# See https://github.com/ethereum/webthree-umbrella/issues/495. + +cp $REPO_ROOT/build/libdevcore/*.$DLL_EXT $ZIP_TEMP_DIR +cp $REPO_ROOT/build/libevmasm/*.$DLL_EXT $ZIP_TEMP_DIR +cp $REPO_ROOT/build/libsolidity/*.$DLL_EXT $ZIP_TEMP_DIR + +# For macOS, we also copy the dynamic libraries for our external dependencies. +# When building from source on your own machine, these libraries will be installed +# globally, using Homebrew, but we don't want to rely on that for these ZIPs, so +# we copy these into the ZIP temporary directory too. +# +# TODO - So what happens for Linux and other UNIX distros in this case? +# There will be runtime dependencies on equivalent SO files being present, likely in +# a completely analogous way. Does that mean that ZIPs are actually useless on such +# distros, because there will be symbol links to global install locations (distro-specific) +# and those files will just be missing on the target machines? + +if [[ "$OSTYPE" == "darwin"* ]]; then + cp /usr/local/opt/jsoncpp/lib/libjsoncpp.1.dylib $ZIP_TEMP_DIR +fi + +# For macOS, we run a fix-up script which alters all of the symbolic links within +# the executables and dynamic libraries such that the ZIP becomes self-contained, by +# revectoring all the dylib references to be relative to the directory containing the +# application, so that the ZIPs are self-contained, with the only external references +# being for kernel-level dylibs. + +if [[ "$OSTYPE" == "darwin"* ]]; then + python $REPO_ROOT/scripts/fix_homebrew_paths_in_standalone_zip.py $ZIP_TEMP_DIR +fi + +# And ZIP it all up, with a filename suffix passed in on the command-line. + +zip -j $REPO_ROOT/solidity-develop-$ZIP_SUFFIX.zip $ZIP_TEMP_DIR/* diff --git a/scripts/tests.sh b/scripts/tests.sh new file mode 100755 index 00000000..6ee816b0 --- /dev/null +++ b/scripts/tests.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +#------------------------------------------------------------------------------ +# Bash script to execute the Solidity tests. +# +# The documentation for solidity is hosted at: +# +# https://solidity.readthedocs.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 solidity contributors. +#------------------------------------------------------------------------------ + +set -e + +# There is an implicit assumption here that we HAVE to run from root directory. +REPO_ROOT=$(pwd) + +# This conditional is only needed because we don't have a working Homebrew +# install for `eth` at the time of writing, so we unzip the ZIP file locally +# instead. This will go away soon. +if [[ "$OSTYPE" == "darwin"* ]]; then + ETH_PATH="$REPO_ROOT/eth" +else + ETH_PATH="eth" +fi + +# This trailing ampersand directs the shell to run the command in the background, +# that is, it is forked and run in a separate sub-shell, as a job, +# asynchronously. The shell will immediately return the return status of 0 for +# true and continue as normal, either processing further commands in a script +# or returning the cursor focus back to the user in a Linux terminal. +$ETH_PATH --test -d /tmp/test & + +# Wait until the IPC endpoint is available. That won't be available instantly. +# The node needs to get a little way into its startup sequence before the IPC +# is available and is ready for the unit-tests to start talking to it. +while [ ! -S /tmp/test/geth.ipc ]; do sleep 2; done + +# TODO - It should be possible to set the IPC path with explicit parameters: +# +# ./test/soltest --ipc /tmp/test/geth.ipc +# +# But that doesn't work on macOS, so we're just using the cruder approach of +# using an environment variable. That works on Linux and macOS. We will +# need to check if this command-line support works for Windows too, when we +# have implemented IPC Sockets support at all for Windows. +export ETH_TEST_IPC=/tmp/test/geth.ipc +"$REPO_ROOT"/build/test/soltest +ERROR_CODE=$? +pkill eth || true +sleep 4 +pgrep eth && pkill -9 eth || true +exit $ERROR_CODE diff --git a/scripts/travis-emscripten/build_emscripten.sh b/scripts/travis-emscripten/build_emscripten.sh new file mode 100755 index 00000000..abdf401f --- /dev/null +++ b/scripts/travis-emscripten/build_emscripten.sh @@ -0,0 +1,130 @@ +#!/usr/bin/env bash + +#------------------------------------------------------------------------------ +# This script builds the solidity binary using Emscripten. +# Emscripten is a way to compile C/C++ to JavaScript. +# +# http://kripken.github.io/emscripten-site/ +# +# First run install_dep.sh OUTSIDE of docker and then +# run this script inside a docker image trzeci/emscripten +# +# 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 -ev + +# We need git for extracting the commit hash +apt-get update +apt-get -y install git-core + +export WORKSPACE=/src + +# CryptoPP +echo -en 'travis_fold:start:compiling_cryptopp\\r' +cd "$WORKSPACE/cryptopp" +# if .git exists, it is a fresh checkout, otherwise it comes from the cache +# and is already compiled +test -e .git && ( +emcmake cmake -DCRYPTOPP_LIBRARY_TYPE=STATIC -DCRYPTOPP_RUNTIME_TYPE=STATIC && emmake make -j 4 +ln -s . src/cryptopp || true +rm -rf .git +) +echo -en 'travis_fold:end:compiling_cryptopp\\r' + +# Json-CPP +echo -en 'travis_fold:start:compiling_jsoncpp\\r' +cd "$WORKSPACE/jsoncpp" +# if .git exists, it is a fresh checkout, otherwise it comes from the cache +# and is already compiled +test -e .git && ( +emcmake cmake -DJSONCPP_LIB_BUILD_STATIC=ON -DJSONCPP_LIB_BUILD_SHARED=OFF \ + -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF \ + -G "Unix Makefiles" . +emmake make -j 4 +rm -rf .git +) +echo -en 'travis_fold:end:compiling_jsoncpp\\r' + +# Boost +echo -en 'travis_fold:start:compiling_boost\\r' +cd "$WORKSPACE"/boost_1_57_0 +# if b2 exists, it is a fresh checkout, otherwise it comes from the cache +# and is already compiled +test -e b2 && ( +sed -i 's|using gcc ;|using gcc : : /usr/local/bin/em++ ;|g' ./project-config.jam +sed -i 's|$(archiver\[1\])|/usr/local/bin/emar|g' ./tools/build/src/tools/gcc.jam +sed -i 's|$(ranlib\[1\])|/usr/local/bin/emranlib|g' ./tools/build/src/tools/gcc.jam +./b2 link=static variant=release threading=single runtime-link=static \ + thread system regex date_time chrono filesystem unit_test_framework program_options random +find . -name 'libboost*.a' -exec cp {} . \; +rm -rf b2 libs doc tools more bin.v2 status +) +echo -en 'travis_fold:end:compiling_boost\\r' + +# Build dependent components and solidity itself +echo -en 'travis_fold:start:compiling_solidity\\r' +cd $WORKSPACE +mkdir -p build-emscripten +cd build-emscripten +emcmake cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DEMSCRIPTEN=1 \ + -DCMAKE_CXX_COMPILER=em++ \ + -DCMAKE_C_COMPILER=emcc \ + -DBoost_FOUND=1 \ + -DBoost_USE_STATIC_LIBS=1 \ + -DBoost_USE_STATIC_RUNTIME=1 \ + -DBoost_INCLUDE_DIR="$WORKSPACE"/boost_1_57_0/ \ + -DBoost_CHRONO_LIBRARY="$WORKSPACE"/boost_1_57_0/libboost_chrono.a \ + -DBoost_CHRONO_LIBRARIES="$WORKSPACE"/boost_1_57_0/libboost_chrono.a \ + -DBoost_DATE_TIME_LIBRARY="$WORKSPACE"/boost_1_57_0/libboost_date_time.a \ + -DBoost_DATE_TIME_LIBRARIES="$WORKSPACE"/boost_1_57_0/libboost_date_time.a \ + -DBoost_FILESYSTEM_LIBRARY="$WORKSPACE"/boost_1_57_0/libboost_filesystem.a \ + -DBoost_FILESYSTEM_LIBRARIES="$WORKSPACE"/boost_1_57_0/libboost_filesystem.a \ + -DBoost_PROGRAM_OPTIONS_LIBRARY="$WORKSPACE"/boost_1_57_0/libboost_program_options.a \ + -DBoost_PROGRAM_OPTIONS_LIBRARIES="$WORKSPACE"/boost_1_57_0/libboost_program_options.a \ + -DBoost_RANDOM_LIBRARY="$WORKSPACE"/boost_1_57_0/libboost_random.a \ + -DBoost_RANDOM_LIBRARIES="$WORKSPACE"/boost_1_57_0/libboost_random.a \ + -DBoost_REGEX_LIBRARY="$WORKSPACE"/boost_1_57_0/libboost_regex.a \ + -DBoost_REGEX_LIBRARIES="$WORKSPACE"/boost_1_57_0/libboost_regex.a \ + -DBoost_SYSTEM_LIBRARY="$WORKSPACE"/boost_1_57_0/libboost_system.a \ + -DBoost_SYSTEM_LIBRARIES="$WORKSPACE"/boost_1_57_0/libboost_system.a \ + -DBoost_THREAD_LIBRARY="$WORKSPACE"/boost_1_57_0/libboost_thread.a \ + -DBoost_THREAD_LIBRARIES="$WORKSPACE"/boost_1_57_0/libboost_thread.a \ + -DBoost_UNIT_TEST_FRAMEWORK_LIBRARY="$WORKSPACE"/boost_1_57_0/libboost_unit_test_framework.a \ + -DBoost_UNIT_TEST_FRAMEWORK_LIBRARIES="$WORKSPACE"/boost_1_57_0/libboost_unit_test_framework.a \ + -DJSONCPP_LIBRARY="$WORKSPACE"/jsoncpp/src/lib_json/libjsoncpp.a \ + -DJSONCPP_INCLUDE_DIR="$WORKSPACE"/jsoncpp/include/ \ + -DCRYPTOPP_LIBRARY="$WORKSPACE"/cryptopp/src/libcryptlib.a \ + -DCRYPTOPP_INCLUDE_DIR="$WORKSPACE"/cryptopp/src/ \ + -DDev_DEVCORE_LIBRARY="$WORKSPACE"/solidity/build/libdevcore/libdevcore.a \ + -DEth_EVMASM_LIBRARY="$WORKSPACE"/solidity/build/libevmasm/libevmasm.a \ + -DETHASHCL=0 -DEVMJIT=0 -DETH_STATIC=1 -DSOLIDITY=1 -DFATDB=0 -DTESTS=0 -DTOOLS=0 \ + .. +emmake make -j 4 + +cd .. +cp build-emscripten/solc/soljson.js ./ + +echo -en 'travis_fold:end:compiling_solidity\\r' diff --git a/scripts/travis-emscripten/deploy_key.enc b/scripts/travis-emscripten/deploy_key.enc Binary files differnew file mode 100644 index 00000000..d613c32e --- /dev/null +++ b/scripts/travis-emscripten/deploy_key.enc diff --git a/scripts/travis-emscripten/install_deps.sh b/scripts/travis-emscripten/install_deps.sh new file mode 100755 index 00000000..2c0e9f26 --- /dev/null +++ b/scripts/travis-emscripten/install_deps.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +#------------------------------------------------------------------------------ +# Bash script for installing pre-requisite packages for building solidity +# using Emscripten on Ubuntu Trusty. +# +# 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 -ev + +echo -en 'travis_fold:start:installing_dependencies\\r' +test -e cryptopp -a -e cryptopp/src || git clone https://github.com/mmoss/cryptopp.git +test -e jsoncpp -a -e jsoncpp/include || git clone https://github.com/open-source-parsers/jsoncpp.git +test -e boost_1_57_0 -a -e boost_1_57_0/boost || ( +wget 'http://downloads.sourceforge.net/project/boost/boost/'\ +'1.57.0/boost_1_57_0.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2F'\ +'projects%2Fboost%2Ffiles%2Fboost%2F1.57.0%2F&ts=1421887207'\ + -O - | tar xj +cd boost_1_57_0 +./bootstrap.sh --with-toolset=gcc --with-libraries=thread,system,regex,date_time,chrono,filesystem,program_options,random +) +cd .. +echo -en 'travis_fold:end:installing_dependencies\\r' diff --git a/scripts/travis-emscripten/publish_binary.sh b/scripts/travis-emscripten/publish_binary.sh new file mode 100755 index 00000000..a62d4b47 --- /dev/null +++ b/scripts/travis-emscripten/publish_binary.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +#------------------------------------------------------------------------------ +# Bash script for publishing Solidity Emscripten binaries to Github. +# +# The results are committed to https://github.com/ethereum/solc-bin. +# +# 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 + +VER=$(cat CMakeLists.txt | grep 'set(PROJECT_VERSION' | sed -e 's/.*set(PROJECT_VERSION "\(.*\)".*/\1/') +test -n "$VER" +VER="v$VER" +COMMIT=$(git rev-parse --short HEAD) +DATE=$(date --date="$(git log -1 --date=iso --format=%ad HEAD)" --utc +%F) + +ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key" +ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv" +ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR} +ENCRYPTED_IV=${!ENCRYPTED_IV_VAR} +openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in scripts/travis-emscripten/deploy_key.enc -out deploy_key -d +chmod 600 deploy_key +eval `ssh-agent -s` +ssh-add deploy_key + +git clone --depth 2 git@github.com:ethereum/solc-bin.git +cd solc-bin +git config user.name "travis" +git config user.email "chris@ethereum.org" +git checkout -B gh-pages origin/gh-pages +git clean -f -d -x +# We only want one release per day and we do not want to push the same commit twice. +if ls ./bin/soljson-"$VER-$DATE"-*.js ./bin/soljson-*-"$COMMIT.js" > /dev/null +then + true +else + # This file is assumed to be the product of the build_emscripten.sh script. + cp ../soljson.js ./bin/"soljson-$VER-$DATE-$COMMIT.js" + ./update-index.sh + cd bin + LATEST=$(ls -r soljson-v* | head -n 1) + cp "$LATEST" soljson-latest.js + cp soljson-latest.js ../soljson.js + git add . + git add ../soljson.js + git commit -m "Added compiler version $LATEST" + git push origin gh-pages +fi |