Skip to content

Commit

Permalink
Update libc crate to 0.2.57
Browse files Browse the repository at this point in the history
This change updates the libc crate to version 0.2.57.

Import subrepo libc/:libc at cdc48ea36d8d2890dba38e8f779001e6855339a2
  • Loading branch information
d-e-s-o committed Jun 1, 2019
1 parent 7c88069 commit 61f2baa
Show file tree
Hide file tree
Showing 109 changed files with 4,088 additions and 3,024 deletions.
27 changes: 20 additions & 7 deletions libc/.cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
freebsd_instance:
image: freebsd-11-1-release-amd64

task:
# This name gets reported as a build status in GitHub
name: stable x86_64-unknown-freebsd
name: stable x86_64-unknown-freebsd-11
freebsd_instance:
image: freebsd-11-2-release-amd64
setup_script:
- pkg install -y curl
- curl https://sh.rustup.rs -sSf --output rustup.sh
- sh rustup.sh -y
- . $HOME/.cargo/env
- rustup default stable
test_script:
- . $HOME/.cargo/env
- sh ci/run.sh x86_64-unknown-freebsd

task:
name: nightly x86_64-unknown-freebsd-12
freebsd_instance:
image: freebsd-12-0-release-amd64
setup_script:
- pkg install -y curl
- curl https://sh.rustup.rs -sSf --output rustup.sh
- sh rustup.sh --default-toolchain nightly -y
- . $HOME/.cargo/env
- rustup default nightly
test_script:
- . $HOME/.cargo/env
- cd libc-test
- cargo test
- sh ci/run.sh x86_64-unknown-freebsd
11 changes: 4 additions & 7 deletions libc/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ matrix:
install: true
script:
- shellcheck --version
- shellcheck ci/*.sh
# FIXME: https://github.com/koalaman/shellcheck/issues/1591
- shellcheck -e SC2103 ci/*.sh
stage: tools-and-build-and-tier1
- name: "Style"
install: true
Expand Down Expand Up @@ -174,6 +175,8 @@ matrix:
stage: tier2
- env: TARGET=asmjs-unknown-emscripten
stage: tier2
- env: TARGET=i686-linux-android
stage: tier2
- env: TARGET=i686-unknown-linux-musl
stage: tier2
- env: TARGET=mips-unknown-linux-gnu
Expand Down Expand Up @@ -230,12 +233,6 @@ matrix:


allow_failures:
# FIXME: android build bots time out irregularly
- env: TARGET=aarch64-linux-android
- env: TARGET=arm-linux-androideabi
# FIXME: https://github.com/rust-lang/libc/issues/1226
- env: TARGET=asmjs-unknown-emscripten
- env: TARGET=wasm32-unknown-emscripten
- name: "Semver Linux"
- name: "Semver MacOSX"

Expand Down
8 changes: 5 additions & 3 deletions libc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libc"
version = "0.2.55"
version = "0.2.57"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
Expand All @@ -23,11 +23,13 @@ appveyor = { repository = "rust-lang/libc", project_name = "rust-lang-libs/libc"
rustc-std-workspace-core = { version = "1.0.0", optional = true }

[features]
default = ["use_std"]
use_std = []
default = ["std"]
std = []
align = []
rustc-dep-of-std = ['align', 'rustc-std-workspace-core']
extra_traits = []
# use_std is deprecated, use `std` instead
use_std = [ 'std' ]

[workspace]
members = ["libc-test"]
4 changes: 3 additions & 1 deletion libc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ libc = "0.2"

## Features

* `use_std`: by default `libc` links to the standard library. Disable this
* `std`: by default `libc` links to the standard library. Disable this
feature remove this dependency and be able to use `libc` in `#![no_std]`
crates.

* `extra_traits`: all `struct`s implemented in `libc` are `Copy` and `Clone`.
This feature derives `Debug`, `Eq`, `Hash`, and `PartialEq`.

* **deprecated**: `use_std` is deprecated, and is equivalent to `std`.

## Rust version support

The minimum supported Rust toolchain version is **Rust 1.13.0** . APIs requiring
Expand Down
36 changes: 36 additions & 0 deletions libc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ fn main() {
std::env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
let align_cargo_feature = std::env::var("CARGO_FEATURE_ALIGN").is_ok();

if std::env::var("CARGO_FEATURE_USE_STD").is_ok() {
println!(
"cargo:warning=\"libc's use_std cargo feature is deprecated since libc 0.2.55; \
please consider using the `std` cargo feature instead\""
);
}

if std::env::var("LIBC_CI").is_ok() {
if let Some(12) = which_freebsd() {
println!("cargo:rustc-cfg=freebsd12");
}
}

// Rust >= 1.15 supports private module use:
if rustc_minor_ver >= 15 || rustc_dep_of_std {
println!("cargo:rustc-cfg=libc_priv_mod_use");
Expand Down Expand Up @@ -63,3 +76,26 @@ fn rustc_minor_version() -> Option<u32> {

otry!(pieces.next()).parse().ok()
}

fn which_freebsd() -> Option<i32> {
let output = std::process::Command::new("freebsd-version").output().ok();
if output.is_none() {
return None;
}
let output = output.unwrap();
if !output.status.success() {
return None;
}

let stdout = String::from_utf8(output.stdout).ok();
if stdout.is_none() {
return None;
}
let stdout = stdout.unwrap();

match &stdout {
s if s.starts_with("11") => Some(11),
s if s.starts_with("12") => Some(12),
_ => None,
}
}
31 changes: 22 additions & 9 deletions libc/ci/android-install-ndk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,40 @@

set -ex

curl --retry 10 -O https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip
unzip -q android-ndk-r15b-linux-x86_64.zip
NDK=android-ndk-r19c
curl --retry 20 -O https://dl.google.com/android/repository/${NDK}-linux-x86_64.zip
unzip -q ${NDK}-linux-x86_64.zip

case "$1" in
arm)
arch=arm
api=24
;;
armv7)
arch=arm
api=24
;;
aarch64)
arch=arm64
api=24
;;

i686)
arch=x86
api=28
;;
x86_64)
arch=x86_64
api=28
;;

*)
arch=$1
echo "invalid arch: $1"
exit 1
;;
esac;

android-ndk-r15b/build/tools/make_standalone_toolchain.py \
--unified-headers \
${NDK}/build/tools/make_standalone_toolchain.py \
--install-dir "/android/ndk-${1}" \
--arch "${arch}" \
--api 24
--api ${api}

rm -rf ./android-ndk-r15b-linux-x86_64.zip ./android-ndk-r15b
rm -rf ./${NDK}-linux-x86_64.zip ./${NDK}
44 changes: 27 additions & 17 deletions libc/ci/android-install-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,56 @@ set -ex
# located in https://github.com/appunite/docker by just wrapping it in a script
# which apparently magically accepts the licenses.

SDK=4333796
mkdir sdk
curl --retry 10 https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -O
unzip -d sdk sdk-tools-linux-3859397.zip
curl --retry 20 https://dl.google.com/android/repository/sdk-tools-linux-${SDK}.zip -O
unzip -q -d sdk sdk-tools-linux-${SDK}.zip

case "$1" in
arm | armv7)
abi=armeabi-v7a
api=24
image="system-images;android-${api};google_apis;armeabi-v7a"
;;

aarch64)
abi=arm64-v8a
api=24
image="system-images;android-${api};google_apis;arm64-v8a"
;;

i686)
abi=x86
api=28
image="system-images;android-${api};default;x86"
;;

x86_64)
abi=x86_64
api=28
image="system-images;android-${api};default;x86_64"
;;

*)
echo "invalid arch: $1"
exit 1
;;
esac;

# See: https://stackoverflow.com/a/51644855/1422197
export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
# Try to fix warning about missing file.
# See https://askubuntu.com/a/1078784
mkdir -p /root/.android/
echo '### User Sources for Android SDK Manager' >> /root/.android/repositories.cfg
echo '#Fri Nov 03 10:11:27 CET 2017 count=0' >> /root/.android/repositories.cfg

# Print all available packages
# yes | ./sdk/tools/bin/sdkmanager --list --verbose

# --no_https avoids
# javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
yes | ./sdk/tools/bin/sdkmanager --licenses --no_https
# javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
#
# | grep -v = || true removes the progress bar output from the sdkmanager
# which produces an insane amount of output.
yes | ./sdk/tools/bin/sdkmanager --licenses --no_https | grep -v = || true
yes | ./sdk/tools/bin/sdkmanager --no_https \
"emulator" \
"platform-tools" \
"platforms;android-24" \
"system-images;android-24;default;$abi"
"platforms;android-${api}" \
"${image}" | grep -v = || true

echo "no" |
./sdk/tools/bin/avdmanager create avd \
--name "${1}" \
--package "system-images;android-24;default;$abi"
--package "${image}" | grep -v = || true
7 changes: 7 additions & 0 deletions libc/ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ test_target() {
# See https://github.com/rust-lang/rust/issues/45417
opt="--release"
fi
# FIXME: https://github.com/rust-lang/rust/issues/61174
if [ "${TARGET}" = "sparcv9-sun-solaris" ] ||
[ "${TARGET}" = "x86_64-sun-solaris" ]; then
return 0
fi

# If there is a std component, fetch it:
if [ "${NO_STD}" != "1" ]; then
Expand Down Expand Up @@ -170,6 +175,7 @@ done
RUST_LINUX_NO_CORE_TARGETS="\
aarch64-pc-windows-msvc \
aarch64-unknown-cloudabi \
aarch64-unknown-freebsd \
aarch64-unknown-hermit \
aarch64-unknown-netbsd \
aarch64-unknown-openbsd \
Expand All @@ -189,6 +195,7 @@ mipsel-unknown-linux-uclibc \
nvptx64-nvidia-cuda \
powerpc-unknown-linux-gnuspe \
powerpc-unknown-netbsd \
powerpc64-unknown-freebsd \
riscv32imac-unknown-none-elf \
riscv32imc-unknown-none-elf \
sparc64-unknown-netbsd \
Expand Down
2 changes: 1 addition & 1 deletion libc/ci/docker/aarch64-linux-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN dpkg --add-architecture i386 && \
python \
unzip \
expect \
openjdk-11-jre \
openjdk-8-jre \
libstdc++6:i386 \
libpulse0 \
gcc \
Expand Down
18 changes: 3 additions & 15 deletions libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,9 @@ FROM ubuntu:19.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates \
gcc-aarch64-linux-gnu qemu-user
RUN curl --retry 5 https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \
tar xzf - && \
cd musl-1.1.19 && \
CC=aarch64-linux-gnu-gcc \
./configure --prefix=/musl-aarch64 --enable-wrapper=yes && \
make install -j4 && \
cd .. && \
rm -rf musl-1.1.19
# Install linux kernel headers sanitized for use with musl
RUN curl --retry 5 -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
tar xzf - && \
cd kernel-headers-3.12.6-6 && \
make ARCH=arm64 prefix=/musl-aarch64 install -j4 && \
cd .. && \
rm -rf kernel-headers-3.12.6-6

COPY install-musl.sh /
RUN sh /install-musl.sh aarch64

# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in libstd?
ENV PATH=$PATH:/musl-aarch64/bin:/rust/bin \
Expand Down
2 changes: 1 addition & 1 deletion libc/ci/docker/arm-linux-androideabi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN dpkg --add-architecture i386 && \
python \
unzip \
expect \
openjdk-11-jre \
openjdk-8-jre \
libstdc++6:i386 \
libpulse0 \
gcc \
Expand Down
16 changes: 2 additions & 14 deletions libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates \
gcc-arm-linux-gnueabihf qemu-user

RUN curl --retry 5 https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | tar xzf -
WORKDIR /musl-1.1.19
RUN CC=arm-linux-gnueabihf-gcc \
CFLAGS="-march=armv6 -marm -mfpu=vfp" \
./configure --prefix=/musl-arm --enable-wrapper=yes
RUN make install -j4

# Install linux kernel headers sanitized for use with musl
RUN curl --retry 5 -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
tar xzf - && \
cd kernel-headers-3.12.6-6 && \
make ARCH=arm prefix=/musl-arm install -j4 && \
cd .. && \
rm -rf kernel-headers-3.12.6-6
COPY install-musl.sh /
RUN sh /install-musl.sh arm

ENV PATH=$PATH:/musl-arm/bin:/rust/bin \
CC_arm_unknown_linux_musleabihf=musl-gcc \
Expand Down
2 changes: 1 addition & 1 deletion libc/ci/docker/i686-linux-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN dpkg --add-architecture i386 && \
python \
unzip \
expect \
openjdk-11-jre \
openjdk-8-jre \
libstdc++6:i386 \
libpulse0 \
gcc \
Expand Down
Loading

0 comments on commit 61f2baa

Please sign in to comment.