Add support to the arm-unknown-linux-gnueabihf platform

This commit is contained in:
Peltoche 2018-12-17 13:32:35 +01:00 committed by Pierre Peltier
parent f162a677dd
commit 072757b33d
4 changed files with 53 additions and 25 deletions

View file

@ -15,30 +15,23 @@ matrix:
- os: osx
rust: stable
env: TARGET=x86_64-apple-darwin
- os: linux
rust: stable
env:
- TARGET=arm-unknown-linux-gnueabihf
- CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc-4.8
# Beta channel.
# The other platforms are disabled in order to reduce the total CI time
- os: linux
rust: beta
env: TARGET=x86_64-unknown-linux-gnu
# Disabled to reduce total CI time
# - os: linux
# rust: beta
# env: TARGET=i686-unknown-linux-gnu
# - os: osx
# rust: beta
# env: TARGET=x86_64-apple-darwin
# Nightly channel.
# The other platforms are disabled in order to reduce the total CI time
- os: linux
rust: nightly
env: TARGET=x86_64-unknown-linux-gnu
# Disabled to reduce total CI time
# - os: linux
# rust: nightly
# env: TARGET=i686-unknown-linux-gnu
# - os: osx
# rust: nightly
# env: TARGET=x86_64-apple-darwin
# Minimum Rust supported channel.
- os: linux
@ -50,6 +43,11 @@ matrix:
- os: osx
rust: 1.30.1
env: TARGET=x86_64-apple-darwin
- os: linux
rust: 1.30.1
env:
- TARGET=arm-unknown-linux-gnueabihf
- CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc-4.8
# Code formatting check
- os: linux
@ -60,13 +58,6 @@ matrix:
script:
- cargo clippy --all-features -- -D clippy::pedantic
addons:
apt:
packages:
# needed for i686-unknown-linux-gnu target
- gcc-multilib
- fakeroot
env:
global:
# Default target on travis-ci.
@ -80,13 +71,13 @@ install:
- if [[ $TRAVIS_OS_NAME = linux && $HOST != $TARGET ]]; then rustup target add $TARGET; fi
script:
# Incorporate TARGET env var to the build and test process
- cargo build --target $TARGET --verbose
- cargo test --target $TARGET --verbose
- bash ci/script.bash
before_install:
- bash ci/before_install.bash
before_deploy:
- bash deploy/before_deploy.bash
- bash ci/before_deploy.bash
deploy:
provider: releases

26
ci/before_install.bash Normal file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -ex
if [ "$TRAVIS_OS_NAME" != linux ]; then
exit 0
fi
sudo apt-get update
# needed to build deb packages
sudo apt-get install -y fakeroot
# needed for i686 linux gnu target
if [[ $TARGET == i686-unknown-linux-gnu ]]; then
sudo apt-get install -y gcc-multilib
fi
# needed for cross-compiling for arm
if [[ $TARGET == arm-unknown-linux-* ]]; then
sudo apt-get install -y \
gcc-4.8-arm-linux-gnueabihf \
binutils-arm-linux-gnueabihf \
libc6-armhf-cross \
libc6-dev-armhf-cross
fi

11
ci/script.bash Normal file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -ex
# Incorporate TARGET env var to the build and test process
cargo build --target "$TARGET" --verbose
# We cannot run arm executables on linux
if [[ $TARGET != arm-unknown-linux-* ]]; then
cargo test --target "$TARGET" --verbose
fi