From a23a8ed1f15d691ea36a2ceb5e71d4f727c67095 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Mon, 13 Nov 2017 22:50:58 -0800 Subject: [PATCH 1/2] Add cross build targeting Redox to Travis CI --- .cargo/config | 2 ++ .travis.yml | 11 ++++++++--- .travis/redox-toolchain.sh | 7 +++++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 .cargo/config create mode 100755 .travis/redox-toolchain.sh diff --git a/.cargo/config b/.cargo/config new file mode 100644 index 000000000..58e1381b1 --- /dev/null +++ b/.cargo/config @@ -0,0 +1,2 @@ +[target.x86_64-unknown-redox] +linker = "x86_64-unknown-redox-gcc" diff --git a/.travis.yml b/.travis.yml index 85307b57d..27663f7c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,10 +25,15 @@ matrix: - rust: nightly os: osx env: FEATURES=nightly + - rust: nightly + os: linux + env: FEATURES=nightly,redox CC=x86_64-unknown-redox-gcc CARGO_ARGS='--no-default-features --target=x86_64-unknown-redox' REDOX=1 cache: directories: - $HOME/.cargo -sudo: false +sudo: true +before_install: + - if [ $REDOX ]; then ./.travis/redox-toolchain.sh; fi script: - - cargo build --features "$FEATURES" - - cargo test --features "$FEATURES" --no-fail-fast + - cargo build $CARGO_ARGS --features "$FEATURES" + - if [ ! $REDOX ]; then cargo test $CARGO_ARGS --features "$FEATURES" --no-fail-fast; fi diff --git a/.travis/redox-toolchain.sh b/.travis/redox-toolchain.sh new file mode 100755 index 000000000..83bc8fc45 --- /dev/null +++ b/.travis/redox-toolchain.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +rustup target add x86_64-unknown-redox +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AA12E97F0881517F +sudo add-apt-repository 'deb https://static.redox-os.org/toolchain/apt /' +sudo apt-get update -qq +sudo apt-get install -y x86-64-unknown-redox-gcc From 75141f03823c46ca1fc6880d66458081c8cc7f9e Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Mon, 13 Nov 2017 22:51:55 -0800 Subject: [PATCH 2/2] Fix cp build on Redox --- src/cp/cp.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cp/cp.rs b/src/cp/cp.rs index 2014388a0..bab66bd77 100644 --- a/src/cp/cp.rs +++ b/src/cp/cp.rs @@ -674,6 +674,9 @@ fn parse_path_args(path_args: &[String], options: &Options) -> CopyResult<(Vec, source: &std::path::PathBuf, dest: std::path::PathBuf, found_hard_link: &mut bool) -> CopyResult<()> { + // Redox does not currently support hard links + #[cfg(not(target_os = "redox"))] + { if !source.is_dir() { unsafe { let src_path = CString::new(source.as_os_str().to_str().unwrap()).unwrap(); @@ -714,6 +717,7 @@ fn preserve_hardlinks(hard_links: &mut Vec<(String, u64)>, source: &std::path::P } } } + } Ok(()) } @@ -826,7 +830,8 @@ fn copy_directory(root: &Path, target: &Target, options: &Options) -> CopyResult } } - #[cfg(windows)] + // This should be changed once Redox supports hardlinks + #[cfg(any(windows, target_os = "redox"))] let mut hard_links: Vec<(String, u64)> = vec![]; for path in WalkDir::new(root) {