diff --git a/ci/build.sh b/ci/build.sh index 512c9cfc9a12a..722626b43d686 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -11,6 +11,7 @@ set -ex : "${OS?The OS environment variable must be set.}" RUST=${TOOLCHAIN} +VERBOSE=-v echo "Testing Rust ${RUST} on ${OS}" @@ -41,50 +42,50 @@ test_target() { # Test that libc builds without any default features (no std) if [ "${NO_STD}" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --no-default-features --target "${TARGET}" else # FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings. RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --no-default-features --target "${TARGET}" + -Z build-std=core,alloc "$VERBOSE" --no-default-features --target "${TARGET}" fi # Test that libc builds with default features (e.g. std) # if the target supports std if [ "$NO_STD" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}" + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --target "${TARGET}" else RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --target "${TARGET}" + -Z build-std=core,alloc "$VERBOSE" --target "${TARGET}" fi # Test that libc builds with the `extra_traits` feature if [ "${NO_STD}" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \ + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --no-default-features --target "${TARGET}" \ --features extra_traits else RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --no-default-features \ + -Z build-std=core,alloc "$VERBOSE" --no-default-features \ --target "${TARGET}" --features extra_traits fi # Test the 'const-extern-fn' feature on nightly if [ "${RUST}" = "nightly" ]; then if [ "${NO_STD}" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \ + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --no-default-features --target "${TARGET}" \ --features const-extern-fn else RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --no-default-features \ + -Z build-std=core,alloc "$VERBOSE" --no-default-features \ --target "${TARGET}" --features const-extern-fn fi fi # Also test that it builds with `extra_traits` and default features: if [ "$NO_STD" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}" \ + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --target "${TARGET}" \ --features extra_traits else RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --target "${TARGET}" \ + -Z build-std=core,alloc "$VERBOSE" --target "${TARGET}" \ --features extra_traits fi } diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 8d85ad794ed53..df1bd04abd7d9 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "libc-test" version = "0.2.151" +edition = "2018" authors = ["The Rust Project Developers"] license = "MIT OR Apache-2.0" build = "build.rs" diff --git a/libc-test/build.rs b/libc-test/build.rs index ec55fadea1ba9..9560e07c8cf7e 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -82,8 +82,7 @@ fn do_semver() { let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap(); // `libc-test/semver` dir. - let mut semver_root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); - semver_root.push("semver"); + let mut semver_root = PathBuf::from("semver"); // NOTE: Windows has the same `family` as `os`, no point in including it // twice. @@ -93,7 +92,10 @@ fn do_semver() { if family != os && os != "android" { process_semver_file(&mut output, &mut semver_root, &family); } - process_semver_file(&mut output, &mut semver_root, &vendor); + // We don't do semver for unknown targets. + if vendor != "unknown" { + process_semver_file(&mut output, &mut semver_root, &vendor); + } process_semver_file(&mut output, &mut semver_root, &os); let os_arch = format!("{}-{}", os, arch); process_semver_file(&mut output, &mut semver_root, &os_arch); @@ -141,6 +143,9 @@ fn process_semver_file>(output: &mut W, path: &mut Path } fn main() { + // Avoid unnecessary re-building. + println!("cargo:rerun-if-changed=build.rs"); + do_cc(); do_ctest(); do_semver(); diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs index 79897ac78fae0..32c65545a8905 100644 --- a/src/unix/linux_like/linux/uclibc/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mod.rs @@ -431,6 +431,7 @@ extern "C" { pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int; pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int; pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int; + pub fn getauxval(type_: ::c_ulong) -> ::c_ulong; } cfg_if! {