new package: openethereum (#6240)

This commit is contained in:
Wetitpig 2021-01-10 19:16:43 +08:00 committed by GitHub
parent 849c2978d0
commit 5a181e1477
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 108 additions and 2 deletions

View File

@ -0,0 +1,67 @@
TERMUX_PKG_HOMEPAGE=https://openethereum.github.io
TERMUX_PKG_DESCRIPTION="Lightweight Ethereum Client"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=3.1.0
TERMUX_PKG_SRCURL=https://github.com/openethereum/openethereum/archive/v${TERMUX_PKG_VERSION}.zip
TERMUX_PKG_SHA256=62e577abbeddaeb38071e396847a4fcaa4117709aa2689f0d53005bd4c7d7690
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_RUST_VERSION=1.45
termux_step_configure() {
termux_setup_cmake
CXXFLAGS+=" --target=$CCTERMUX_HOST_PLATFORM"
CFLAGS+=" --target=$CCTERMUX_HOST_PLATFORM"
if [ $TERMUX_ARCH = "arm" ]; then
CFLAGS="${CFLAGS/-mthumb/}"
CMAKE_SYSTEM_PROCESSOR="armv7-a"
else
CMAKE_SYSTEM_PROCESSOR=$TERMUX_ARCH
fi
cat <<- EOF > $TERMUX_COMMON_CACHEDIR/defaultcache.cmake
CMAKE_CROSSCOMPILING=ON
CMAKE_LINKER="$TERMUX_STANDALONE_TOOLCHAIN/bin/$LD $LDFLAGS"
CMAKE_SYSTEM_NAME=Android
CMAKE_SYSTEM_VERSION=$TERMUX_PKG_API_LEVEL
CMAKE_SYSTEM_PROCESSOR=$CMAKE_SYSTEM_PROCESSOR
CMAKE_ANDROID_STANDALONE_TOOLCHAIN=$TERMUX_STANDALONE_TOOLCHAIN
CMAKE_AR="$(command -v $AR)"
CMAKE_UNAME="$(command -v uname)"
CMAKE_RANLIB="$(command -v $RANLIB)"
CMAKE_C_FLAGS="$CFLAGS -Wno-error=shadow $CPPFLAGS"
CMAKE_CXX_FLAGS="$CXXFLAGS $CPPFLAGS"
CMAKE_FIND_ROOT_PATH=$TERMUX_PREFIX
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY
CMAKE_SKIP_INSTALL_RPATH=ON
CMAKE_USE_SYSTEM_LIBRARIES=ON
BUILD_TESTING=OFF
WITH_GFLAGS=OFF
EOF
export CMAKE=$TERMUX_PKG_BUILDER_DIR/cmake_mod.sh
export TERMUX_COMMON_CACHEDIR
termux_setup_rust
cargo clean
export NDK_HOME=$NDK
RUSTFLAGS+=" -C link-args=-lc++"
}
termux_step_make() {
cargo build --jobs $TERMUX_MAKE_PROCESSES --target $CARGO_TARGET_NAME --release --features final
for applet in evmbin ethstore-cli ethkey-cli; do
cargo build --jobs $TERMUX_MAKE_PROCESSES --target $CARGO_TARGET_NAME --release -p $applet
done
}
termux_step_make_install() {
for applet in openethereum openethereum-evm ethstore ethkey; do
install -Dm755 -t $TERMUX_PREFIX/bin target/${CARGO_TARGET_NAME}/release/$applet
done
}

View File

@ -0,0 +1,31 @@
#!/bin/bash
set -x
if [ $# -eq 0 ]; then
cmake --version
elif [ $1 = "--build" ]; then
cmake "$@"
else
_CACHE="$1/defaultcache.cmake"
cp $TERMUX_COMMON_CACHEDIR/defaultcache.cmake "$_CACHE"
for var in "$@"; do
case "$var" in
"-DCMAKE_C_COMPILER"*|"-DCMAKE_CXX_COMPILER"*|"-DCMAKE_C_FLAGS="*|"-DCMAKE_CXX_FLAGS="*)
;;
"-D"*"="*)
echo "${var/-D/}" >> "$_CACHE"
;;
esac
done
sed -i 's/\"//g' "$_CACHE"
ARG=()
while read -r arg; do
if [ ! -z "$arg" ]; then
ARG+=("-D$arg")
fi
done < "$_CACHE"
cmake "$1" "${ARG[@]}"
rm "$_CACHE"
fi

View File

@ -0,0 +1,6 @@
TERMUX_SUBPKG_DESCRIPTION="Additional utilities for OpenEthereum (like evm, ethstore, ethkey)"
TERMUX_SUBPKG_INCLUDE="
bin/openethereum-evm
bin/ethkey
bin/ethstore"

View File

@ -34,9 +34,11 @@ termux_setup_rust() {
curl https://sh.rustup.rs -sSf > $TERMUX_PKG_TMPDIR/rustup.sh
local _TOOLCHAIN_VERSION=$(bash -c ". $TERMUX_SCRIPTDIR/packages/rust/build.sh; echo \$TERMUX_PKG_VERSION")
if [ -z $TERMUX_RUST_VERSION ]; then
TERMUX_RUST_VERSION=$(bash -c ". $TERMUX_SCRIPTDIR/packages/rust/build.sh; echo \$TERMUX_PKG_VERSION")
fi
sh $TERMUX_PKG_TMPDIR/rustup.sh -y --default-toolchain $_TOOLCHAIN_VERSION
sh $TERMUX_PKG_TMPDIR/rustup.sh -y --default-toolchain $TERMUX_RUST_VERSION
export PATH=$HOME/.cargo/bin:$PATH
rustup target add $CARGO_TARGET_NAME