From 2ec5d36f154a2b591c0ba69e51897b555653aba4 Mon Sep 17 00:00:00 2001 From: chriseth Date: Sun, 5 Jun 2016 18:43:04 +0200 Subject: [PATCH] Build emscripten on travis using docker. --- .travis.yml | 28 +++++ ci/travis-emscripten/build_emscripten.sh | 106 +++++++++++++++++++ ci/travis-emscripten/deploy_key.enc | Bin 0 -> 1680 bytes ci/travis-emscripten/install_dependencies.sh | 16 +++ ci/travis-emscripten/publish_binary.sh | 42 ++++++++ 5 files changed, 192 insertions(+) create mode 100644 .travis.yml create mode 100755 ci/travis-emscripten/build_emscripten.sh create mode 100644 ci/travis-emscripten/deploy_key.enc create mode 100755 ci/travis-emscripten/install_dependencies.sh create mode 100755 ci/travis-emscripten/publish_binary.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..56adf02ae --- /dev/null +++ b/.travis.yml @@ -0,0 +1,28 @@ +sudo: required +services: + - docker +language: cpp +compiler: gcc + +before_install: + - docker pull trzeci/emscripten:sdk-tag-1.35.4-64bit + +script: ./ci/travis-emscripten/install_dependencies.sh && docker run -v $(pwd):/src trzeci/emscripten:sdk-tag-1.35.4-64bit ./ci/travis-emscripten/build_emscripten.sh + +cache: + ccache: false + directories: + - boost_1_57_0 + - jsoncpp + - cryptopp + +deploy: + provider: script + script: ci/travis-emscripten/publish_binary.sh + skip_cleanup: true + on: + branch: develop + +env: + global: + - ENCRYPTION_LABEL="296c219a3f41" diff --git a/ci/travis-emscripten/build_emscripten.sh b/ci/travis-emscripten/build_emscripten.sh new file mode 100755 index 000000000..773bfdf01 --- /dev/null +++ b/ci/travis-emscripten/build_emscripten.sh @@ -0,0 +1,106 @@ +#!/usr/bin/env bash +# +# This script builds the solidity binary using emscripten. +# Emscripten is a way to compile C/C++ to JavaScript. +# +# First run install_dependencies.sh OUTSIDE of docker and then +# run this script inside a docker image trzeci/emscripten + +set -ev + +if [ -z ${WORKSPACE} ] +then + WORKSPACE=$(pwd) +fi +export WORKSPACE + +# 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 -x .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 -x .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 -x 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' +for component in webthree-helpers/utils libweb3core solidity +do +cd "$WORKSPACE/$component" +mkdir build || true +cd build +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"/libweb3core/build/libdevcore/libdevcore.a \ + -DDev_DEVCRYPTO_LIBRARY="$WORKSPACE"/libweb3core/build/libdevcrypto/libdevcrypto.a \ + -DEth_EVMASM_LIBRARY="$WORKSPACE"/solidity/build/libevmasm/libevmasm.a \ + -DUtils_SCRYPT_LIBRARY="$WORKSPACE"/webthree-helpers/utils/build/libscrypt/libscrypt.a \ + -DETHASHCL=0 -DEVMJIT=0 -DETH_STATIC=1 -DSOLIDITY=1 -DGUI=0 -DFATDB=0 -DTESTS=0 -DTOOLS=0 \ + .. +emmake make -j 4 +done +echo -en 'travis_fold:end:compiling_solidity\\r' + diff --git a/ci/travis-emscripten/deploy_key.enc b/ci/travis-emscripten/deploy_key.enc new file mode 100644 index 0000000000000000000000000000000000000000..d613c32ec667723e72465fbb0ea96b9ae9036009 GIT binary patch literal 1680 zcmV;B255Q|*im&6o;=AxR51nu>LL#mxMr z0mqA)H$41`VPd$h3O{kd&kG zARVHA@HdyWP&2gtbccJ$!%ikjH8GAv*ge-`^`brKP+pMemmeJ~F9DX!e|(T#sc%_b z37yxhF~h@wrr<%Le#7dBR|xeTKU727P4WX4aZO#_icwUB8*24AKn+&3h*Cu?_V1?5 zkKhGAIoMKeNMMV~Yjq7s!-Dhj?_g1GXL_o=9k_b_P=;lxXmBV&Mr>2zg|5A?IpMBk zf#2wURs;}PsxEG8eS`Mzsqtz9v_PXV`{0Q?EJ(>z324DDQvj|cv zC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