From f6dcca3ebb6341049b8fc4c890a463277c493bc4 Mon Sep 17 00:00:00 2001 From: gabriel klawitter Date: Tue, 6 Nov 2018 20:26:05 +0100 Subject: [PATCH] gitlab-ci: make android release build succeed (#9743) * use docker cargo config file for android builds * make android build succeed --- .gitlab-ci.yml | 2 -- scripts/gitlab/build-unix.sh | 49 +++++++++++++++++++++++---------- scripts/gitlab/build-windows.sh | 2 -- 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fc2adcc31..ffb3a3ee7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,8 +9,6 @@ image: parity/rust:gitlab-ci variables: CI_SERVER_NAME: "GitLab CI" CARGO_HOME: "${CI_PROJECT_DIR}/.cargo" - BUILD_TARGET: ubuntu - BUILD_ARCH: amd64 CARGO_TARGET: x86_64-unknown-linux-gnu cache: diff --git a/scripts/gitlab/build-unix.sh b/scripts/gitlab/build-unix.sh index 00933f1ee..cf6bfe147 100755 --- a/scripts/gitlab/build-unix.sh +++ b/scripts/gitlab/build-unix.sh @@ -6,18 +6,23 @@ set -u # treat unset variables as error echo "__________Show ENVIROMENT__________" echo "CI_SERVER_NAME: " $CI_SERVER_NAME echo "CARGO_HOME: " $CARGO_HOME -echo "BUILD_TARGET: " $BUILD_TARGET -echo "BUILD_ARCH: " $BUILD_ARCH echo "CARGO_TARGET: " $CARGO_TARGET echo "CC: " $CC echo "CXX: " $CXX echo "__________CARGO CONFIG__________" -mkdir -p .cargo -rm -f .cargo/config -echo "[target.$CARGO_TARGET]" >> .cargo/config -echo "linker= \"$CC\"" >> .cargo/config -cat .cargo/config +if [ "${CARGO_TARGET}" = "armv7-linux-androideabi" ] +then + # use build container's cargo config + cat /.cargo/config +else + mkdir -p .cargo + rm -f .cargo/config + echo "[target.$CARGO_TARGET]" >> .cargo/config + echo "linker= \"$CC\"" >> .cargo/config + cat .cargo/config +fi + echo "_____ Building target: "$CARGO_TARGET" _____" time cargo build --target $CARGO_TARGET --release --features final @@ -32,15 +37,31 @@ mkdir -p artifacts cd artifacts mkdir -p $CARGO_TARGET cd $CARGO_TARGET -cp ../../target/$CARGO_TARGET/release/parity ./parity -cp ../../target/$CARGO_TARGET/release/parity-evm ./parity-evm -cp ../../target/$CARGO_TARGET/release/ethstore ./ethstore -cp ../../target/$CARGO_TARGET/release/ethkey ./ethkey -cp ../../target/$CARGO_TARGET/release/whisper ./whisper -strip -v ./* +cp -v ../../target/$CARGO_TARGET/release/parity ./parity +cp -v ../../target/$CARGO_TARGET/release/parity-evm ./parity-evm +cp -v ../../target/$CARGO_TARGET/release/ethstore ./ethstore +cp -v ../../target/$CARGO_TARGET/release/ethkey ./ethkey +cp -v ../../target/$CARGO_TARGET/release/whisper ./whisper + + +# stripping can also be done on release build time +# export RUSTFLAGS="${RUSTFLAGS} -C link-arg=-s" +if [ "${CARGO_TARGET}" = "armv7-linux-androideabi" ] +then + arm-linux-androideabi-strip -v ./* +else + strip -v ./* +fi + echo "_____ Calculating checksums _____" for binary in $(ls) do rhash --sha256 $binary -o $binary.sha256 - ./parity tools hash $binary > $binary.sha3 + if [ "${CARGO_TARGET}" = "armv7-linux-androideabi" ] + then + echo "> ${binary} cannot be hashed with cross-compiled binary" + else + ./parity tools hash $binary > $binary.sha3 + fi done + diff --git a/scripts/gitlab/build-windows.sh b/scripts/gitlab/build-windows.sh index afd4c64a6..d4176c758 100755 --- a/scripts/gitlab/build-windows.sh +++ b/scripts/gitlab/build-windows.sh @@ -8,8 +8,6 @@ set LIB="C:\vs2015\VC\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240. echo "__________Show ENVIROMENT__________" echo "CI_SERVER_NAME: " $CI_SERVER_NAME echo "CARGO_HOME: " $CARGO_HOME -echo "BUILD_TARGET: " $BUILD_TARGET -echo "BUILD_ARCH: " $BUILD_ARCH echo "CARGO_TARGET: " $CARGO_TARGET echo "_____ Building target: "$CARGO_TARGET" _____"