mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add Dockerfile for an Emscripten build environment and use it for CI runs.
This commit is contained in:
@@ -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,186 +0,0 @@
|
||||
# Modified version of emscripten.jam from https://github.com/tee3/boost-build-emscripten
|
||||
# which is released under the following license:
|
||||
#
|
||||
# Boost Software License - Version 1.0 - August 17th, 2003
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person or organization
|
||||
# obtaining a copy of the software and accompanying documentation covered by
|
||||
# this license (the "Software") to use, reproduce, display, distribute,
|
||||
# execute, and transmit the Software, and to prepare derivative works of the
|
||||
# Software, and to permit third-parties to whom the Software is furnished to
|
||||
# do so, all subject to the following:
|
||||
#
|
||||
# The copyright notices in the Software and this entire statement, including
|
||||
# the above license grant, this restriction and the following disclaimer,
|
||||
# must be included in all copies of the Software, in whole or in part, and
|
||||
# all derivative works of the Software, unless such copies or derivative
|
||||
# works are solely in the form of machine-executable object code generated by
|
||||
# a source language processor.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
# SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
# FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Boost.Build support for Emscipten.
|
||||
#
|
||||
# @todo add support for dynamic linking
|
||||
# @todo add support for --js-library, --pre-js, and --post-js options
|
||||
|
||||
import generators ;
|
||||
import type ;
|
||||
import toolset ;
|
||||
import feature ;
|
||||
import common ;
|
||||
import errors ;
|
||||
|
||||
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
|
||||
{
|
||||
.debug-configuration = true ;
|
||||
}
|
||||
|
||||
# add an emscripten toolset
|
||||
feature.extend toolset : emscripten ;
|
||||
|
||||
# extend the target-os list to include emscripten
|
||||
feature.extend target-os : emscripten ;
|
||||
# make emscripten the default target-os when compiling with the emscripten toolset
|
||||
feature.set-default target-os : emscripten ;
|
||||
|
||||
# initialize the emscripten toolset
|
||||
rule init ( version ? : command * : options * )
|
||||
{
|
||||
command = [ common.get-invocation-command emscripten : em++ : $(command) ] ;
|
||||
|
||||
if $(command)
|
||||
{
|
||||
version ?= [ MATCH "^([0-9.]+)" : [ SHELL \""$(command)\" --version" ] ] ;
|
||||
if $(version)
|
||||
{
|
||||
local actual_version = [ MATCH "^([0-9.]+)" : [ SHELL \""$(command)\" --version" ] ] ;
|
||||
if $(actual_version) != $(version)
|
||||
{
|
||||
errors.user-error "emscripten: detected version $(actual_version) does not match desired $(version)" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errors.user-error "emscripten: em++ not found" ;
|
||||
}
|
||||
|
||||
local condition = [ common.check-init-parameters emscripten : version $(version) ] ;
|
||||
|
||||
common.handle-options emscripten : $(condition) : $(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 ;
|
||||
}
|
||||
|
||||
type.set-generated-target-suffix EXE : <toolset>emscripten : js ;
|
||||
#type.set-generated-target-suffix STATIC_LIB : <toolset>emscripten : bc ;
|
||||
#type.set-generated-target-suffix SHARED_LIB : <toolset>emscripten : bc ;
|
||||
#type.set-generated-target-suffix OBJ : <toolset>emscripten : bc ;
|
||||
|
||||
generators.register-linker emscripten.link : OBJ STATIC_LIB : EXE : <toolset>emscripten ;
|
||||
|
||||
generators.register-archiver emscripten.archive : OBJ : STATIC_LIB : <toolset>emscripten ;
|
||||
|
||||
generators.register-c-compiler emscripten.compile.c++.preprocess : CPP : PREPROCESSED_CPP : <toolset>emscripten ;
|
||||
generators.register-c-compiler emscripten.compile.c.preprocess : C : PREPROCESSED_C : <toolset>emscripten ;
|
||||
generators.register-c-compiler emscripten.compile.c++ : CPP : OBJ : <toolset>emscripten ;
|
||||
generators.register-c-compiler emscripten.compile.c : C : OBJ : <toolset>emscripten ;
|
||||
|
||||
# Declare flags
|
||||
|
||||
toolset.flags emscripten.compile OPTIONS <optimization>off : -O0 ;
|
||||
toolset.flags emscripten.compile OPTIONS <optimization>speed : -O3 ;
|
||||
toolset.flags emscripten.compile OPTIONS <optimization>space : -Os ;
|
||||
|
||||
toolset.flags emscripten.compile OPTIONS <inlining>off : -fno-inline ;
|
||||
toolset.flags emscripten.compile OPTIONS <inlining>on : -Wno-inline ;
|
||||
toolset.flags emscripten.compile OPTIONS <inlining>full : -finline-functions -Wno-inline ;
|
||||
|
||||
toolset.flags emscripten.compile OPTIONS <warnings>off : -w ;
|
||||
toolset.flags emscripten.compile OPTIONS <warnings>on : -Wall ;
|
||||
toolset.flags emscripten.compile OPTIONS <warnings>all : -Wall -pedantic ;
|
||||
toolset.flags emscripten.compile OPTIONS <warnings-as-errors>on : -Werror ;
|
||||
|
||||
toolset.flags emscripten.compile OPTIONS <debug-symbols>on : -g ;
|
||||
toolset.flags emscripten.compile OPTIONS <profiling>on : -pg ;
|
||||
|
||||
toolset.flags emscripten.compile.c++ OPTIONS <rtti>off : -fno-rtti ;
|
||||
toolset.flags emscripten.compile.c++ OPTIONS <exception-handling>off : -fno-exceptions ;
|
||||
|
||||
toolset.flags emscripten.compile USER_OPTIONS <cflags> ;
|
||||
toolset.flags emscripten.compile.c++ USER_OPTIONS <cxxflags> ;
|
||||
toolset.flags emscripten.compile DEFINES <define> ;
|
||||
toolset.flags emscripten.compile INCLUDES <include> ;
|
||||
toolset.flags emscripten.compile.c++ TEMPLATE_DEPTH <c++-template-depth> ;
|
||||
toolset.flags emscripten.compile.fortran USER_OPTIONS <fflags> ;
|
||||
|
||||
toolset.flags emscripten.link DEFAULTS : -Wno-warn-absolute-paths ;
|
||||
|
||||
toolset.flags emscripten.link LIBRARY_PATH <library-path> ;
|
||||
toolset.flags emscripten.link FINDLIBS_ST <find-static-library> ;
|
||||
toolset.flags emscripten.link FINDLIBS_SA <find-shared-library> ;
|
||||
toolset.flags emscripten.link LIBRARIES <library-file> ;
|
||||
|
||||
toolset.flags emscripten.link OPTIONS <linkflags> ;
|
||||
|
||||
toolset.flags emscripten.archive AROPTIONS <archiveflags> ;
|
||||
|
||||
rule compile.c++ ( targets * : sources * : properties * )
|
||||
{
|
||||
# Some extensions are compiled as C++ by default. For others, we need to
|
||||
# pass -x c++. We could always pass -x c++ but distcc does not work with it.
|
||||
if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C
|
||||
{
|
||||
LANG on $(<) = "-x c++" ;
|
||||
}
|
||||
}
|
||||
|
||||
rule compile.c ( targets * : sources * : properties * )
|
||||
{
|
||||
LANG on $(<) = "-x c" ;
|
||||
}
|
||||
|
||||
actions compile.c++
|
||||
{
|
||||
"$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<:W)" "$(>:W)"
|
||||
}
|
||||
|
||||
actions compile.c
|
||||
{
|
||||
"$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
|
||||
}
|
||||
|
||||
actions compile.c++.preprocess
|
||||
{
|
||||
"$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" "$(>:W)" -E >"$(<:W)"
|
||||
}
|
||||
|
||||
actions compile.c.preprocess
|
||||
{
|
||||
"$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" "$(>)" -E >$(<)
|
||||
}
|
||||
|
||||
actions link
|
||||
{
|
||||
"$(CONFIG_COMMAND)" $(DEFAULTS) $(OPTIONS) -L"$(LIBRARY_PATH:W)" -L"$(STDLIBPATH:W)" -o "$(<:W)" "$(>:W)" -l"$(LIBRARIES:W)" -l"$(STDLIBRARIES:W)"
|
||||
}
|
||||
|
||||
RM = [ common.rm-command ] ;
|
||||
actions piecemeal archive
|
||||
{
|
||||
$(RM) "$(<)"
|
||||
$(AR) $(AROPTIONS) rc "$(<:W)" "$(>:W)"
|
||||
}
|
||||
@@ -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'
|
||||
Reference in New Issue
Block a user