mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8909 from ethereum/emscriptenDockerImage
Add and use docker image for Emscripten builds.
This commit is contained in:
commit
2d66b33320
@ -558,27 +558,15 @@ jobs:
|
||||
|
||||
b_ems:
|
||||
docker:
|
||||
- image: trzeci/emscripten:sdk-tag-1.39.3-64bit
|
||||
- image: ethereum/solidity-buildpack-deps:emsdk-1.39.15-1
|
||||
environment:
|
||||
TERM: xterm
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
name: Restore Boost build
|
||||
key: &boost-cache-key emscripten-boost-{{ checksum "scripts/travis-emscripten/install_deps.sh" }}{{ checksum "scripts/build_emscripten.sh" }}{{ checksum "scripts/travis-emscripten/build_emscripten.sh" }}
|
||||
- run:
|
||||
name: Bootstrap Boost
|
||||
command: |
|
||||
scripts/travis-emscripten/install_deps.sh
|
||||
- run:
|
||||
name: Build
|
||||
command: |
|
||||
scripts/travis-emscripten/build_emscripten.sh
|
||||
- save_cache:
|
||||
name: Save Boost build
|
||||
key: *boost-cache-key
|
||||
paths:
|
||||
- boost_1_70_0_install
|
||||
- store_artifacts:
|
||||
path: emscripten_build/libsolc/soljson.js
|
||||
destination: soljson.js
|
||||
|
66
.circleci/docker/Dockerfile.emscripten
Normal file
66
.circleci/docker/Dockerfile.emscripten
Normal file
@ -0,0 +1,66 @@
|
||||
# vim:syntax=dockerfile
|
||||
#------------------------------------------------------------------------------
|
||||
# Dockerfile for building and testing Solidity Compiler on CI
|
||||
# Target: Emscripten
|
||||
# URL: https://hub.docker.com/r/ethereum/solidity-buildpack-deps
|
||||
#
|
||||
# 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.
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# The Emscripten SDK at https://github.com/emscripten-core/emsdk/
|
||||
# contains a Makefile in the docker/ subdirectory that can be used to create the
|
||||
# required base image using:
|
||||
#
|
||||
# make version=1.39.15-fastcomp build
|
||||
#
|
||||
# TODO: switch to the upstream backend by removing "-fastcomp".
|
||||
#
|
||||
FROM emscripten/emsdk:1.39.15-fastcomp AS base
|
||||
|
||||
ADD emscripten.jam /usr/src
|
||||
RUN set -ex; \
|
||||
cd /usr/src; \
|
||||
git clone https://github.com/Z3Prover/z3.git -b z3-4.8.8 --depth 1 ; \
|
||||
cd z3; \
|
||||
mkdir build; \
|
||||
cd build; \
|
||||
emcmake cmake \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||
-DCMAKE_INSTALL_PREFIX=/emsdk/emscripten/sdk/system/ \
|
||||
-DZ3_BUILD_LIBZ3_SHARED=OFF \
|
||||
-DZ3_ENABLE_EXAMPLE_TARGETS=OFF \
|
||||
-DZ3_BUILD_TEST_EXECUTABLES=OFF \
|
||||
-DZ3_BUILD_EXECUTABLE=OFF \
|
||||
-DZ3_SINGLE_THREADED=ON \
|
||||
..; \
|
||||
make; make install; \
|
||||
rm -r /usr/src/z3; \
|
||||
cd /usr/src; \
|
||||
wget -q 'https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.tar.bz2' -O boost.tar.bz2; \
|
||||
test "$(sha256sum boost.tar.bz2)" = "4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402 boost.tar.bz2"; \
|
||||
tar -xf boost.tar.bz2; \
|
||||
rm boost.tar.bz2; \
|
||||
cd boost_1_73_0; \
|
||||
mv ../emscripten.jam .; \
|
||||
./bootstrap.sh; \
|
||||
echo "using emscripten : : em++ ;" >> project-config.jam ; \
|
||||
./b2 toolset=emscripten link=static variant=release threading=single runtime-link=static \
|
||||
--with-system --with-filesystem --with-test --with-program_options \
|
||||
cxxflags="-Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all" \
|
||||
--prefix=/emsdk/emscripten/sdk/system install; \
|
||||
rm -r /usr/src/boost_1_73_0
|
@ -79,10 +79,10 @@ rule init ( version ? : command * : options * )
|
||||
# @todo this seems to be the right way, but this is a list somehow
|
||||
toolset.add-requirements <toolset>emscripten:<testing.launcher>node ;
|
||||
|
||||
toolset.flags emscripten.compile STDHDRS $(condition) : /emsdk_portable/emscripten/sdk/system/include ;
|
||||
toolset.flags emscripten.link STDLIBPATH $(condition) : /emsdk_portable/emscripten/sdk/system/lib ;
|
||||
toolset.flags emscripten AR $(condition) : /emsdk_portable/emscripten/sdk/emar ;
|
||||
toolset.flags emscripten RANLIB $(condition) : /emsdk_portable/emscripten/sdk/emranlib ;
|
||||
toolset.flags emscripten.compile STDHDRS $(condition) : /emsdk/emscripten/sdk/system/include ;
|
||||
toolset.flags emscripten.link STDLIBPATH $(condition) : /emsdk/emscripten/sdk/system/lib ;
|
||||
toolset.flags emscripten AR $(condition) : /emsdk/emscripten/sdk/emar ;
|
||||
toolset.flags emscripten RANLIB $(condition) : /emsdk/emscripten/sdk/emranlib ;
|
||||
}
|
||||
|
||||
type.set-generated-target-suffix EXE : <toolset>emscripten : js ;
|
@ -110,7 +110,7 @@ matrix:
|
||||
before_install:
|
||||
- nvm install 8
|
||||
- nvm use 8
|
||||
- docker pull trzeci/emscripten:sdk-tag-1.39.3-64bit
|
||||
- docker pull ethereum/solidity-buildpack-deps:emsdk-1.39.15-1
|
||||
env:
|
||||
- SOLC_EMSCRIPTEN=On
|
||||
- SOLC_INSTALL_DEPS_TRAVIS=Off
|
||||
|
@ -34,7 +34,5 @@ else
|
||||
BUILD_DIR="$1"
|
||||
fi
|
||||
|
||||
docker run -v $(pwd):/root/project -w /root/project trzeci/emscripten:sdk-tag-1.39.3-64bit \
|
||||
./scripts/travis-emscripten/install_deps.sh
|
||||
docker run -v $(pwd):/root/project -w /root/project trzeci/emscripten:sdk-tag-1.39.3-64bit \
|
||||
docker run -v $(pwd):/root/project -w /root/project ethereum/solidity-buildpack-deps:emsdk-1.39.15-1 \
|
||||
./scripts/travis-emscripten/build_emscripten.sh $BUILD_DIR
|
||||
|
@ -40,37 +40,8 @@ else
|
||||
BUILD_DIR="$1"
|
||||
fi
|
||||
|
||||
if ! type git &>/dev/null; then
|
||||
# We need git for extracting the commit hash
|
||||
apt-get update
|
||||
apt-get -y install git-core
|
||||
fi
|
||||
|
||||
if ! type wget &>/dev/null; then
|
||||
# We need wget to install cmake
|
||||
apt-get update
|
||||
apt-get -y install wget
|
||||
fi
|
||||
|
||||
WORKSPACE=/root/project
|
||||
|
||||
# Boost
|
||||
echo -en 'travis_fold:start:compiling_boost\\r'
|
||||
test -e "$WORKSPACE"/boost_1_70_0_install/include/boost/version.hpp || (
|
||||
cd "$WORKSPACE"/boost_1_70_0
|
||||
./b2 toolset=emscripten link=static variant=release threading=single runtime-link=static \
|
||||
--with-system --with-filesystem --with-test --with-program_options cxxflags="-Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all" \
|
||||
--prefix="$WORKSPACE"/boost_1_70_0_install install
|
||||
)
|
||||
ln -sf "$WORKSPACE"/boost_1_70_0_install/lib/* /emsdk_portable/emscripten/sdk/system/lib
|
||||
ln -sf "$WORKSPACE"/boost_1_70_0_install/include/* /emsdk_portable/emscripten/sdk/system/include
|
||||
echo -en 'travis_fold:end:compiling_boost\\r'
|
||||
|
||||
echo -en 'travis_fold:start:install_cmake.sh\\r'
|
||||
source $WORKSPACE/scripts/install_cmake.sh
|
||||
echo -en 'travis_fold:end:install_cmake.sh\\r'
|
||||
|
||||
# Build dependent components and solidity itself
|
||||
echo -en 'travis_fold:start:compiling_solidity\\r'
|
||||
cd $WORKSPACE
|
||||
mkdir -p $BUILD_DIR
|
||||
@ -82,7 +53,7 @@ cmake \
|
||||
-DBoost_USE_STATIC_RUNTIME=1 \
|
||||
-DTESTS=0 \
|
||||
..
|
||||
make -j 4
|
||||
make -j 4 soljson
|
||||
|
||||
cd ..
|
||||
mkdir -p upload
|
||||
|
@ -1,49 +0,0 @@
|
||||
#!/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
|
||||
|
||||
SCRIPT_DIR="$(realpath $(dirname $0))"
|
||||
|
||||
echo -en 'travis_fold:start:installing_dependencies\\r'
|
||||
test -e boost_1_70_0_install/include/boost/version.hpp || (
|
||||
rm -rf boost_1_70_0
|
||||
rm -f boost.tar.gz
|
||||
wget -q 'https://sourceforge.net/projects/boost/files/boost/1.70.0/boost_1_70_0.tar.gz/download'\
|
||||
-O boost.tar.gz
|
||||
test "$(shasum boost.tar.gz)" = "7804c782deb00f36ac80b1000b71a3707eadb620 boost.tar.gz"
|
||||
tar -xzf boost.tar.gz
|
||||
rm boost.tar.gz
|
||||
cd boost_1_70_0
|
||||
./bootstrap.sh
|
||||
cp "${SCRIPT_DIR}/emscripten.jam" .
|
||||
echo "using emscripten : : em++ ;" >> project-config.jam
|
||||
)
|
||||
cd ..
|
||||
echo -en 'travis_fold:end:installing_dependencies\\r'
|
Loading…
Reference in New Issue
Block a user