├── .gitignore ├── cross-build ├── ct-ng │ ├── conf │ │ └── wandboard.config │ └── ct-ng.sh └── ethereum │ ├── package.sh │ ├── curl.sh │ ├── gmp.sh │ ├── jsoncpp.sh │ ├── mhd.sh │ ├── leveldb.sh │ ├── cryptopp.sh │ ├── libjson-rpc-cpp.sh │ ├── cpp-ethereum.sh │ ├── boost.sh │ ├── download.sh │ ├── main.sh │ ├── cryptopp-setenv-embedded.sh │ ├── setup.sh │ └── utils.sh ├── Dockerfile-xcompiler ├── .travis.yml ├── Dockerfile-crosseth ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | browse.VC.db 2 | -------------------------------------------------------------------------------- /cross-build/ct-ng/conf/wandboard.config: -------------------------------------------------------------------------------- 1 | # comments and empty lines are ok 2 | # 3 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | 18 | CT_ARCH_ARCH="armv5", 19 | CT_ARCH_FLOAT_HW=y, # y and n seem not to have double-quotes in the original config 20 | CT_ARCH_FLOAT_SW=, # an missing value will comment out the corresponding key 21 | CT_ARCH_32=y, 22 | CT_ARCH_FLOAT="hard" 23 | 24 | -------------------------------------------------------------------------------- /cross-build/ethereum/package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # packages up all that is needed for eth to run 3 | # 4 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | 19 | # =========================================================================== 20 | set -e 21 | 22 | INSTALL_DIR=${1?} && shift 23 | CPP_ETHEREUM_BIN_DIR=${1?} && shift 24 | 25 | RESULT_FILE_NAME="crosseth.tgz" 26 | 27 | TMP_DIR=$(mktemp -d) 28 | mkdir ${TMP_DIR?}/eth 29 | mkdir ${TMP_DIR?}/eth/lib 30 | cp -r ${CPP_ETHEREUM_BIN_DIR?} ${TMP_DIR?}/eth/ 31 | for FILE in $(find ${INSTALL_DIR?} | grep '\.so'); do 32 | cp ${FILE?} ${TMP_DIR?}/eth/lib 33 | done 34 | tar --remove-files -C ${TMP_DIR?} -zcf ~/${RESULT_FILE_NAME?} ./eth 35 | rmdir ${TMP_DIR?} 36 | echo -e "INSTRUCTIONS:\n\n- Uncompress the resulting file ('~/${RESULT_FILE_NAME?}') on the device\n- cd into the bin directory inside it\n- run:\n export LD_LIBRARY_PATH=/path/to/lib # lib folder inside the tarball\n ./eth # in bin" 37 | 38 | # =========================================================================== 39 | -------------------------------------------------------------------------------- /cross-build/ethereum/curl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # configures, cross-compiles and installs CUrl (http://curl.haxx.se/) 3 | # 4 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | 19 | # =========================================================================== 20 | set -e 21 | SCRIPT_DIR=$(dirname $0) && ([ -n "$SETUP" ] && ${SETUP?}) || source ${SCRIPT_DIR?}/setup.sh $* 22 | cd_clone ${SOURCES_DIR?}/curl ${WORK_DIR?}/curl 23 | export_cross_compiler && sanity_check_cross_compiler 24 | 25 | 26 | # =========================================================================== 27 | # configuration: 28 | 29 | section_configuring curl 30 | ./configure \ 31 | --build="${AUTOCONF_BUILD_ARCHITECTURE}" \ 32 | --host="${AUTOCONF_HOST_ARCHITECTURE}" \ 33 | --prefix="${INSTALLS_DIR?}/curl" 34 | return_code $? 35 | grep ${TARGET_ARCHITECTURE?} ./Makefile # sanity check 36 | 37 | 38 | # =========================================================================== 39 | # cross-compile: 40 | 41 | section_cross_compiling curl 42 | make -j2 43 | return_code $? 44 | 45 | 46 | # =========================================================================== 47 | # install: 48 | 49 | section_installing curl 50 | make install # destination is set during configuration phase 51 | return_code $? 52 | 53 | 54 | # =========================================================================== 55 | 56 | section "done" curl 57 | tree -L 3 "${INSTALLS_DIR?}/curl" 58 | 59 | 60 | # =========================================================================== 61 | -------------------------------------------------------------------------------- /cross-build/ethereum/gmp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # configures, cross-compiles and installs GMP (https://gmplib.org/) 3 | # 4 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | 19 | # =========================================================================== 20 | set -e 21 | if [ ! -f "./setup.sh" ]; then echo "ERROR: wrong pwd"; exit 1; fi 22 | ([ -n "$SETUP" ] && ${SETUP?}) || source ./setup.sh $* 23 | cd_clone ${SOURCES_DIR?}/gmp ${WORK_DIR?}/gmp 24 | export_cross_compiler && sanity_check_cross_compiler 25 | 26 | 27 | # =========================================================================== 28 | # configuration: autoconf 29 | 30 | section_configuring gmp 31 | ./configure \ 32 | --build="${AUTOCONF_BUILD_ARCHITECTURE}" \ 33 | --host="${AUTOCONF_HOST_ARCHITECTURE}" \ 34 | --prefix="${INSTALLS_DIR?}/gmp" 35 | return_code $? 36 | grep ${TARGET_ARCHITECTURE?} ./Makefile >/dev/null # sanity check 37 | 38 | 39 | # =========================================================================== 40 | # cross-compile: 41 | 42 | section_cross_compiling gmp 43 | make -j2 44 | return_code $? 45 | 46 | 47 | # =========================================================================== 48 | # install: 49 | 50 | section_installing gmp 51 | make install # destination is set during configuration phase 52 | return_code $? 53 | 54 | 55 | # =========================================================================== 56 | 57 | section "done" gmp 58 | tree "${INSTALLS_DIR?}/gmp" 59 | 60 | 61 | # =========================================================================== 62 | 63 | -------------------------------------------------------------------------------- /cross-build/ethereum/jsoncpp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # configures, cross-compiles and installs Json CPP (https://github.com/open-source-parsers/jsoncpp) 3 | # 4 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | 19 | # =========================================================================== 20 | set -e 21 | SCRIPT_DIR=$(dirname $0) && ([ -n "$SETUP" ] && ${SETUP?}) || source ${SCRIPT_DIR?}/setup.sh $* 22 | cd ${SOURCES_DIR?}/jsoncpp && git checkout ${JSONCPP_VERSION?} 23 | export_cross_compiler && sanity_check_cross_compiler 24 | cd_clone ${SOURCES_DIR?}/jsoncpp ${WORK_DIR?}/jsoncpp 25 | 26 | 27 | # =========================================================================== 28 | # configuration: 29 | 30 | section_configuring jsoncpp 31 | 32 | cmake \ 33 | ${SOURCES_DIR?}/jsoncpp \ 34 | -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE?} \ 35 | -DBUILD_STATIC_LIBS=ON \ 36 | -DBUILD_SHARED_LIBS=OFF \ 37 | -DJSONCPP_WITH_TESTS=OFF \ 38 | -DARCHIVE_INSTALLS_DIR="." # TODO: enforce 39 | return_code $? 40 | 41 | 42 | # =========================================================================== 43 | # cross-compile: 44 | 45 | section_cross_compiling jsoncpp 46 | make -j2 47 | return_code $? 48 | 49 | 50 | # =========================================================================== 51 | # install: 52 | 53 | section_installing jsoncpp 54 | make DESTDIR="${INSTALLS_DIR?}/jsoncpp" install 55 | return_code $? 56 | 57 | # =========================================================================== 58 | 59 | section "done" jsoncpp 60 | tree ${INSTALLS_DIR?}/jsoncpp 61 | 62 | 63 | # =========================================================================== 64 | -------------------------------------------------------------------------------- /cross-build/ethereum/mhd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # configures, cross-compiles and installs MHD (https://www.gnu.org/software/libmicrohttpd/) 3 | # 4 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | 19 | # =========================================================================== 20 | set -e 21 | if [ ! -f "./setup.sh" ]; then echo "ERROR: wrong pwd"; exit 1; fi 22 | ([ -n "$SETUP" ] && ${SETUP?}) || source ./setup.sh $* 23 | cd_clone ${SOURCES_DIR?}/libmicrohttpd ${WORK_DIR?}/libmicrohttpd 24 | export_cross_compiler && sanity_check_cross_compiler 25 | 26 | 27 | # =========================================================================== 28 | # configuration: autoconf 29 | 30 | section_configuring libmicrohttpd 31 | 32 | # ensure configure picks up host version of automake aclocal 33 | touch configure.ac aclocal.m4 configure Makefile.am Makefile.in 34 | 35 | ./configure \ 36 | --build="${AUTOCONF_BUILD_ARCHITECTURE}" \ 37 | --host="${AUTOCONF_HOST_ARCHITECTURE}" \ 38 | --prefix="${INSTALLS_DIR?}/libmicrohttpd" 39 | return_code $? 40 | grep ${TARGET_ARCHITECTURE?} ./Makefile >/dev/null # sanity check 41 | 42 | 43 | # =========================================================================== 44 | # cross-compile: 45 | 46 | section_cross_compiling libmicrohttpd 47 | make -j2 48 | return_code $? 49 | 50 | 51 | # =========================================================================== 52 | # install: 53 | 54 | section_installing libmicrohttpd 55 | make install # destination is set during configuration phase 56 | return_code $? 57 | 58 | 59 | # =========================================================================== 60 | 61 | section "done" libmicrohttpd 62 | tree "${INSTALLS_DIR?}/libmicrohttpd" 63 | -------------------------------------------------------------------------------- /cross-build/ethereum/leveldb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # configures, cross-compiles and installs LevelDB (https://github.com/google/leveldb) 3 | # 4 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | 19 | # =========================================================================== 20 | set -e 21 | SCRIPT_DIR=$(dirname $0) && ([ -n "$SETUP" ] && ${SETUP?}) || source ${SCRIPT_DIR?}/setup.sh $* 22 | cd ${SOURCES_DIR?}/leveldb && git checkout ${LEVELDB_VERSION?} 23 | cd_clone ${SOURCES_DIR?}/leveldb ${WORK_DIR?}/leveldb 24 | export_cross_compiler && sanity_check_cross_compiler 25 | 26 | 27 | # --------------------------------------------------------------------------- 28 | make clean 29 | return_code $? 30 | 31 | # =========================================================================== 32 | # no configuration phase (bare Makefile) 33 | : 34 | 35 | # =========================================================================== 36 | # cross-compile: 37 | 38 | section_cross_compiling leveldb 39 | make -j2 40 | return_code $? 41 | 42 | 43 | # =========================================================================== 44 | # install: no install target, emulate for consistency 45 | 46 | section_installing leveldb 47 | mkdir ${INSTALLS_DIR?}/leveldb 48 | rm ${INSTALLS_DIR?}/leveldb/lib 2>&- || : 49 | rm ${INSTALLS_DIR?}/leveldb/include 2>&- || : 50 | mkdir ${INSTALLS_DIR?}/leveldb/lib 51 | cp ${WORK_DIR?}/leveldb/lib* ${INSTALLS_DIR?}/leveldb/lib 52 | cp -r ${WORK_DIR?}/leveldb/include ${INSTALLS_DIR?}/leveldb 53 | 54 | # =========================================================================== 55 | 56 | section "done" leveldb 57 | tree ${INSTALLS_DIR?}/leveldb 58 | 59 | 60 | # =========================================================================== 61 | -------------------------------------------------------------------------------- /cross-build/ethereum/cryptopp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # configures, cross-compiles and installs CryptoPP (https://www.cryptopp.com/) 3 | # 4 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | 19 | # =========================================================================== 20 | set -e 21 | SCRIPT_DIR=$(dirname $0) && ([ -n "$SETUP" ] && ${SETUP?}) || source ${SCRIPT_DIR?}/setup.sh $* 22 | cd ${SOURCES_DIR?}/cryptopp && git checkout ${CRYPTOPP_VERSION?} 23 | export_cross_compiler && sanity_check_cross_compiler 24 | cd_clone ${SOURCES_DIR?}/cryptopp ${WORK_DIR?}/cryptopp 25 | 26 | 27 | # =========================================================================== 28 | # cross-compile: 29 | # See https://www.cryptopp.com/wiki/ARM_Embedded_(Command_Line) 30 | # 31 | # TODO We need some conditionals here to cope with all of the different build 32 | # variants which we have. Also, I think this GNUmakefile-cross approach is 33 | # likely Ubuntu-specific, so will need something different done for iOS. 34 | 35 | section_cross_compiling cryptopp 36 | tree -L 3 /usr/arm-linux-gnueabi/include/c++ 37 | ${INITIAL_DIR?}/cryptopp-setenv-embedded.sh 38 | make -j2 -f GNUmakefile-cross 39 | 40 | 41 | # =========================================================================== 42 | # install: DESTDIR does not work, so emulate 43 | 44 | section_installing cryptopp 45 | mkdir ${INSTALLS_DIR?}/cryptopp 46 | rm ${INSTALLS_DIR?}/cryptopp/lib 2>&- || : 47 | rm $HOME/cryptopp 2>&- || : 48 | mkdir ${INSTALLS_DIR?}/cryptopp/lib 49 | cp ${WORK_DIR?}/cryptopp/lib* ${INSTALLS_DIR?}/cryptopp/lib 50 | ln -s ${WORK_DIR?}/cryptopp $HOME/cryptopp # hack: somehow this is necessary for includes to work with cryptopp 51 | 52 | 53 | # =========================================================================== 54 | 55 | section "done" cryptopp 56 | tree -L 3 "${INSTALLS_DIR?}/cryptopp" 57 | -------------------------------------------------------------------------------- /cross-build/ethereum/libjson-rpc-cpp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # configures, cross-compiles and installs libjson RPC CPP (https://github.com/cinemast/libjson-rpc-cpp) 3 | # depends on CUrl (see dedicated script) 4 | # 5 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | 20 | # =========================================================================== 21 | set -e 22 | SCRIPT_DIR=$(dirname $0) && ([ -n "$SETUP" ] && ${SETUP?}) || source ${SCRIPT_DIR?}/setup.sh $* 23 | cd ${SOURCES_DIR?}/libjson-rpc-cpp && git checkout ${LIBJSON_RPC_CPP_VERSION?} 24 | cd_if_not_exists ${WORK_DIR?}/libjson-rpc-cpp 25 | export_cross_compiler && sanity_check_cross_compiler 26 | 27 | 28 | # =========================================================================== 29 | # configuration: 30 | 31 | section_configuring libjson-rpc-cpp 32 | set_cmake_paths "jsoncpp:curl:libmicrohttpd" 33 | cmake \ 34 | ${SOURCES_DIR?}/libjson-rpc-cpp \ 35 | -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE?} \ 36 | -DHTTP_SERVER=YES \ 37 | -DHTTP_CLIENT=YES \ 38 | -DUNIX_DOMAIN_SOCKET_SERVER=NO \ 39 | -DUNIX_DOMAIN_SOCKET_CLIENT=NO \ 40 | -DCOMPILE_TESTS=NO \ 41 | -DCOMPILE_STUBGEN=NO \ 42 | -DCOMPILE_EXAMPLES=NO \ 43 | -DJSONCPP_INCLUDE_PREFIX=json 44 | return_code $? 45 | 46 | 47 | # =========================================================================== 48 | # cross-compile: 49 | 50 | section_cross_compiling libjson-rpc-cpp 51 | make -j2 52 | return_code $? 53 | 54 | 55 | # =========================================================================== 56 | # install: 57 | 58 | section_installing libjson-rpc-cpp 59 | make DESTDIR="${INSTALLS_DIR?}/libjson-rpc-cpp" install 60 | return_code $? 61 | 62 | 63 | # =========================================================================== 64 | 65 | section "done" libjson-rpc-cpp 66 | tree ${INSTALLS_DIR?}/libjson-rpc-cpp 67 | 68 | 69 | # =========================================================================== 70 | -------------------------------------------------------------------------------- /cross-build/ethereum/cpp-ethereum.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #------------------------------------------------------------------------------ 4 | # Bash script for cross-building cpp-ethereum for ARM Linux devices. 5 | # 6 | # http://www.ethdocs.org/en/latest/ethereum-clients/cpp-ethereum/ 7 | # https://github.com/doublethinkco/cpp-ethereum-cross 8 | # 9 | # ------------------------------------------------------------------------------ 10 | # This file is part of cpp-ethereum-cross. 11 | # 12 | # Licensed under the Apache License, Version 2.0 (the "License"); 13 | # you may not use this file except in compliance with the License. 14 | # You may obtain a copy of the License at 15 | # 16 | # http://www.apache.org/licenses/LICENSE-2.0 17 | # 18 | # Unless required by applicable law or agreed to in writing, software 19 | # distributed under the License is distributed on an "AS IS" BASIS, 20 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | # See the License for the specific language governing permissions and 22 | # limitations under the License. 23 | # 24 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 25 | #------------------------------------------------------------------------------ 26 | 27 | 28 | # =========================================================================== 29 | set -e 30 | SCRIPT_DIR=$(dirname $0) && ([ -n "$SETUP" ] && ${SETUP?}) || source ${SCRIPT_DIR?}/setup.sh $* 31 | cd_clone ${INITIAL_DIR?}/../.. ${WORK_DIR?}/cpp-ethereum 32 | export_cross_compiler && sanity_check_cross_compiler 33 | 34 | 35 | # --------------------------------------------------------------------------- 36 | set_cmake_paths "boost:cryptopp:curl:gmp:jsoncpp:leveldb::libjson-rpc-cpp:libmicrohttpd" 37 | 38 | mkdir build 39 | cd build 40 | cmake \ 41 | .. \ 42 | -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE?} \ 43 | -DMINIUPNPC=OFF \ 44 | -DETHASHCL=OFF \ 45 | -DEVMJIT=OFF \ 46 | -DETH_JSON_RPC_STUB=OFF 47 | return_code $? 48 | cd .. 49 | 50 | # =========================================================================== 51 | # cross-compile: 52 | 53 | section_cross_compiling cpp-ethereum 54 | cd build 55 | make -j2 56 | return_code $? 57 | cd .. 58 | 59 | 60 | # =========================================================================== 61 | # install: 62 | 63 | section_installing cpp-ethereum 64 | cd build 65 | make DESTDIR="${INSTALLS_DIR?}/cpp-ethereum" install 66 | return_code $? 67 | cd .. 68 | 69 | 70 | # =========================================================================== 71 | 72 | section "done" cpp-ethereum 73 | tree ${INSTALLS_DIR?}/cpp-ethereum 74 | -------------------------------------------------------------------------------- /Dockerfile-xcompiler: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------- 2 | # Dockerfile for building an ARM cross-compiler which we can use to build 3 | # Ethereum C++ components for mobile Linux platforms such as Tizen, Sailfish 4 | # and Ubuntu Touch. 5 | # 6 | # See http://ethereum.org/ to learn more about Ethereum. 7 | # See http://doublethink.co/ to learn more about doublethinkco 8 | # 9 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 10 | # 11 | # Licensed under the Apache License, Version 2.0 (the "License"); 12 | # you may not use this file except in compliance with the License. 13 | # You may obtain a copy of the License at 14 | # 15 | # http://www.apache.org/licenses/LICENSE-2.0 16 | # 17 | # Unless required by applicable law or agreed to in writing, software 18 | # distributed under the License is distributed on an "AS IS" BASIS, 19 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | # See the License for the specific language governing permissions and 21 | # limitations under the License. 22 | #------------------------------------------------------------------------------- 23 | 24 | FROM ubuntu:14.04 25 | MAINTAINER Bob Summerwill 26 | 27 | # So we DO appear to need this, perhaps because the contents in the package 28 | # repository have changed since the base Dockerfile image was created? 29 | # Not 100% sure, but without this we get errors about specific versions 30 | # not being available in later steps. 31 | RUN apt-get update 32 | 33 | # External packages required by our scripts themselves 34 | RUN apt-get install -y \ 35 | bzip2=1.0.6-5 \ 36 | git=1:1.9.1-1ubuntu0.1 \ 37 | tree=1.6.0-1 \ 38 | unzip=6.0-9ubuntu1.5 \ 39 | wget=1.15-1ubuntu1.14.04.1 40 | 41 | # External packages required by crosstool-ng 42 | RUN apt-get update 43 | RUN apt-get install --fix-missing 44 | RUN apt-get install -y \ 45 | automake=1:1.14.1-2ubuntu1 \ 46 | bison=2:3.0.2.dfsg-2 \ 47 | build-essential=11.6ubuntu6 \ 48 | cvs=2:1.12.13+real-12 \ 49 | flex=2.5.35-10.1ubuntu2 \ 50 | gawk=1:4.0.1+dfsg-2.1ubuntu2 \ 51 | gperf=3.0.4-1 \ 52 | libncurses5-dev=5.9+20140118-1ubuntu1 \ 53 | libtool=2.4.2-1.7ubuntu1 \ 54 | libexpat1-dev=2.1.0-4ubuntu1.1 \ 55 | texinfo=5.2.0.dfsg.1-2 56 | 57 | # Switch to a normal user account. crosstool-ng refuses to run as root. 58 | RUN useradd -ms /bin/bash xcompiler 59 | USER xcompiler 60 | 61 | # Copy our cross-building scripts into the container 62 | ADD cross-build/ /home/xcompiler/webthree-umbrella/cross-build/ 63 | 64 | # And switch the working directory to the cross-compiler scripts 65 | WORKDIR /home/xcompiler/webthree-umbrella/cross-build/ct-ng 66 | 67 | -------------------------------------------------------------------------------- /cross-build/ethereum/boost.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # configures, cross-compiles and installs Boost (http://www.boost.org/) 3 | # 4 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | 19 | # =========================================================================== 20 | set -e 21 | SCRIPT_DIR=$(dirname $0) && ([ -n "$SETUP" ] && ${SETUP?}) || source ${SCRIPT_DIR?}/setup.sh $* 22 | cd_clone ${SOURCES_DIR?}/boost ${WORK_DIR?}/boost 23 | export_cross_compiler && sanity_check_cross_compiler 24 | 25 | 26 | # =========================================================================== 27 | # configuration: Boost.Build 28 | 29 | section_configuring boost 30 | readonly BOOST_LIBRARIES="chrono,filesystem,regex,random,thread,date_time,program_options,test" # test --> unit_test_framework (throws warnings...) 31 | ./bootstrap.sh --with-libraries="${BOOST_LIBRARIES?}" # TODO: how to use an actual work dir rather than current dir? 32 | return_code $? 33 | 34 | 35 | # --------------------------------------------------------------------------- 36 | section_hacking boost 37 | generic_hack \ 38 | ./project-config.jam \ 39 | '{gsub(/using gcc/,"using gcc : arm : '${GCC_CROSS_COMPILER?}'")}1' 40 | grep ${GCC_CROSS_COMPILER_PATTERN?} ./project-config.jam 2>&- || { echo "ERROR: could not find '${GCC_CROSS_COMPILER?}' in project-config.jam"; exit 1; } # sanity check 41 | 42 | 43 | # =========================================================================== 44 | # cross-compile: 45 | 46 | section_cross_compiling boost 47 | ./b2 \ 48 | install \ 49 | -j 2 \ 50 | --debug-configuration \ 51 | --prefix=${INSTALLS_DIR?}/boost # also installs (expect some warnings) - takes a while 52 | return_code $? 53 | 54 | 55 | # =========================================================================== 56 | # install: 57 | 58 | section_installing boost 59 | ls ${INSTALLS_DIR?}/boost/lib/libboost_*.a # sanity check; already installed (see previous step) 60 | return_code $? 61 | 62 | 63 | # =========================================================================== 64 | 65 | section "done" boost 66 | tree -L 2 "${INSTALLS_DIR?}/boost" 67 | 68 | 69 | # =========================================================================== 70 | -------------------------------------------------------------------------------- /cross-build/ethereum/download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # downloads all components and dependencies (this will take a while) 3 | # 4 | # TODO: turn into loop 5 | # 6 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | 21 | # =========================================================================== 22 | set -e 23 | 24 | COMPONENTS=${1?} && shift # e.g "curl:mhd" 25 | if [ ! -f "./setup.sh" ]; then echo "ERROR: wrong pwd"; exit 1; fi 26 | ([ -n "$SETUP" ] && ${SETUP?}) || source ./setup.sh $* 27 | 28 | 29 | # --------------------------------------------------------------------------- 30 | if [ -n "$(contains ${COMPONENTS?} boost)" ]; then 31 | section_downloading boost 32 | fetch ${BOOST_DOWNLOAD_URL?} ${SOURCES_DIR?}/boost 33 | return_code $? 34 | else 35 | echo "skipping boost" 36 | fi 37 | 38 | # --------------------------------------------------------------------------- 39 | if [ -n "$(contains ${COMPONENTS?} cryptopp)" ]; then 40 | section_downloading cryptopp 41 | fetch ${CRYPTOPP_DOWNLOAD_URL?} ${SOURCES_DIR?}/cryptopp 42 | return_code $? 43 | else 44 | echo "skipping cryptopp" 45 | fi 46 | 47 | # --------------------------------------------------------------------------- 48 | if [ -n "$(contains ${COMPONENTS?} curl)" ]; then 49 | section_downloading curl 50 | fetch ${CURL_DOWNLOAD_URL?} ${SOURCES_DIR?}/curl 51 | return_code $? 52 | else 53 | echo "skipping curl" 54 | fi 55 | 56 | # --------------------------------------------------------------------------- 57 | if [ -n "$(contains ${COMPONENTS?} gmp)" ]; then 58 | section_downloading gmp 59 | fetch ${GMP_DOWNLOAD_URL?} ${SOURCES_DIR?}/gmp 60 | return_code $? 61 | 62 | else 63 | echo "skipping gmp" 64 | fi 65 | 66 | # --------------------------------------------------------------------------- 67 | if [ -n "$(contains ${COMPONENTS?} jsoncpp)" ]; then 68 | section_downloading jsoncpp 69 | fetch ${JSONCPP_DOWNLOAD_URL?} ${SOURCES_DIR?}/jsoncpp 70 | return_code $? 71 | else 72 | echo "skipping jsoncpp" 73 | fi 74 | 75 | # --------------------------------------------------------------------------- 76 | if [ -n "$(contains ${COMPONENTS?} leveldb)" ]; then 77 | section_downloading leveldb 78 | fetch ${LEVELDB_DOWNLOAD_URL?} ${SOURCES_DIR?}/leveldb 79 | return_code $? 80 | else 81 | echo "skipping leveldb" 82 | fi 83 | 84 | # --------------------------------------------------------------------------- 85 | if [ -n "$(contains ${COMPONENTS?} libjson-rpc-cpp)" ]; then 86 | section_downloading libjson-rpc-cpp 87 | fetch ${LIBJSON_RPC_CPP_DOWNLOAD_URL?} ${SOURCES_DIR?}/libjson-rpc-cpp 88 | return_code $? 89 | else 90 | echo "skipping libjson-rpc-cpp" 91 | fi 92 | 93 | # --------------------------------------------------------------------------- 94 | if [ -n "$(contains ${COMPONENTS?} libmicrohttpd)" ]; then 95 | section_downloading libmicrohttpd 96 | fetch ${MHD_DOWNLOAD_URL?} ${SOURCES_DIR?}/libmicrohttpd 97 | return_code $? 98 | else 99 | echo "skipping libmicrohttpd" 100 | fi 101 | 102 | 103 | # =========================================================================== 104 | 105 | section_downloading "done" 106 | tree -L 2 ${BASE_DIR?} 107 | 108 | 109 | # =========================================================================== 110 | 111 | -------------------------------------------------------------------------------- /cross-build/ct-ng/ct-ng.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # generates a cross-compiler 3 | # 4 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | 19 | # =========================================================================== 20 | set -e 21 | readonly BASE_DIR=${1?} && shift # provide base dir for ct-ng download/installs and cross-compiler (e.g. ~/ct-ng) 22 | readonly CONFIG_CHANGES=${1?} && shift # must provide a config file path (e.g. ./conf/wandboard) or "none" (which corresponds to armel) 23 | if [ ! -f "../ethereum/utils.sh" ]; then echo "ERROR: wrong pwd"; exit 1; fi 24 | source ../ethereum/utils.sh 25 | 26 | # TODO: enforce both or none 27 | TARGET_ARCHITECTURE=$1 28 | CTNG_VERSION="1.20.0" 29 | 30 | readonly DEFAULT_CONFIG_CHANGES_VALUE="none" 31 | 32 | # =========================================================================== 33 | readonly CTNG_DOWNLOAD_URL="http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-${CTNG_VERSION?}.tar.bz2" 34 | 35 | readonly CTNG_SOURCE_DIR="${BASE_DIR?}/src" 36 | readonly CTNG_INSTALL_DIR="${BASE_DIR?}/install" 37 | readonly CTNG_WORK_DIR="${BASE_DIR?}/wd" 38 | readonly LOGS_DIR="${BASE_DIR?}/logs" 39 | readonly CROSS_COMPILER_DIR="$HOME/x-tools/${TARGET_ARCHITECTURE?}" 40 | 41 | # =========================================================================== 42 | readonly DEPENDENCIES="" #bison flex texinfo gawk automake libtool cvs ncurses-dev gperf" # TODO: re-enable once dependencies are fleshed out 43 | hash ${DEPENDENCIES?} 2>&- || { echo -e "ERROR: missing one or more dependencies amongst:\n\t${DEPENDENCIES?}"; exit 1; } 44 | /sbin/ldconfig -p | grep libexpat || { echo "ERROR: libexpat is missing, please run 'sudo apt-get install libexpat1-dev'"; exit 1; } 45 | [ "${CONFIG_CHANGES?}" == "${DEFAULT_CONFIG_CHANGES_VALUE?}" ] || [ -f "${CONFIG_CHANGES?}" ] || { echo "ERROR: must provide config changes file or the value \"${DEFAULT_CONFIG_CHANGES_VALUE?}\" ('${CONFIG_CHANGES?}')" exit 1; } 46 | CONFIG_CHANGES_ABS="${PWD?}/${CONFIG_CHANGES?}" 47 | 48 | # =========================================================================== 49 | # download 50 | mkdir -p ${CTNG_SOURCE_DIR?} 51 | wget -O- ${CTNG_DOWNLOAD_URL?} | \ 52 | tar jxv -C ${CTNG_SOURCE_DIR?} 53 | 54 | # configure 55 | cd "${CTNG_SOURCE_DIR?}/crosstool-ng-${CTNG_VERSION?}" 56 | ./configure --prefix="${CTNG_INSTALL_DIR?}" 57 | 58 | # build 59 | make 60 | echo $? 61 | 62 | # install 63 | make install 64 | echo $? 65 | export PATH="$PATH:${CTNG_INSTALL_DIR?}/bin" 66 | 67 | # sanity check 68 | ct-ng --version 69 | 70 | # build cross-compiler (this takes a while...) 71 | mkdir -p ${CTNG_WORK_DIR?} 72 | cd ${CTNG_WORK_DIR?} 73 | ct-ng "arm-unknown-linux-gnueabi" # Default architecture? 74 | 75 | # modify config file to suit the need of a specific architecture 76 | if [ "${CONFIG_CHANGES?}" != "${DEFAULT_CONFIG_CHANGES_VALUE?}" ]; then 77 | echo "using:" 78 | echo 79 | cat ${CONFIG_CHANGES_ABS?} 80 | echo 81 | 82 | ct_ng_config_hack \ 83 | ${CTNG_WORK_DIR?}/.config \ 84 | ${CONFIG_CHANGES_ABS?} 85 | fi 86 | 87 | # build cross-compiler 88 | mkdir -p ${LOGS_DIR?} 89 | ct-ng build 90 | 91 | # =========================================================================== 92 | 93 | ls "${CROSS_COMPILER_DIR?}/bin/${TARGET_ARCHITECTURE?}-gcc" 94 | echo 95 | tree -L 3 "${CROSS_COMPILER_DIR?}" 96 | cd $HOME 97 | tar -zcf $HOME/xcompiler.tgz ./x-tools 98 | ls $HOME/xcompiler.tgz 99 | 100 | # =========================================================================== 101 | 102 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #------------------------------------------------------------------------------ 4 | # TravisCI configuration file for cpp-ethereum-cross. 5 | # 6 | # https://github.com/doublethinkco/cpp-ethereum-cross 7 | # 8 | # ------------------------------------------------------------------------------ 9 | # This file is part of cpp-ethereum-cross. 10 | # 11 | # Licensed under the Apache License, Version 2.0 (the "License"); 12 | # you may not use this file except in compliance with the License. 13 | # You may obtain a copy of the License at 14 | # 15 | # http://www.apache.org/licenses/LICENSE-2.0 16 | # 17 | # Unless required by applicable law or agreed to in writing, software 18 | # distributed under the License is distributed on an "AS IS" BASIS, 19 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | # See the License for the specific language governing permissions and 21 | # limitations under the License. 22 | # 23 | # Copyright (c) 2016 Kitsilano Software Inc (https://doublethink.co) 24 | #------------------------------------------------------------------------------ 25 | 26 | language: cpp 27 | services: 28 | - docker 29 | branches: 30 | # We need to whitelist the branches which we want to have "push" automation. 31 | # Pull request automation is not constrained to this set of branches. 32 | only: 33 | - master 34 | matrix: 35 | include: 36 | - os: linux 37 | dist: trusty 38 | sudo: required 39 | env: TRAVIS_BUILD_TYPE=armel 40 | - os: linux 41 | dist: trusty 42 | sudo: required 43 | env: TRAVIS_BUILD_TYPE=armhf 44 | - os: linux 45 | dist: trusty 46 | sudo: required 47 | env: TRAVIS_BUILD_TYPE=armel-apt 48 | - os: linux 49 | dist: trusty 50 | sudo: required 51 | env: TRAVIS_BUILD_TYPE=armhf-apt 52 | script: 53 | - sudo ./build-$TRAVIS_BUILD_TYPE.sh 54 | - cp /tmp/crosseth.tgz /tmp/crosseth-$TRAVIS_BUILD_TYPE.tgz 55 | 56 | deploy: 57 | # This deploy target generates ZIPs per commit directly from the 58 | # master branch. These are just development binaries, not 59 | # official releases. We are currently missing automation for 60 | # the official releases. Those can be done manually easily 61 | # enough for the time being. 62 | # 63 | # Unlike the Appveyor GitHub Releases target, the support in TravisCI 64 | # seemingly doesn't provide a means for passing a description, tag, etc. 65 | # 66 | # The 'skip_cleanup' stops the workspace being cleaned out prior to 67 | # generation of the artifacts. Strange that we should explicitly 68 | # need to do that, but we do. 69 | # 70 | # Tokens in TravisCI can be generated a few different ways. Bob had 71 | # success using the 'travis' gem, and then using that gem to 72 | # create/edit this .travis.yml file, and then cut-and-pasting the 73 | # good bits back out of what it generated. The gem changes all the 74 | # whitespace and deletes comments, so cannot be used as-is. But 75 | # it does generate an appropriate auth token. 76 | # 77 | # See https://docs.travis-ci.com/user/deployment/releases 78 | # See https://blog.travis-ci.com/2013-01-28-token-token-token/ 79 | 80 | - provider: releases 81 | api_key: 82 | secure: Xr5y5FhiJbFRNesJZzgbXu2OYVsEqEAvc7ImxVVyHc4dhcHPozuUbuqtPDmsBnbcPUtJKb/TG0ltWkFW/NkdYTBhtF1taROPNt4DoZYyc05KFGQOJXPrZXDeE57SHdTU77GG16G3EYcThohzZDwA9ZGXvtkn83PxbATi3UC2CkMezKgYPd0JC9J2vc31yt3jpq4adt9mX14gG/F7eKcb6DJobjVPIgdMxv50vEu5Le/OEpajSeria8SJJWfJZ+xSj+0Adnn4lDpMmuOrBPKoEUWEtPlEvEhaKbtU4LH3b9Ee11G/yFFg7Rhv8iIUk5iYKM2hN6VqxbczdDBy85RQFFhPwfGqb3zryrO3k6csA2joc6zMN5K7nEJiGEFfE7WsAKX9JWuCAngz8nCxrO0RSZESPB34VCBdjSpRjEO3O/y8pezqv44VLrDPyjFVzDium2e6qVI2sN/BKR8DOBUbn/PXuDXPB/WQu6RwFwy91idrpmG7YgYlMVF/rH/RB8OagVsMyUy/HpzSzhGJU6EuoBtTL5QaQFy+1AWvXSRC+J/AZRpV/AApn6VyJu5yLm3TCao1ymEFyrfydmfSf4Q3aFawSAkIZREfvR3dR7jvQzvhOHY9iqTKkqCx0QL5ccIZKO50AihgKZ2BdzqgYEnH/ThdA0XhvP9v2cShHIbND88= 83 | file: /tmp/crosseth-$TRAVIS_BUILD_TYPE.tgz 84 | skip_cleanup: true 85 | on: 86 | repo: doublethinkco/cpp-ethereum-cross 87 | branch: master 88 | -------------------------------------------------------------------------------- /cross-build/ethereum/main.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # TODO: 4 | # - libjson RPC CPP seems to contact github somehow... 5 | # 6 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | 21 | # =========================================================================== 22 | set -e 23 | if [ ! -f "./setup.sh" ]; then echo "ERROR: wrong pwd"; exit 1; fi 24 | 25 | # =========================================================================== 26 | 27 | source ./utils.sh 28 | check_args $* # "armel"/"armhf" and "apt"/"manual" 29 | source ./setup.sh $* 30 | 31 | # =========================================================================== 32 | 33 | cd ${INITIAL_DIR?} && pwd && git log -1 --format="%h" 34 | cd ${INITIAL_DIR?}/../.. && pwd && git log -1 --format="%h" 35 | cd ${INITIAL_DIR?} 36 | 37 | # =========================================================================== 38 | # init: 39 | mkdir -p ${BASE_DIR?} 40 | mkdir -p ${SOURCES_DIR?} ${WORK_DIR?} ${LOGS_DIR?} ${INSTALLS_DIR?} 41 | 42 | # =========================================================================== 43 | # We *have* to download Boost because EthDependencies.cmake in 44 | # webthree-helper does a find_package() for it unconditionally, no matter 45 | # what we are actually building. 46 | # 47 | # NOTE - We use orphaned copies secp256k1 and scrypt which live inside 48 | # the webthree-helper package. Their oddness makes them pigs to 49 | # cross-build, because we are not running CMake from a repo root 50 | # directory 51 | 52 | ./download.sh \ 53 | "boost:cryptopp:curl:gmp:jsoncpp:leveldb:libjson-rpc-cpp:libmicrohttpd" \ 54 | "${TARGET_SUBTYPE?}" 55 | 56 | 57 | # Generate CMAKE_TOOLCHAIN_FILE, which is a configuration file used for 58 | # CMake cross-builds. It points to the C compiler, C++ compiler and a 59 | # handful of other options relevant to cross-builds. We pass that 60 | # configuration file to CMake as a parameter. 61 | # 62 | # See http://www.vtk.org/Wiki/CMake_Cross_Compiling for more info. 63 | 64 | mkdir -p ${INSTALLS_DIR?}/cmake 65 | get_cmake_toolchain_file_content > ${CMAKE_TOOLCHAIN_FILE?} 66 | echo && tree -L 1 ${BASE_DIR?} && \ 67 | echo -e "\n\n${CMAKE_TOOLCHAIN_FILE?}:\n$(cat ${CMAKE_TOOLCHAIN_FILE?})\n" 68 | 69 | 70 | # Layer 1 contains most of our external dependencies. All mutually independent. 71 | 72 | ./boost.sh "${TARGET_SUBTYPE?}" 73 | ./cryptopp.sh "${TARGET_SUBTYPE?}" 74 | ./curl.sh "${TARGET_SUBTYPE?}" 75 | ./gmp.sh "${TARGET_SUBTYPE?}" 76 | ./jsoncpp.sh "${TARGET_SUBTYPE?}" 77 | ./leveldb.sh "${TARGET_SUBTYPE?}" 78 | ./mhd.sh "${TARGET_SUBTYPE?}" 79 | 80 | # Layer 2 contains external dependencies which are dependent on other 81 | # external dependencies: 82 | # 83 | # - libjson-rpc-cpp depends on curl, jsoncpp and libmicrohtppd. 84 | # - secp256k1 depends on gmp (but we build it as part of cpp-ethereum) 85 | 86 | ./libjson-rpc-cpp.sh "${TARGET_SUBTYPE?}" 87 | 88 | 89 | # Layers 3 is the cpp-ethereum project itself, and also includes building 90 | # of libscrypt, secp256k1 implicitly, because orphaned copies of those 91 | # packages are nested in cpp-ethereum/utils. That directory also 92 | # contains an orphaned copy of json_spirit, but there is no build step 93 | # in that case, because it is a header-only library. 94 | 95 | ./cpp-ethereum.sh "${TARGET_SUBTYPE?}" 96 | 97 | 98 | # =========================================================================== 99 | printf '=%.0s' {1..75} && echo 100 | 101 | # =========================================================================== 102 | # produces a packaged-up file (will spit out instructions on how to use it) 103 | ./package.sh \ 104 | ${INSTALLS_DIR?} \ 105 | ${INSTALLS_DIR?}/cpp-ethereum/usr/local/bin 106 | 107 | # =========================================================================== 108 | echo "done." 109 | -------------------------------------------------------------------------------- /cross-build/ethereum/cryptopp-setenv-embedded.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # ==================================================================== 4 | # Sets the cross compile environment for ARM Embedded 5 | # 6 | # Written by Jeffrey Walton, noloader gmail account 7 | # 8 | # Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) 9 | # licensed under the Boost Software License 1.0, while the individual files 10 | # in the compilation are all public domain. 11 | # 12 | # This script only supports Ubuntu at the moment. It does not support Fedora. 13 | # See http://www.cryptopp.com/wiki/ARM_Embedded_(Command_Line) for details. 14 | # ==================================================================== 15 | 16 | # Unset old options 17 | 18 | unset IS_CROSS_COMPILE 19 | 20 | unset IS_IOS 21 | unset IS_ANDROID 22 | unset IS_ARM_EMBEDDED 23 | 24 | if [ -z "$ARM_EMBEDDED_TOOLCHAIN" ]; then 25 | ARM_EMBEDDED_TOOLCHAIN="/usr/bin" 26 | fi 27 | 28 | if [ ! -d "$ARM_EMBEDDED_TOOLCHAIN" ]; then 29 | echo "ARM_EMBEDDED_TOOLCHAIN is not valid" 30 | [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 31 | fi 32 | 33 | # Fedora 34 | # TOOL_PREFIX="arm-linux-gnu" 35 | 36 | # Ubuntu 37 | TOOL_PREFIX="arm-linux-gnueabi" 38 | 39 | export CPP="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-cpp" 40 | export CC="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-gcc" 41 | export CXX="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-g++" 42 | export LD="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-ld" 43 | export AR="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-ar" 44 | export AS="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-as" 45 | export RANLIB="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-ranlib" 46 | 47 | # Test a few of the tools 48 | if [ ! -e "$CPP" ]; then 49 | echo "ERROR: CPP is not valid" 50 | [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 51 | fi 52 | 53 | if [ ! -e "$CC" ]; then 54 | echo "ERROR: CC is not valid" 55 | [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 56 | fi 57 | 58 | if [ ! -e "$CXX" ]; then 59 | echo "ERROR: CXX is not valid" 60 | [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 61 | fi 62 | 63 | if [ ! -e "$AR" ]; then 64 | echo "ERROR: AR is not valid" 65 | [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 66 | fi 67 | 68 | if [ ! -e "$AS" ]; then 69 | echo "ERROR: AS is not valid" 70 | [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 71 | fi 72 | 73 | if [ ! -e "$RANLIB" ]; then 74 | echo "ERROR: RANLIB is not valid" 75 | [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 76 | fi 77 | 78 | if [ ! -e "$LD" ]; then 79 | echo "ERROR: LD is not valid" 80 | [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 81 | fi 82 | 83 | # The Crypto++ Makefile uses these to disable host settings like 84 | # IS_LINUX or IS_DARWIN, and incorporate settings for ARM_EMBEDDED 85 | export IS_ARM_EMBEDDED=1 86 | 87 | # GNUmakefile-cross uses these to to set CXXFLAGS for ARM_EMBEDDED 88 | if [ -z "$ARM_EMBEDDED_SYSROOT" ]; then 89 | export ARM_EMBEDDED_SYSROOT="/usr/arm-linux-gnueabi" 90 | fi 91 | 92 | if [ ! -d "$ARM_EMBEDDED_SYSROOT" ]; then 93 | echo "ERROR: ARM_EMBEDDED_SYSROOT is not valid" 94 | [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 95 | fi 96 | 97 | # Fix C++ header paths for Ubuntu 98 | ARM_EMBEDDED_TOOLCHAIN_VERSION="5" 99 | ARM_EMBEDDED_CXX_HEADERS="$ARM_EMBEDDED_SYSROOT/include/c++/$ARM_EMBEDDED_TOOLCHAIN_VERSION" 100 | 101 | if [ ! -d "$ARM_EMBEDDED_CXX_HEADERS" ]; then 102 | echo "ERROR: ARM_EMBEDDED_CXX_HEADERS is not valid" 103 | [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 104 | fi 105 | 106 | if [ ! -d "$ARM_EMBEDDED_CXX_HEADERS/arm-linux-gnueabi" ]; then 107 | echo "ERROR: ARM_EMBEDDED_CXX_HEADERS is not valid" 108 | [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 109 | fi 110 | 111 | # Finally, the flags... 112 | # export ARM_EMBEDDED_FLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -Wl,--fix-cortex-a8 -I$ARM_EMBEDDED_CXX_HEADERS -I$ARM_EMBEDDED_CXX_HEADERS/arm-linux-gnueabi" 113 | 114 | # Add additional flags below, like -mcpu=cortex-m3. 115 | if [ -z "$ARM_EMBEDDED_FLAGS" ]; then 116 | export ARM_EMBEDDED_FLAGS="-I$ARM_EMBEDDED_CXX_HEADERS -I$ARM_EMBEDDED_CXX_HEADERS/arm-linux-gnueabi" 117 | fi 118 | 119 | # And print stuff to wow the user... 120 | VERBOSE=1 121 | if [ ! -z "$VERBOSE" ] && [ "$VERBOSE" -ne 0 ]; then 122 | echo "CPP: $CPP" 123 | echo "CXX: $CXX" 124 | echo "AR: $AR" 125 | echo "LD: $LD" 126 | echo "RANLIB: $RANLIB" 127 | echo "ARM_EMBEDDED_TOOLCHAIN: $ARM_EMBEDDED_TOOLCHAIN" 128 | echo "ARM_EMBEDDED_CXX_HEADERS: $ARM_EMBEDDED_CXX_HEADERS" 129 | echo "ARM_EMBEDDED_FLAGS: $ARM_EMBEDDED_FLAGS" 130 | echo "ARM_EMBEDDED_SYSROOT: $ARM_EMBEDDED_SYSROOT" 131 | fi 132 | 133 | echo 134 | echo "*******************************************************************************" 135 | echo "It looks the the environment is set correctly. Your next step is" 136 | echo "build the library with 'make -f GNUmakefile-cross'" 137 | echo "*******************************************************************************" 138 | echo 139 | 140 | [ "$0" = "$BASH_SOURCE" ] && exit 0 || return 0 141 | -------------------------------------------------------------------------------- /Dockerfile-crosseth: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------- 2 | # Dockerfile for cross-compiling the Ethereum C++ components for mobile Linux 3 | # platforms such as Tizen, Sailfish and Ubuntu Touch. Assumes that we have 4 | # previous built the cross-compiler and can just copy that into our 5 | # container. 6 | # 7 | # See http://ethereum.org/ to learn more about Ethereum. 8 | # See http://doublethink.co/ to learn more about doublethinkco 9 | # 10 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 11 | # 12 | # Licensed under the Apache License, Version 2.0 (the "License"); 13 | # you may not use this file except in compliance with the License. 14 | # You may obtain a copy of the License at 15 | # 16 | # http://www.apache.org/licenses/LICENSE-2.0 17 | # 18 | # Unless required by applicable law or agreed to in writing, software 19 | # distributed under the License is distributed on an "AS IS" BASIS, 20 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | # See the License for the specific language governing permissions and 22 | # limitations under the License. 23 | #------------------------------------------------------------------------------- 24 | 25 | FROM ubuntu:wily 26 | MAINTAINER Bob Summerwill 27 | 28 | # External packages required by our scripts 29 | RUN apt-get update && apt-get install -y \ 30 | autoconf=2.69-8 \ 31 | bzip2=1.0.6-8 \ 32 | cmake=3.2.2-2ubuntu3 \ 33 | git=1:2.5.0-1ubuntu0.2 \ 34 | m4=1.4.17-4 \ 35 | texinfo=6.0.0.dfsg.1-3 \ 36 | tree=1.7.0-3 \ 37 | unzip=6.0-17ubuntu1.2 \ 38 | wget=1.16.1-1ubuntu1 39 | 40 | # Install "official" armel and armhf cross-compiler packages, which 41 | # can be used as an alternative to our own custom crosstool-NG toolchains. 42 | # 43 | # NOTE - The GCC armel cross-compiler package which comes with 44 | # Ubuntu-14.04 (Trusty) is REALLY old (GCC 4.7.2, released September 2012) 45 | # and is pretty much unusable on this code-base. 46 | # 47 | # NOTE - Tizen ships with an even older version of GCC again :-) 48 | # The Gear S2 smartwatch comes with libstdc++.so.6.0.16, which is the 49 | # version which shipped with GCC 4.6.1, released in April 2010. Running 50 | # the armel binaries generated with the GCC 5.2.1 cross-compiler which 51 | # we are now using here results in binaries which we cannot run on the 52 | # Gear S2. That results in the following runtime errors: 53 | # 54 | # ./eth: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./eth) 55 | # ./eth: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by ./eth) 56 | # ./eth: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.17' not found (required by ./eth) 57 | # ./eth: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by 58 | # 59 | # So it looks like I am going to have to specifically use an older 60 | # sysroot to get something which can work on the Gear S2. I am unable 61 | # SDB connect to any of my other Tizen devices right now, so cannot verify 62 | # if they have slightly newer runtime libraries. The SDK does also have a 63 | # GCC-4.9 toolchain, which perhaps was included in the Tizen 2.4 runtime? 64 | # Using a different sysroot will involve getting GCC 4.6 headers and libraries 65 | # onto the build machine, and then getting -sysroot into the CC and CXX 66 | # command-lines, probably by creating a shell script which wraps the 67 | # actual GCC binaries, as per the example below. 68 | # 69 | # See http://stackoverflow.com/questions/2977182/alternatives-to-the-sysroot-switch-of-gcc 70 | 71 | RUN apt-get update && apt-get install -y \ 72 | g++-arm-linux-gnueabi=4:5.2.1-1 \ 73 | gcc-arm-linux-gnueabi=4:5.2.1-1 \ 74 | g++-arm-linux-gnueabihf=4:5.2.1-1 \ 75 | gcc-arm-linux-gnueabihf=4:5.2.1-1 76 | 77 | # Switch to a normal user account. 78 | RUN useradd -ms /bin/bash crosseth 79 | USER crosseth 80 | 81 | # Commit of the webthree-umbrella repo to use. 82 | ENV CPP_ETHEREUM_REPO https://github.com/doublethinkco/cpp-ethereum.git 83 | ENV CPP_ETHEREUM_BRANCH develop 84 | 85 | # Workaround - using doublethinkco fork of cpp-ethereum to chop out std::future usage. 86 | # 87 | # See "Build break - armel - invalid use of incomplete type 'class std::future" 88 | # https://github.com/doublethinkco/cpp-ethereum-cross/issues/111 89 | # https://github.com/doublethinkco/cpp-ethereum/commit/edfafc 90 | 91 | ENV CPP_ETHEREUM_COMMIT 415fe0c 92 | 93 | # Clone the webthree-umbrella repo into the docker container, including sub-modules 94 | WORKDIR /home/crosseth 95 | RUN git clone -b ${CPP_ETHEREUM_BRANCH} --recursive ${CPP_ETHEREUM_REPO} && \ 96 | cd cpp-ethereum && git checkout ${CPP_ETHEREUM_COMMIT} && \ 97 | git submodule update --init 98 | 99 | # Copy our cross-building scripts into the container 100 | ADD cross-build/ /home/crosseth/cpp-ethereum/cross-build/ 101 | 102 | # And switch the working directory to the Ethereum cross-build scripts 103 | WORKDIR /home/crosseth/cpp-ethereum/cross-build/ethereum 104 | -------------------------------------------------------------------------------- /cross-build/ethereum/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | if [ ! -f "./setup.sh" ]; then echo "ERROR: wrong pwd"; exit 1; fi 19 | source ./utils.sh 20 | echo "running setup" 21 | 22 | # =========================================================================== 23 | export readonly TARGET_SUBTYPE=${1?} # "armel" or "armhf" 24 | export readonly CROSS_COMPILER_PROVENANCE=${2?} # true/false 25 | export readonly INITIAL_DIR=${PWD?} 26 | export readonly ORIGIN_ARCHITECTURE="x86_64" 27 | export readonly TARGET_ARCHITECTURE="arm" 28 | 29 | # =========================================================================== 30 | export readonly BASE_DIR="${HOME?}/eth" 31 | export readonly SOURCES_DIR="${BASE_DIR?}/src" 32 | export readonly WORK_DIR="${BASE_DIR?}/wd" 33 | export readonly LOGS_DIR="${BASE_DIR?}/logs" 34 | export readonly INSTALLS_DIR="${BASE_DIR?}/installs" 35 | 36 | # =========================================================================== 37 | export readonly BOOST_VERSION="1.61.0" 38 | export readonly CURL_VERSION="7.49.1" 39 | export readonly CRYPTOPP_VERSION="77f57c7" 40 | export readonly GMP_VERSION="6.1.0" 41 | export readonly JSONCPP_VERSION="8a6e50a" 42 | export readonly LEVELDB_VERSION="77948e7" 43 | export readonly LIBJSON_RPC_CPP_VERSION="98787ff" 44 | export readonly MHD_VERSION="0.9.50" 45 | 46 | # =========================================================================== 47 | export readonly BOOST_DOWNLOAD_URL="https://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/boost_${BOOST_VERSION//\./_}.tar.bz2/download" 48 | export readonly CURL_DOWNLOAD_URL="http://curl.haxx.se/download/curl-${CURL_VERSION?}.tar.gz" 49 | export readonly CRYPTOPP_DOWNLOAD_URL="https://github.com/weidai11/cryptopp.git" 50 | export readonly GMP_DOWNLOAD_URL="https://ftp.gnu.org/gnu/gmp/gmp-${GMP_VERSION?}.tar.bz2" 51 | export readonly JSONCPP_DOWNLOAD_URL="https://github.com/doublethinkco/jsoncpp.git" 52 | export readonly LEVELDB_DOWNLOAD_URL="https://github.com/google/leveldb.git" 53 | export readonly LIBJSON_RPC_CPP_DOWNLOAD_URL="https://github.com/doublethinkco/libjson-rpc-cpp.git" 54 | export readonly MHD_DOWNLOAD_URL="http://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-${MHD_VERSION?}.tar.gz" 55 | 56 | # =========================================================================== 57 | export readonly AUTOCONF_BUILD_ARCHITECTURE="${ORIGIN_ARCHITECTURE?}-linux-gnu" 58 | 59 | if [ "${TARGET_SUBTYPE?}" == "armel" ]; then 60 | export readonly AUTOCONF_HOST_ARCHITECTURE="${TARGET_ARCHITECTURE?}-unknown-linux-gnueabi" 61 | else 62 | export readonly AUTOCONF_HOST_ARCHITECTURE="${TARGET_ARCHITECTURE?}-unknown-linux-gnueabihf" 63 | fi 64 | 65 | # =========================================================================== 66 | if [ "${CROSS_COMPILER_PROVENANCE?}" == "apt" ]; then 67 | export readonly CROSS_COMPILER_ROOT_DIR="/usr" 68 | 69 | if [ "${TARGET_SUBTYPE?}" == "armel" ]; then 70 | export readonly GCC_CROSS_COMPILER="/usr/bin/arm-linux-gnueabi-gcc" 71 | export readonly GXX_CROSS_COMPILER="/usr/bin/arm-linux-gnueabi-g++" 72 | else 73 | export readonly GCC_CROSS_COMPILER="/usr/bin/arm-linux-gnueabihf-gcc" 74 | export readonly GXX_CROSS_COMPILER="/usr/bin/arm-linux-gnueabihf-g++" 75 | fi 76 | 77 | else 78 | export readonly XCOMPILER_VERSION="15-12-04" 79 | export readonly XCOMPILER_DOWNLOAD_URL="https://github.com/doublethinkco/webthree-umbrella-cross/releases/download" 80 | export readonly XCOMPILER_DESTINATION_DIR="$HOME/x-tools" 81 | export readonly CROSS_COMPILER_ROOT_DIR="${XCOMPILER_DESTINATION_DIR?}/arm-unknown-linux-gnueabi" # name remains the same since the ct-ng configuration is all we are changing from armel to armhf 82 | 83 | if [ -d "${XCOMPILER_DESTINATION_DIR?}" ]; then 84 | echo "ERROR: '${XCOMPILER_DESTINATION_DIR?}' already exists" 85 | exit 1 86 | fi 87 | fetch "${XCOMPILER_DOWNLOAD_URL?}/${TARGET_SUBTYPE?}-${XCOMPILER_VERSION}/${TARGET_SUBTYPE?}.tgz" ${XCOMPILER_DESTINATION_DIR?} 88 | ls -d "${CROSS_COMPILER_ROOT_DIR?}" # check present 89 | 90 | export readonly CROSS_COMPILER_TARGET=$(echo "${CROSS_COMPILER_ROOT_DIR?}" | awk -F$'/' '{print $NF}') 91 | 92 | export readonly GCC_CROSS_COMPILER="${CROSS_COMPILER_ROOT_DIR?}/bin/${CROSS_COMPILER_TARGET?}-gcc" 93 | export readonly GXX_CROSS_COMPILER="${CROSS_COMPILER_ROOT_DIR?}/bin/${CROSS_COMPILER_TARGET?}-g++" 94 | fi 95 | export readonly GCC_CROSS_COMPILER_PATTERN=$(perl -e "print quotemeta('${GCC_CROSS_COMPILER}')") 96 | export readonly GXX_CROSS_COMPILER_PATTERN=$(perl -e "print quotemeta('${GXX_CROSS_COMPILER}')") 97 | export readonly CMAKE_TOOLCHAIN_FILE="${INSTALLS_DIR?}/cmake/toolchain" 98 | 99 | # =========================================================================== 100 | 101 | export readonly SETUP=true 102 | 103 | echo "setup done." 104 | 105 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /cross-build/ethereum/utils.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2015-2016 Kitsilano Software Inc (https://doublethink.co) 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | # =========================================================================== 20 | function check_args() { 21 | TARGET_SUBTYPE=${1?} && shift 22 | CROSS_COMPILER_PROVENANCE=${1?} && shift 23 | [ "${TARGET_SUBTYPE?}" == "armel" -o "${TARGET_SUBTYPE?}" == "armhf" ] && [ "${CROSS_COMPILER_PROVENANCE?}" == "apt" -o "${CROSS_COMPILER_PROVENANCE?}" == "manual" ] || { 24 | echo "ERROR: TODO $TARGET_SUBTYPE $CROSS_COMPILER_PROVENANCE" 25 | exit 1 26 | } 27 | echo "args are valid" 28 | } 29 | 30 | # =========================================================================== 31 | function contains() { 32 | STR=${1?} && shift # colon-separated 33 | TARGET=${1?} 34 | echo ${STR?} | tr ':' '\n' | awk '/^'"${TARGET?}"'$/' 35 | } 36 | 37 | # =========================================================================== 38 | function fetch() { 39 | URL=${1?} && shift 40 | DESTINATION_DIR=${1?} && shift 41 | 42 | IS_GIT=$(echo "${URL?}" | awk '/\.git$/') 43 | if [ -n "${IS_GIT?}" ]; then 44 | fetch_git "${URL?}" "${DESTINATION_DIR?}" 45 | else 46 | fetch_non_git "${URL?}" "${DESTINATION_DIR?}" 47 | fi 48 | 49 | find ${DESTINATION_DIR?} -maxdepth 1 50 | } 51 | 52 | # --------------------------------------------------------------------------- 53 | function fetch_git() { # private 54 | URL=${1?} && shift 55 | DESTINATION_DIR=${1?} && shift 56 | 57 | git clone ${URL?} ${DESTINATION_DIR?} 2>&1 58 | } 59 | 60 | # --------------------------------------------------------------------------- 61 | function fetch_non_git() { # private 62 | URL=${1?} && shift 63 | DESTINATION_DIR=${1?} && shift 64 | 65 | IS_TAR_GZ=$(echo "${URL?}" | awk '/\.tar.gz/ || /\.tgz/') 66 | IS_TAR_BZ2=$(echo "${URL?}" | awk '/\.tar.bz2/') 67 | IS_ZIP=$(echo "${URL?}" | awk '/\.zip/') 68 | 69 | TEMP_DIR=$(mktemp -d) 70 | 71 | # fetch tarball 72 | if [ -n "${IS_TAR_GZ?}" -o -n "${IS_TAR_BZ2?}" ]; then 73 | if [ -n "${IS_TAR_GZ?}" ]; then FLAG="z"; else FLAG="j"; fi 74 | wget -O- ${URL?} | tar ${FLAG?}x -C ${TEMP_DIR?} 2>&1 # TODO: can rename ouput dir too? 75 | mv ${TEMP_DIR?}/* ${DESTINATION_DIR?} 76 | 77 | # fetch zip file 78 | elif [ -n "${IS_ZIP?}" ]; then # can't use stdin 79 | ZIP_FILE=${TEMP_DIR?}/tmp.zip 80 | wget -O ${ZIP_FILE?} ${URL?} 2>&1 81 | unzip -d ${DESTINATION_DIR?} ${ZIP_FILE?} 82 | rm ${ZIP_FILE?} 83 | 84 | else 85 | echo "ERROR: unsupported extension for '${URL?}'" 86 | exit 1 87 | fi 88 | 89 | rmdir ${TEMP_DIR?} 90 | } 91 | 92 | # =========================================================================== 93 | function generate_timestamp() { 94 | date '+%y%m%d%H%M%S' 95 | } 96 | 97 | # =========================================================================== 98 | function section_downloading() { 99 | COMPONENT=${1?} 100 | section "downloading" ${COMPONENT?} 101 | } 102 | 103 | # --------------------------------------------------------------------------- 104 | function section_configuring() { 105 | COMPONENT=${1?} 106 | section "configuring" ${COMPONENT?} 107 | } 108 | 109 | # --------------------------------------------------------------------------- 110 | function section_cross_compiling() { 111 | COMPONENT=${1?} 112 | section "cross-compiling" ${COMPONENT?} 113 | } 114 | 115 | # --------------------------------------------------------------------------- 116 | function section_compiling() { 117 | COMPONENT=${1?} 118 | section "compiling" ${COMPONENT?} 119 | } 120 | 121 | # --------------------------------------------------------------------------- 122 | function section_installing() { 123 | COMPONENT=${1?} 124 | section "installing" ${COMPONENT?} 125 | } 126 | 127 | # --------------------------------------------------------------------------- 128 | function section_hacking() { 129 | COMPONENT=${1?} 130 | section "hacking" ${COMPONENT?} 131 | } 132 | 133 | # --------------------------------------------------------------------------- 134 | function section() { 135 | ACTION=${1?} 136 | TARGET=${2?} 137 | echo -e "\n\n" 138 | printf '=%.0s' {1..75} 139 | echo -e "\n${ACTION?}: ${TARGET?}\n\n" 140 | } 141 | 142 | # =========================================================================== 143 | function export_cross_compiler() { 144 | export CC=${GCC_CROSS_COMPILER?} # can't be readonly 145 | export CXX=${GXX_CROSS_COMPILER?} # can't be readonly 146 | 147 | # necessary for gmp and curl 148 | export PATH="$PATH:${CROSS_COMPILER_ROOT_DIR?}/bin" 149 | } 150 | 151 | # --------------------------------------------------------------------------- 152 | function sanity_check_cross_compiler() { 153 | (echo $CC | grep ${TARGET_ARCHITECTURE?} >&/dev/null && \ 154 | echo $CXX | grep ${TARGET_ARCHITECTURE?} >&/dev/null && \ 155 | echo $PATH | tr ':' '\n' | xargs ls | grep ${TARGET_ARCHITECTURE?} >&/dev/null) || { 156 | echo "ERROR: CC and/or CXX and/or PATH are not properly configured: CC='$CC', CXX='$CXX', PATH='$PATH'" 157 | exit 1 158 | } 159 | } 160 | 161 | # =========================================================================== 162 | function return_code() { 163 | CODE=${1?} 164 | echo -e "\nreturn code: '${CODE?}'" 165 | } 166 | 167 | # =========================================================================== 168 | # populates CMake toolchain file (see http://www.vtk.org/Wiki/CMake_Cross_Compiling) 169 | function get_cmake_toolchain_file_content() { 170 | cat << EOF 171 | SET(CMAKE_SYSTEM_NAME Linux) 172 | SET(CMAKE_SYSTEM_VERSION 1) 173 | SET(CMAKE_C_COMPILER ${GCC_CROSS_COMPILER?}) 174 | SET(CMAKE_CXX_COMPILER ${GXX_CROSS_COMPILER?}) 175 | SET(CMAKE_FIND_ROOT_PATH ${CROSS_COMPILER_ROOT_DIR?}) 176 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 177 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) 178 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) 179 | EOF 180 | } 181 | 182 | # =========================================================================== 183 | function set_cmake_paths() { 184 | PACKAGES=${1?} 185 | set_cmake_library_path "${PACKAGES?}" 186 | set_cmake_include_path "${PACKAGES?}" 187 | check_cmake_paths 188 | format_cmake_paths 189 | } 190 | 191 | # --------------------------------------------------------------------------- 192 | # TODO: generalize 193 | function set_cmake_library_path() { # private 194 | LIBS=${1?} 195 | unset CMAKE_LIBRARY_PATH 196 | 197 | if [ -n "$(contains ${LIBS?} boost)" ]; then 198 | CMAKE_LIBRARY_PATH="$CMAKE_LIBRARY_PATH:${INSTALLS_DIR?}/boost/lib" 199 | fi 200 | if [ -n "$(contains ${LIBS?} cryptopp)" ]; then 201 | CMAKE_LIBRARY_PATH="$CMAKE_LIBRARY_PATH:${INSTALLS_DIR?}/cryptopp/lib" 202 | fi 203 | if [ -n "$(contains ${LIBS?} curl)" ]; then 204 | CMAKE_LIBRARY_PATH="$CMAKE_LIBRARY_PATH:${INSTALLS_DIR?}/curl/lib" 205 | fi 206 | if [ -n "$(contains ${LIBS?} gmp)" ]; then 207 | CMAKE_LIBRARY_PATH="$CMAKE_LIBRARY_PATH:${INSTALLS_DIR?}/gmp/lib" 208 | fi 209 | if [ -n "$(contains ${LIBS?} jsoncpp)" ]; then 210 | CMAKE_LIBRARY_PATH="$CMAKE_LIBRARY_PATH:${INSTALLS_DIR?}/jsoncpp/usr/local/lib" 211 | fi 212 | if [ -n "$(contains ${LIBS?} leveldb)" ]; then 213 | CMAKE_LIBRARY_PATH="$CMAKE_LIBRARY_PATH:${INSTALLS_DIR?}/leveldb/lib" 214 | fi 215 | if [ -n "$(contains ${LIBS?} libjson-rpc-cpp)" ]; then 216 | CMAKE_LIBRARY_PATH="$CMAKE_LIBRARY_PATH:${INSTALLS_DIR?}/libjson-rpc-cpp/usr/local/lib" 217 | fi 218 | if [ -n "$(contains ${LIBS?} libmicrohttpd)" ]; then 219 | CMAKE_LIBRARY_PATH="$CMAKE_LIBRARY_PATH:${INSTALLS_DIR?}/libmicrohttpd/lib" 220 | fi 221 | CMAKE_LIBRARY_PATH=$(echo "$CMAKE_LIBRARY_PATH" | sed 's/^://') 222 | 223 | export CMAKE_LIBRARY_PATH 224 | } 225 | 226 | # --------------------------------------------------------------------------- 227 | function set_cmake_include_path() { # private 228 | INCLUDES=${1?} 229 | unset CMAKE_INCLUDE_PATH 230 | 231 | if [ -n "$(contains ${INCLUDES?} boost)" ]; then 232 | CMAKE_INCLUDE_PATH="$CMAKE_INCLUDE_PATH:${INSTALLS_DIR?}/boost/include" 233 | fi 234 | if [ -n "$(contains ${INCLUDES?} cryptopp)" ]; then 235 | CMAKE_INCLUDE_PATH="$CMAKE_INCLUDE_PATH:${SOURCES_DIR?}" # hack + see softlink hack in install-dependencies script 236 | fi 237 | if [ -n "$(contains ${INCLUDES?} curl)" ]; then 238 | CMAKE_INCLUDE_PATH="$CMAKE_INCLUDE_PATH:${INSTALLS_DIR?}/curl/include" 239 | fi 240 | if [ -n "$(contains ${INCLUDES?} gmp)" ]; then 241 | CMAKE_INCLUDE_PATH="$CMAKE_INCLUDE_PATH:${INSTALLS_DIR?}/gmp/include" 242 | fi 243 | if [ -n "$(contains ${INCLUDES?} jsoncpp)" ]; then 244 | CMAKE_INCLUDE_PATH="$CMAKE_INCLUDE_PATH:${INSTALLS_DIR?}/jsoncpp/usr/local/include" 245 | fi 246 | if [ -n "$(contains ${INCLUDES?} leveldb)" ]; then 247 | CMAKE_INCLUDE_PATH="$CMAKE_INCLUDE_PATH:${INSTALLS_DIR?}/leveldb/include" 248 | fi 249 | if [ -n "$(contains ${INCLUDES?} libjson-rpc-cpp)" ]; then 250 | CMAKE_INCLUDE_PATH="$CMAKE_INCLUDE_PATH:${INSTALLS_DIR?}/libjson-rpc-cpp/usr/local/include" 251 | fi 252 | if [ -n "$(contains ${INCLUDES?} libmicrohttpd)" ]; then 253 | CMAKE_INCLUDE_PATH="$CMAKE_INCLUDE_PATH:${INSTALLS_DIR?}/libmicrohttpd/include" 254 | fi 255 | CMAKE_INCLUDE_PATH=$(echo "$CMAKE_INCLUDE_PATH" | sed 's/^://') 256 | 257 | export CMAKE_INCLUDE_PATH 258 | } 259 | 260 | # --------------------------------------------------------------------------- 261 | function check_cmake_paths() { # private 262 | for DIR in $(echo ${CMAKE_LIBRARY_PATH?} | tr ':' ' '); do 263 | [ -d "${DIR?}" ] || { 264 | echo "ERROR: '${DIR?}' does not exist." 265 | exit 1 266 | } 267 | done 268 | } 269 | 270 | # --------------------------------------------------------------------------- 271 | function format_cmake_paths() { # private 272 | echo -e "CMAKE_LIBRARY_PATH:\n\n$(echo ${CMAKE_LIBRARY_PATH?} | tr ':' '\n')\n\n" 273 | echo -e "CMAKE_INCLUDE_PATH:\n\n$(echo ${CMAKE_INCLUDE_PATH?} | tr ':' '\n')\n\n" 274 | 275 | echo 276 | echo "export CMAKE_LIBRARY_PATH=${CMAKE_LIBRARY_PATH?}" 277 | echo 278 | echo "export CMAKE_INCLUDE_PATH=${CMAKE_INCLUDE_PATH?}" 279 | echo 280 | } 281 | 282 | # =========================================================================== 283 | # applies generic awk script to a copy of the given file 284 | function generic_hack() { # ensure script is idempotent 285 | FILE=${1?} && shift 286 | AWK_SCRIPT=${1?} && shift 287 | 288 | if [ ! -f ${FILE?}.bak ]; then 289 | cp ${FILE?} ${FILE?}.bak # to keep original file around conveniently (without having to use git) 290 | fi 291 | 292 | awk "${AWK_SCRIPT?}" ${FILE?}.bak > ${FILE?} 293 | } 294 | 295 | # --------------------------------------------------------------------------- 296 | function clone() { 297 | ORIGIN=${1?} && shift 298 | TARGET=${1?} && shift 299 | echo "cloning dir: '${ORIGIN?}' to '${TARGET?}'" 300 | cp -r ${ORIGIN?} ${TARGET?} # so as to not pollute the original dir (makes git commits more difficult) 301 | } 302 | 303 | # --------------------------------------------------------------------------- 304 | function cd_clone() { 305 | ORIGIN=${1?} && shift 306 | TARGET=${1?} && shift 307 | clone ${ORIGIN?} ${TARGET?} 308 | cd ${TARGET?} 309 | printf '=%.0s' {1..75} && echo && pwd 310 | } 311 | 312 | # --------------------------------------------------------------------------- 313 | function cd_if_not_exists() { # TODO: rename 314 | DIR=${1?} 315 | mkdir -p ${DIR?} 316 | cd ${DIR?} 317 | printf '=%.0s' {1..75} && echo && pwd 318 | } 319 | 320 | # --------------------------------------------------------------------------- 321 | function cd_if_exists() { 322 | DIR=${1?} 323 | if [ ! -d ${DIR?} ]; then 324 | read -p "please create dir first:\n ${DIR?}" 325 | fi 326 | cd ${DIR?} 327 | printf '=%.0s' {1..75} && echo && pwd 328 | } 329 | 330 | # =========================================================================== 331 | function ct_ng_to_awk_script() { 332 | for ENTRY in $(tee | tr ',' '\n'); do # loop through entries and create an awk clause/action for each 333 | KEY=$(echo "${ENTRY?}" | cut -d'=' -f1) 334 | VAL=$(echo "${ENTRY?}" | cut -d'=' -f2 | sed 's/"/\\"/g') # if quotes are provided, must escape them in awk script 335 | if [ -z "${VAL?}" ]; then 336 | echo "/ *${KEY?}[= ]/{print \"# ${KEY?} is not set\"; next}" # next so as to only print the replacement 337 | else 338 | echo "/ *${KEY?}[= ]/{print \"${KEY?}=${VAL?}\"; next}" # next: see above 339 | fi 340 | done | tr -d "\n" 341 | echo -n "1" # so as to print every other line 342 | } 343 | 344 | # --------------------------------------------------------------------------- 345 | function ct_ng_quick_cleanup() { # removes empty lines/comments and trims 346 | awk '!/^ *$/ && !/^ *#/{sub(/^ */,"");sub(/ *$/,"");print}' 347 | } 348 | 349 | # --------------------------------------------------------------------------- 350 | function ct_ng_config_hack() { 351 | FILE=${1?} && shift 352 | CHANGES_FILE=${1?} && shift 353 | 354 | AWK_SCRIPT=$(cat ${CHANGES_FILE?} | ct_ng_quick_cleanup | cut -d',' -f1 | ct_ng_to_awk_script) 355 | echo -e "using:\n\tawk '${AWK_SCRIPT?}' ${FILE?}" 356 | 357 | generic_hack ${FILE?} "${AWK_SCRIPT?}" 358 | } 359 | 360 | # =========================================================================== 361 | 362 | export -f check_args 363 | export -f contains 364 | export -f fetch 365 | export -f fetch_git 366 | export -f fetch_non_git 367 | export -f generate_timestamp 368 | export -f section_downloading 369 | export -f section_configuring 370 | export -f section_cross_compiling 371 | export -f section_compiling 372 | export -f section_installing 373 | export -f section_hacking 374 | export -f section 375 | export -f export_cross_compiler 376 | export -f sanity_check_cross_compiler 377 | export -f return_code 378 | export -f get_cmake_toolchain_file_content 379 | export -f set_cmake_paths 380 | export -f set_cmake_library_path 381 | export -f set_cmake_include_path 382 | export -f check_cmake_paths 383 | export -f format_cmake_paths 384 | export -f generic_hack 385 | export -f clone 386 | export -f cd_clone 387 | export -f cd_if_not_exists 388 | export -f cd_if_exists 389 | export -f ct_ng_to_awk_script 390 | export -f ct_ng_quick_cleanup 391 | export -f ct_ng_config_hack 392 | 393 | # =========================================================================== 394 | 395 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # What is "cpp-ethereum-cross"? 2 | 3 | This repo contains [Docker](https://www.docker.com/) files for 4 | [cross-compilation](https://en.wikipedia.org/wiki/Cross_compiler) of the 5 | [Ethereum](https://en.wikipedia.org/wiki/Ethereum) C++ components. 6 | 7 | [![Build Status](https://travis-ci.org/doublethinkco/cpp-ethereum-cross.png?branch=master)](https://travis-ci.org/doublethinkco/cpp-ethereum-cross) 8 | 9 | The C++ cross-build support was developed by 10 | [Bob Summerwill](http://bobsummerwill.com) 11 | and 12 | [Anthony Cros](https://github.com/anthony-cros) 13 | for [doublethinkco](http://doublethink.co). 14 | 15 | The intention of the project is to bring Ethereum to mobile/wearable Linux 16 | platforms for the benefit of the whole Ethereum community, current and future. 17 | Given the ubiquitous nature of ARM processors, it was trivial to extend the 18 | scope of the project from mobile/wearable to cover a huge range of devices 19 | and OSes. There is a large test matrix further down this document showing 20 | our understanding of the status on a very broad range of devices. 21 | 22 | Here is a photo of our nascent mobile/wearable build and testing farm: 23 | 24 | ![Build farm](https://doublethinkco.files.wordpress.com/2015/11/20151120_083926.jpg?w=788) 25 | 26 | This code is released as open source software under the permissive 27 | [Apache 2.0 license](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)). 28 | 29 | We have written blogs and articles through development which are hosted at 30 | [doublethink.co](http://doublethink.co). Here are some key articles 31 | 32 | * [Porting Ethereum to mobile Linux](http://doublethink.co/2015/09/22/porting-ethereum-to-mobile-linux/) 33 | * [First working Ethereum C++ cross-builds](http://doublethink.co/2015/11/30/first-working-ethereum-c-cross-builds/) 34 | * [New Year, New Focus](http://bobsummerwill.com/2015/12/24/new-year-new-focus/) 35 | 36 | # Smartwatch status 37 | 38 | | Form factor | Vendor | Device | OS | ABI | SoC | Core | Native | Cross | 39 | | --------------- |:-----------------------:|:---------------------:|:-----------------:|:-------:|:--------------------------:|:-------------:|:-------:|:-----:| 40 | | Smartwatch | Samsung | Gear S2 | Tizen 2.3.1 | armv7 | Qualcomm MSM8x26 | 2 x Cortex-A7 | N/A | [Broken #20](https://github.com/doublethinkco/webthree-umbrella-cross/issues/20) 41 | | Smartwatch | Apple | Apple Watch Sport | watchOS 2.0 | armv7k | Apple S1 | 1 x ARM-v7k | N/A | [TODO #41](https://github.com/doublethinkco/webthree-umbrella-cross/issues/41) 42 | 43 | # Smartphone status 44 | 45 | | Vendor | Device | OS | ABI | SoC | Core | Native | Cross | 46 | |:-----------------------:|:---------------------:|:-----------------:|:-------:|:--------------------------:|:-------------:|:-------:|:-----:| 47 | | Samsung | Samsung Z1 | Tizen 2.3.0 | armv7 | Spreadtrum SC7727S | 2 x Cortex-A7 | N/A | [Broken #20](https://github.com/doublethinkco/webthree-umbrella-cross/issues/20) 48 | | Samsung | Samsung Z3 | Tizen 2.4.0 | armv7 | Spreadtrum SC7730S | 4 x Cortex-A7 | N/A | [Broken #20](https://github.com/doublethinkco/webthree-umbrella-cross/issues/20) 49 | | LG | Nexus 5 | Sailfish 2.0 | armv7 | Qualcomm Snapdragon 800 | 4 x Krait 400 | [Working](https://twitter.com/vgrade/status/671818784055889921) | [TODO #60](https://github.com/doublethinkco/webthree-umbrella-cross/issues/60) 50 | | Jolla | Jolla Phone | Sailfish 2.0 | armv7 | Qualcomm Snapdragon 400 | 2 x Krait 300 | [TODO #61](https://github.com/doublethinkco/webthree-umbrella-cross/issues/61) | [Working](https://twitter.com/doublethink_co/status/677942232549208064?lang=en) 51 | | Intex | Aquafish | Sailfish 2.0 | armv7 | Qualcomm Snapdragon ??? | | TODO | TODO 52 | | Meizu | MX4 Ubuntu Edition | Ubuntu Touch | armv7 | MediaTek MT6595 | 4 x Cortex-A17, 4 x Cortex-A7 | [TODO #62](https://github.com/doublethinkco/webthree-umbrella-cross/issues/62) | [Working](https://twitter.com/doublethink_co/status/677662911687434241) 53 | | Samsung | Galaxy S3 | Android 4.3 | armel | Samsung Exynos 4412 Quad | 4 x Cortex-A9 | N/A | [TODO #35](https://github.com/doublethinkco/webthree-umbrella-cross/issues/35) 54 | | Samsung | Galaxy S4 | Android 4.4 | armel | Qualcomm Snapdragon 600 | 4 x Krait 300 | N/A | [TODO #35](https://github.com/doublethinkco/webthree-umbrella-cross/issues/35) 55 | | Samsung | Galaxy S6 | Android 5.0.2 | aarch64 | Samsung Exynos 7420 | 4 x Cortex-A57, 4 x Cortex-A53 | N/A | [TODO #35](https://github.com/doublethinkco/webthree-umbrella-cross/issues/35) 56 | | Apple | iPhone 3GS | iOS 3 | armv7 | Samsung S5PC100 | 1 x Cortex-A8 | N/A | [TODO #36](https://github.com/doublethinkco/webthree-umbrella-cross/issues/36) 57 | | Apple | iPhone 5 | iOS 6 | armv7 | Apple A6 | 2 x ARMv7A | N/A | [TODO #36](https://github.com/doublethinkco/webthree-umbrella-cross/issues/36) 58 | | Nokia | N900 | Maemo 5 | armv7 | Apple A6 | 2 x ARMv7A | N/A | [TODO #74](https://github.com/doublethinkco/webthree-umbrella-cross/issues/74) 59 | | Nokia | N9 | MeeGo 1.3 | armv7 | Apple A6 | 2 x ARMv7A | N/A | [TODO #73](https://github.com/doublethinkco/webthree-umbrella-cross/issues/73) 60 | 61 | # Developer phone status 62 | 63 | | Vendor | Device | OS | ABI | SoC | Core | Native | Cross | 64 | |:-----------------------:|:---------------------:|:-----------------:|:-------:|:--------------------------:|:-------------:|:-------:|:-----:| 65 | | Samsung | RD-210 | Tizen 2.2.0 | armv7 | Samsung Exynos 4210 | 2 x Cortex-A9 | N/A | [Broken #20](https://github.com/doublethinkco/webthree-umbrella-cross/issues/20) 66 | | Samsung | RD-PQ | Tizen 2.3.0 | armv7 | Samsung Exynos 4412 Quad | 4 x Cortex-A9 | N/A | [Broken #20](https://github.com/doublethinkco/webthree-umbrella-cross/issues/20) 67 | | Samsung | TM1 | Tizen 2.4.0 | armv7 | Spreadtrum SC7730S | 4 x Cortex-A7 | N/A | [Broken #20](https://github.com/doublethinkco/webthree-umbrella-cross/issues/20) 68 | 69 | # Tablet status 70 | 71 | | Vendor | Device | OS | ABI | SoC | Core | Native | Cross | 72 | |:-----------------------:|:---------------------:|:-----------------:|:-------:|:--------------------------:|:-------------:|:-------:|:-----:| 73 | | Asus | Nexus 7 | Android 5.1.1 | armel | Nvidia Tegra 3 | 4+1 x Cortex-A9 | N/A | [TODO #35](https://github.com/doublethinkco/webthree-umbrella-cross/issues/35) 74 | | Samsung | Galaxy Tab S 10.5 | Android 5.0.2 | armel | Samsung Exynos 5 Octa 5420 | 4 x Cortex-A15, 4 x Cortex-A7 | N/A | [TODO #35](https://github.com/doublethinkco/webthree-umbrella-cross/issues/35) 75 | | Apple | iPad Air 2 | iOS 8.1 | aarch64 | Apple A8X | 3 x ARMv8-A | N/A | [TODO #36](https://github.com/doublethinkco/webthree-umbrella-cross/issues/36) 76 | 77 | # SBC (Single Board Computer) status 78 | 79 | | Vendor | Device | OS | ABI | SoC | Core | Native | Cross | 80 | |:-----------------------:|:---------------------:|:-----------------:|:-------:|:--------------------------:|:-------------:|:-------:|:-----:| 81 | | Raspberry Pi Foundation | Raspberry Pi Model A | Raspbian | armv6 | Broadcom BCM2835 | 1 x ARMv6 | TODO | TODO 82 | | Raspberry Pi Foundation | Raspberry Pi Model B+ | Raspbian | armv6 | Broadcom BCM2835 | 1 x ARMv6 | Working | Working 83 | | Raspberry Pi Foundation | Raspberry Pi Zero | Raspbian | armv6 | Broadcom BCM2835 | 1 x ARMv6 | TODO | [Working](https://twitter.com/vgrade/status/670677685622939649) 84 | | Raspberry Pi Foundation | Raspberry Pi 2 | Raspbian | armv7 | Broadcom BCM2836 | 4 x Cortex-A7 | Working | [Working](https://twitter.com/EthEmbedded/status/670628642125438977) 85 | | Raspberry Pi Foundation | Raspberry Pi 3 | Ubuntu 15.04 MATE | armv7 | Broadcom BCM2837 | 4 x Cortex-A53 | TODO | TODO 86 | | Odroid | Odroid XU3 | Ubuntu 15.04 MATE | armv7 | Samsung Exynos 5422 | 4 x Cortex-A15, 4 x Cortex-A7 | Working | [Working](https://twitter.com/BobSummerwill/status/670585217384628224) 87 | | Odroid | Odroid XU4 | Tizen 3.x | armv7 | Samsung Exynos 5422 | 4 x Cortex-A15, 4 x Cortex-A7 | TODO | TODO 88 | | Beaglebone | Beaglebone Black | Debian | armv7 | Texas Instruments AM3358/9 | 1 x Cortex-A8 | Working | Working 89 | | Wandboard | Wandboard Quad | Debian | armv7 | Freescale i.MX6 | 4 x Cortex-A9 | Working | [Working](https://twitter.com/BobSummerwill/status/670573142914519040) 90 | | Dragonboard | DragonBoard 410c | | armv7 | Qualcomm Snapdragon 410 | 4 x Cortex-A7 | TODO | TODO 91 | | C.H.I.P. | C.H.I.P. | Debian | armv7 | Allwinner R8 | 1 x Cortex-A8 | TODO | [Working](https://twitter.com/EthEmbedded/status/697220510208258048) 92 | | Minnowboard | Minnowboard MAX | | x86_64 | Intel Atom E3800 | 2 x Core | TODO | TODO 93 | | Intel | Intel NUC DCP847SKE | | i386 | Intel QS77 Express | | TODO | TODO 94 | | Intel | Intel Edison | Yocto | x86_64 | Intel "Tangier" Z34XX | | Working | TODO 95 | | Intel | Intel Curie | | i386 | Intel Quark SE | | TODO | TODO 96 | 97 | NOTE - Here is some information on [ARM options in GCC](https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html). 98 | 99 | See also [ARM Infocenter](http://infocenter.arm.com) and [ARM Architecture](https://en.wikipedia.org/wiki/ARM_architecture) page on Wikipedia. 100 | 101 | 102 | # Releases 103 | 104 | Prebuilt releases are [hosted on Github](https://github.com/doublethinkco/webthree-umbrella-cross/releases) 105 | and are updated periodically. 106 | 107 | If you use these binaries please do let us know how you get on, 108 | either via [cpp-ethereum](http://gitter.im/ethereum/porting) on Gitter 109 | or by logging [an issue](https://github.com/doublethinkco/webthree-umbrella-cross/issues) 110 | in Github. Please give as much detail as you can, including your exact 111 | device and operating system version. Thanks! 112 | 113 | # Cross-build from source 114 | 115 | To cross-build the HEAD of **webthree-umbrella** from source yourself, 116 | follow these instructions. 117 | 118 | Clone this repo and use 119 | [Dockerfile-crosseth](https://github.com/doublethinkco/webthree-umbrella-cross/blob/master/Dockerfile-crosseth) 120 | to build either 'armel' binaries or 'armhf' binaries: 121 | 122 | $ git clone https://github.com/doublethinkco/webthree-umbrella-cross.git 123 | $ cd webthree-umbrella-cross 124 | 125 | And then one of ... 126 | 127 | $ sudo ./build-armel.sh 128 | $ sudo ./build-armhf.sh 129 | $ sudo ./build-armel-apt.sh 130 | $ sudo ./build-armhf-apt.sh 131 | 132 | If the build succeeds then you will end up with an output file in **/tmp/crosseth.tgz**. 133 | 134 | The "apt" versions use the pre-built **g++-arm-linux-gnueabi** and 135 | **g++-arm-linux-gnueabihf** cross-compilers which "apt-get install"-ed, 136 | rather than the cross-compilers which we built ourselves (see next paragraph). 137 | 138 | [Dockerfile-crosseth](https://github.com/doublethinkco/webthree-umbrella-cross/blob/master/Dockerfile-crosseth) 139 | makes use of the [crosstool-NG](http://crosstool-ng.org/#introduction) toolchain-building 140 | scripts to generate a cross-compiler which is then used in the rest of the 141 | build process. The cross-compiler was originally built and then used as 142 | part of the same Docker flow, but that was slow and unnecessarily, so that 143 | step was been split into its own [Dockerfile-xcompiler](https://github.com/doublethinkco/webthree-umbrella-cross/blob/master/Dockerfile-xcompiler) 144 | process, which can be run in a similar manner: 145 | 146 | $ git clone https://github.com/doublethinkco/webthree-umbrella-cross.git 147 | $ cd webthree-umbrella-cross 148 | $ sudo ./build-xcompiler-armel.sh 149 | 150 | or 151 | 152 | $ git clone https://github.com/doublethinkco/webthree-umbrella-cross.git 153 | $ cd webthree-umbrella-cross 154 | $ sudo ./build-xcompiler-armhf.sh 155 | 156 | If the cross-compiler build succeeds then you will end up with an output file in **/tmp/xcompiler.tgz**. 157 | 158 | The results from two specific runs of this process are stored as releases on 159 | Github and are used in the crosseth build process. The "glue" 160 | for this process is in [cross-build/ethereum/setup.sh](https://github.com/doublethinkco/webthree-umbrella-cross/blob/873761bba4f9b9c8e401dd0c9ac52a8c8e9b780b/cross-build/ethereum/setup.sh#L197): 161 | 162 | * [armel-15-12-04](https://github.com/doublethinkco/webthree-umbrella-cross/releases/tag/armel-15-12-04) 163 | * [armhf-15-12-04](https://github.com/doublethinkco/webthree-umbrella-cross/releases/tag/armhf-15-12-04) 164 | 165 | 166 | # Next steps? 167 | 168 | The bulk of the remaining work is getting specific platforms and devices into 169 | a working state. For the ARM devices, that will mainly be a matter of 170 | iterating on the ABI settings until we get working binaries. Intel support 171 | should not be too hard either - just more cross-compilers. 172 | 173 | * [Milestone 1 - Loose Ends, Tizen](https://github.com/doublethinkco/webthree-umbrella-cross/milestones/Milestone%201%20-%20Loose%20ends,%20Tizen) 174 | * [Milestone 2 - DevOps, Android, iOS](https://github.com/doublethinkco/webthree-umbrella-cross/milestones/Milestone%202%20-%20DevOps,%20Android,%20iOS) 175 | * [Milestone 3 - Light Client Phase 1](https://github.com/doublethinkco/webthree-umbrella-cross/milestones/Milestone%203%20-%20Light%20Client%20Phase%201) 176 | --------------------------------------------------------------------------------