mirror of
https://github.com/sharkdp/bat.git
synced 2024-12-22 14:30:42 +01:00
Add arm as a compile target
This commit is contained in:
parent
e5b8c4471a
commit
76be0d3933
25
.travis.yml
25
.travis.yml
@ -17,6 +17,12 @@ matrix:
|
|||||||
- os: osx
|
- os: osx
|
||||||
rust: stable
|
rust: stable
|
||||||
env: TARGET=x86_64-apple-darwin
|
env: TARGET=x86_64-apple-darwin
|
||||||
|
- os: linux
|
||||||
|
rust: stable
|
||||||
|
env:
|
||||||
|
- TARGET=arm-unknown-linux-gnueabihf
|
||||||
|
- CC_arm_unknown_linux_gnueabihf=/usr/bin/arm-linux-gnueabihf-gcc-4.8
|
||||||
|
- CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc-4.8
|
||||||
|
|
||||||
# Minimum Rust supported channel.
|
# Minimum Rust supported channel.
|
||||||
- os: linux
|
- os: linux
|
||||||
@ -39,15 +45,10 @@ matrix:
|
|||||||
- cargo install --debug --force rustfmt-nightly
|
- cargo install --debug --force rustfmt-nightly
|
||||||
script: cargo fmt -- --check
|
script: cargo fmt -- --check
|
||||||
|
|
||||||
addons:
|
sudo: required
|
||||||
apt:
|
|
||||||
packages:
|
before_install:
|
||||||
# needed for i686-unknown-linux-gnu target
|
- ci/before_install.bash
|
||||||
- gcc-multilib
|
|
||||||
# needed for musl targets
|
|
||||||
- musl-tools
|
|
||||||
# needed to build deb packages
|
|
||||||
- fakeroot
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
@ -62,11 +63,7 @@ install:
|
|||||||
- if [[ $TRAVIS_OS_NAME = linux && $HOST != $TARGET ]]; then rustup target add $TARGET; fi
|
- if [[ $TRAVIS_OS_NAME = linux && $HOST != $TARGET ]]; then rustup target add $TARGET; fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# Incorporate TARGET env var to the build and test process
|
- ci/script.bash
|
||||||
- cargo build --target $TARGET --verbose
|
|
||||||
- cargo test --target $TARGET --verbose
|
|
||||||
# Run 'bat' on its own source code and the README
|
|
||||||
- cargo run --target $TARGET -- src/main.rs README.md --paging=never
|
|
||||||
|
|
||||||
before_deploy:
|
before_deploy:
|
||||||
- bash ci/before_deploy.bash
|
- bash ci/before_deploy.bash
|
||||||
|
@ -11,17 +11,24 @@ pack() {
|
|||||||
local tempdir
|
local tempdir
|
||||||
local out_dir
|
local out_dir
|
||||||
local package_name
|
local package_name
|
||||||
|
local gcc_prefix
|
||||||
|
|
||||||
tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
||||||
out_dir=$(pwd)
|
out_dir=$(pwd)
|
||||||
package_name="$PROJECT_NAME-$TRAVIS_TAG-$TARGET"
|
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
|
# create a "staging" directory
|
||||||
mkdir "$tempdir/$package_name"
|
mkdir "$tempdir/$package_name"
|
||||||
|
|
||||||
# copying the main binary
|
# copying the main binary
|
||||||
cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"
|
cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"
|
||||||
strip "$tempdir/$package_name/$PROJECT_NAME"
|
"${gcc_prefix}"strip "$tempdir/$package_name/$PROJECT_NAME"
|
||||||
|
|
||||||
# readme and license
|
# readme and license
|
||||||
cp README.md "$tempdir/$package_name"
|
cp README.md "$tempdir/$package_name"
|
||||||
@ -50,8 +57,8 @@ make_deb() {
|
|||||||
architecture=i386
|
architecture=i386
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "ERROR: unknown target" >&2
|
echo "make_deb: skipping target '${TARGET}'" >&2
|
||||||
return 1
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
version=${TRAVIS_TAG#v}
|
version=${TRAVIS_TAG#v}
|
||||||
|
29
ci/before_install.bash
Executable file
29
ci/before_install.bash
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
if [ "$TRAVIS_OS_NAME" != linux ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
|
|
||||||
|
# needed for musl targets
|
||||||
|
sudo apt-get install -y musl-tools
|
||||||
|
|
||||||
|
# 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-gnueabihf ]]; then
|
||||||
|
sudo apt-get install -y \
|
||||||
|
gcc-4.8-arm-linux-gnueabihf \
|
||||||
|
binutils-arm-linux-gnueabihf \
|
||||||
|
libc6-armhf-cross \
|
||||||
|
libc6-dev-armhf-cross
|
||||||
|
fi
|
14
ci/script.bash
Executable file
14
ci/script.bash
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/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-gnueabihf ]]; then
|
||||||
|
cargo test --target "$TARGET" --verbose
|
||||||
|
|
||||||
|
# Run 'bat' on its own source code and the README
|
||||||
|
cargo run --target "$TARGET" -- src/main.rs README.md --paging=never
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user