1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-04 06:57:47 +00:00

Merge pull request #1095 from ids1024/travis-redox2

Add cross build targeting Redox to Travis CI
This commit is contained in:
Alex Lyon 2017-12-09 19:12:06 -08:00 committed by GitHub
commit 9316fb4603
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 4 deletions

2
.cargo/config Normal file
View file

@ -0,0 +1,2 @@
[target.x86_64-unknown-redox]
linker = "x86_64-unknown-redox-gcc"

View file

@ -25,10 +25,15 @@ matrix:
- rust: nightly - rust: nightly
os: osx os: osx
env: FEATURES=nightly 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: cache:
directories: directories:
- $HOME/.cargo - $HOME/.cargo
sudo: false sudo: true
before_install:
- if [ $REDOX ]; then ./.travis/redox-toolchain.sh; fi
script: script:
- cargo build --features "$FEATURES" - cargo build $CARGO_ARGS --features "$FEATURES"
- cargo test --features "$FEATURES" --no-fail-fast - if [ ! $REDOX ]; then cargo test $CARGO_ARGS --features "$FEATURES" --no-fail-fast; fi

7
.travis/redox-toolchain.sh Executable file
View file

@ -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

View file

@ -674,6 +674,9 @@ fn parse_path_args(path_args: &[String], options: &Options) -> CopyResult<(Vec<S
} }
fn preserve_hardlinks(hard_links: &mut Vec<(String, u64)>, source: &std::path::PathBuf, dest: std::path::PathBuf, found_hard_link: &mut bool) -> CopyResult<()> { fn preserve_hardlinks(hard_links: &mut Vec<(String, u64)>, 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() { if !source.is_dir() {
unsafe { unsafe {
let src_path = CString::new(source.as_os_str().to_str().unwrap()).unwrap(); 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(()) 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![]; let mut hard_links: Vec<(String, u64)> = vec![];
for path in WalkDir::new(root) { for path in WalkDir::new(root) {