Enable ARM cross-compilation
Before adoption: this commit came in with the history the project adopted, so no landing records it.
closes #244
authored by sharkdp · committed by sharkdp · parent e4f61bc · Browse files · 4 files·+57 added−13 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+57 added−13 removed
- other:+57 added−13 removed
Provenance
- Commit
6fb5004- Tree
f8f4ac8- Author
sharkdp <davidpeter@web.de>- Committer
sharkdp <davidpeter@web.de>- Parent
e4f61bc
4 files changed+57 added−13 removed
modified:ci/before_deploy.bash+10 added-3 removed
9 unmodified lines1011121314151617181920212223242526272829303125323334353626 unmodified lines63646566606167686970717256 unmodified lines9 unmodified linespack() { local tempdir local out_dir local package_name local gcc_prefix
tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp) out_dir=$(pwd) package_name="$PROJECT_NAME-$TRAVIS_TAG-$TARGET"
if [[ $TARGET == "arm-unknown-linux-gnueabihf" ]]; then gcc_prefix="arm-linux-gnueabihf-" else gcc_prefix="" fi
# create a "staging" directory mkdir "$tempdir/$package_name" mkdir "$tempdir/$package_name/autocomplete"
# copying the main binary cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/" strip "$tempdir/$package_name/$PROJECT_NAME" "${gcc_prefix}"strip "$tempdir/$package_name/$PROJECT_NAME"
# manpage, readme and license cp "doc/$PROJECT_NAME.1" "$tempdir/$package_name" cp README.md "$tempdir/$package_name"26 unmodified lines i686*) architecture=i386 ;; *) echo "ERROR: unknown target" >&2 return 1 echo "make_deb: skipping target '${TARGET}'" >&2 return 0 ;; esac version=${TRAVIS_TAG#v} if [[ $TARGET = *musl* ]]; then56 unmodified linesadded:ci/before_install.bash+26 added
1234567891011121314151617181920212223242526#!/usr/bin/env bash
set -ex
if [ "$TRAVIS_OS_NAME" != linux ]; then exit 0fi
sudo apt-get update
# needed to build deb packagessudo apt-get install -y fakeroot
# needed for i686 linux gnu targetif [[ $TARGET == i686-unknown-linux-gnu ]]; then sudo apt-get install -y gcc-multilibfi
# needed for cross-compiling for armif [[ $TARGET == arm-unknown-linux-gnueabihf ]]; then sudo apt-get install -y \ gcc-4.8-arm-linux-gnueabihf \ binutils-arm-linux-gnueabihf \ libc6-armhf-cross \ libc6-dev-armhf-crossfiadded:ci/script.bash+11 added
1234567891011#!/usr/bin/env bash
set -ex
# Incorporate TARGET env var to the build and test processcargo build --target "$TARGET" --verbose
# We cannot run arm executables on linuxif [[ $TARGET != arm-unknown-linux-gnueabihf ]]; then cargo test --target "$TARGET" --verbosefimodified:.travis.yml+10 added-10 removed
18 unmodified lines19 env: TARGET=i686-unknown-linux-musl20 - os: osx21 rust: stable22 env: TARGET=x86_64-apple-darwin23+ - os: linux24+ rust: stable25+ env:26+ - TARGET=arm-unknown-linux-gnueabihf27+ - CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc-4.828 29 # Beta channel.30 - os: linux31 rust: beta54 unmodified lines86 install:87 - cargo install --debug --force rustfmt-nightly88 script: cargo fmt -- --check89 85-addons:86- apt:87- packages:88- # needed for i686-unknown-linux-gnu target89- - gcc-multilib90- # needed to build deb packages91- - fakeroot90+sudo: required91 92+before_install:93+ - ci/before_install.bash94+95 env:96 global:97 # Default target on travis-ci.98 # Used as conditional check in the install stage5 unmodified lines104 # prevent target re-add error from rustup105 - if [[ $TRAVIS_OS_NAME = linux && $HOST != $TARGET ]]; then rustup target add $TARGET; fi106 107 script:106- # Incorporate TARGET env var to the build and test process107- - cargo build --target $TARGET --verbose108- - cargo test --target $TARGET --verbose108+ - ci/script.bash109 110 before_deploy:111 - bash ci/before_deploy.bash112 29 unmodified lines