This repository has been archived by the owner on Feb 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #559 from ethereum/solidity_emscripten
Build emscripten on travis using docker.
- Loading branch information
Showing
5 changed files
with
192 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ev | ||
|
||
echo -en 'travis_fold:start:installing_dependencies\\r' | ||
test -x cryptopp -a -x cryptopp/src || git clone https://github.com/mmoss/cryptopp.git | ||
test -x jsoncpp -a -x jsoncpp/include || git clone https://github.com/open-source-parsers/jsoncpp.git | ||
test -x boost_1_57_0 -a -x 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 | ||
) | ||
echo -en 'travis_fold:end:installing_dependencies\\r' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
# | ||
|
||
set -e | ||
|
||
cd solidity | ||
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) | ||
cp build/solc/soljson.js "../soljson-$VER-$DATE-$COMMIT.js" | ||
cd .. | ||
|
||
|
||
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 ci/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 | ||
cp ../soljson-*.js ./bin/ | ||
./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 | ||
if git commit -m "Added compiler version $LATEST" | ||
then | ||
git push origin gh-pages | ||
fi |