This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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 #1 from sergmetelin/master
Merge build.sh and eoscpp.
- Loading branch information
Showing
3 changed files
with
211 additions
and
38 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,71 @@ | ||
#!/usr/bin/env bash | ||
|
||
########################################################################## | ||
# This is EOS bootstrapper script for Linux and OS X. | ||
# This file was downloaded from https://github.com/EOSIO/eos | ||
# Feel free to change this file to fit your needs. | ||
########################################################################## | ||
|
||
VERSION=1.0 | ||
|
||
# Define directories. | ||
WORK_DIR=$PWD | ||
BUILD_DIR=${WORK_DIR}/build | ||
TEMP_DIR=/tmp | ||
BINARYEN_BIN=/opt/binaryen/bin/ | ||
OPENSSL_ROOT_DIR=/usr/local/opt/openssl | ||
OPENSSL_LIBRARIES=/usr/local/opt/openssl/lib | ||
WASM_LLVM_CONFIG=/opt/wasm/bin/llvm-config | ||
|
||
# Target architectures | ||
ARCH=$1 | ||
TARGET_ARCHS="ubuntu darwin" | ||
|
||
# Check ARCH | ||
if [[ $# > 1 ]]; then | ||
echo "" | ||
echo "Error: too many arguments" | ||
exit 1 | ||
fi | ||
|
||
if [[ $# < 1 ]]; then | ||
echo "" | ||
echo "Usage: bash build.sh TARGET" | ||
echo "" | ||
echo "Targets: $TARGET_ARCHS" | ||
exit 1 | ||
fi | ||
|
||
if [[ $ARCH =~ [[:space:]] || ! $TARGET_ARCHS =~ (^|[[:space:]])$ARCH([[:space:]]|$) ]]; then | ||
echo "" | ||
echo ">>> WRONG ARCHITECTURE \"$ARCH\"" | ||
exit 1 | ||
fi | ||
|
||
echo "" | ||
echo ">>> ARCHITECTURE \"$ARCH\"" | ||
|
||
# Debug flags | ||
INSTALL_DEPS=1 | ||
COMPILE_EOS=1 | ||
COMPILE_CONTRACTS=1 | ||
|
||
# Define default arguments. | ||
CMAKE_BUILD_TYPE=Debug | ||
|
||
# Install dependencies | ||
if [ ${INSTALL_DEPS} == "1" ]; then | ||
|
||
print ">> Install dependencies" | ||
. ${WORK_DIR}/scripts/install_dependencies.sh | ||
|
||
fi | ||
|
||
# Create the build dir | ||
cd ${WORK_DIR} | ||
mkdir -p ${BUILD_DIR} | ||
cd ${BUILD_DIR} | ||
|
||
# Build EOS | ||
cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DWASM_LLVM_CONFIG=${WASM_LLVM_CONFIG} -DBINARYEN_BIN=${BINARYEN_BIN} -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} -DOPENSSL_LIBRARIES=${OPENSSL_LIBRARIES} .. | ||
make -j4 |
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 @@ | ||
# Install dependencies script | ||
|
||
if [ $ARCH == "ubuntu" ]; then | ||
# install dev toolkit | ||
sudo apt-get update | ||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - | ||
sudo apt-get install clang-4.0 lldb-4.0 cmake make \ | ||
libbz2-dev libssl-dev libgmp3-dev \ | ||
autotools-dev build-essential \ | ||
libbz2-dev libicu-dev python-dev \ | ||
autoconf libtool git | ||
OPENSSL_ROOT_DIR=/usr/local/opt/openssl | ||
OPENSSL_LIBRARIES=/usr/local/opt/openssl/lib | ||
|
||
# install boost | ||
cd ${TEMP_DIR} | ||
export BOOST_ROOT=${HOME}/opt/boost_1_64_0 | ||
curl -L https://sourceforge.net/projects/boost/files/boost/1.64.0/boost_1_64_0.tar.bz2 > boost_1.64.0.tar.bz2 | ||
tar xvf boost_1.64.0.tar.bz2 | ||
cd boost_1_64_0/ | ||
./bootstrap.sh "--prefix=$BOOST_ROOT" | ||
./b2 install | ||
rm -rf ${TEMP_DIR}/boost_1_64_0/ | ||
|
||
# install secp256k1-zkp (Cryptonomex branch) | ||
cd ${TEMP_DIR} | ||
git clone https://github.com/cryptonomex/secp256k1-zkp.git | ||
cd secp256k1-zkp | ||
./autogen.sh | ||
./configure | ||
make | ||
sudo make install | ||
rm -rf cd ${TEMP_DIR}/secp256k1-zkp | ||
|
||
# install binaryen | ||
cd ${TEMP_DIR} | ||
git clone https://github.com/WebAssembly/binaryen | ||
cd binaryen | ||
git checkout tags/1.37.14 | ||
cmake . && make | ||
mkdir -p ${HOME}/opt/binaryen/ | ||
mv ${TEMP_DIR}/binaryen/bin ${HOME}/opt/binaryen/ | ||
rm -rf ${TEMP_DIR}/binaryen | ||
BINARYEN_BIN=${HOME}/opt/binaryen/bin | ||
|
||
# build llvm with wasm build target: | ||
cd ${TEMP_DIR} | ||
mkdir wasm-compiler | ||
cd wasm-compiler | ||
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git | ||
cd llvm/tools | ||
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git | ||
cd .. | ||
mkdir build | ||
cd build | ||
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=${HOME}/opt/wasm -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release ../ | ||
make -j4 install | ||
rm -rf ${TEMP_DIR}/wasm-compiler | ||
WASM_LLVM_CONFIG=${HOME}/opt/wasm/bin/llvm-config | ||
fi | ||
|
||
if [ $ARCH == "darwin" ]; then | ||
DEPS="git automake libtool boost openssl llvm@4 gmp wget" | ||
brew update | ||
brew install --force $DEPS | ||
brew unlink $DEPS && brew link --force $DEPS | ||
# LLVM_DIR=/usr/local/Cellar/llvm/4.0.1/lib/cmake/llvm | ||
|
||
# install secp256k1-zkp (Cryptonomex branch) | ||
cd ${TEMP_DIR} | ||
git clone https://github.com/cryptonomex/secp256k1-zkp.git | ||
cd secp256k1-zkp | ||
./autogen.sh | ||
./configure | ||
make | ||
sudo make install | ||
rm -rf cd ${TEMP_DIR}/secp256k1-zkp | ||
|
||
# Install binaryen v1.37.14: | ||
cd ${TEMP_DIR} | ||
git clone https://github.com/WebAssembly/binaryen | ||
cd binaryen | ||
git checkout tags/1.37.14 | ||
cmake . && make | ||
mkdir /usr/local/binaryen | ||
mv ${TEMP_DIR}/binaryen/bin /usr/local/binaryen | ||
ln -s /usr/local/binaryen/bin/* /usr/local | ||
rm -rf ${TEMP_DIR}/binaryen | ||
BINARYEN_BIN=/usr/local/binaryen/bin/ | ||
|
||
# Build LLVM and clang for WASM: | ||
cd ${TEMP_DIR} | ||
mkdir wasm-compiler | ||
cd wasm-compiler | ||
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git | ||
cd llvm/tools | ||
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git | ||
cd .. | ||
mkdir build | ||
cd build | ||
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local/wasm -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release ../ | ||
make -j4 install | ||
rm -rf ${TEMP_DIR}/wasm-compiler | ||
WASM_LLVM_CONFIG=/usr/local/wasm/bin/llvm-config | ||
|
||
fi |
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