From 14a75602e6f57b4000eae130bd110d9e62bfd51c Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Mon, 9 Oct 2023 13:11:03 +0900 Subject: [PATCH 1/2] Say goodbye to GH Pages in favor of docs.rs Signed-off-by: Yuki Okushi --- .github/workflows/bors.yml | 20 ---------- .github/workflows/docs.yml | 37 ----------------- README.md | 3 +- ci/dox.sh | 82 -------------------------------------- src/lib.rs | 4 -- 5 files changed, 1 insertion(+), 145 deletions(-) delete mode 100644 .github/workflows/docs.yml delete mode 100644 ci/dox.sh diff --git a/.github/workflows/bors.yml b/.github/workflows/bors.yml index cc0bb667bdf2..e171f7e6789e 100644 --- a/.github/workflows/bors.yml +++ b/.github/workflows/bors.yml @@ -335,24 +335,6 @@ jobs: - name: Build with check-cfg run: LIBC_CI=1 LIBC_CHECK_CFG=1 cargo build -Z unstable-options -Z check-cfg=features,names,values,output - docs: - permissions: - actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds) - contents: read # to fetch code (actions/checkout) - - name: Generate documentation - runs-on: ubuntu-22.04 - needs: docker_linux_tier2 - steps: - - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD - with: - github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v3 - - name: Setup Rust toolchain - run: sh ./ci/install-rust.sh - - name: Generate documentation - run: LIBC_CI=1 sh ci/dox.sh - # These jobs doesn't actually test anything, but they're only used to tell # bors the build completed, as there is no practical way to detect when a # workflow is successful listening to webhooks only. @@ -374,7 +356,6 @@ jobs: build_channels_linux, build_channels_macos, build_channels_windows, - docs, ] steps: @@ -396,7 +377,6 @@ jobs: build_channels_linux, build_channels_macos, build_channels_windows, - docs, ] steps: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index ff722bc96e74..000000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Upload documentation to GitHub Pages - -on: - push: - branches: - - main - -# Sets permissions of `GITHUB_TOKEN` to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -jobs: - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Rust toolchain - run: TARGET=x86_64-unknown-linux-gnu sh ./ci/install-rust.sh - - name: Generate documentation - run: LIBC_CI=1 sh ci/dox.sh - - name: Setup Pages - uses: actions/configure-pages@v3 - - name: Fix permissions - run: rm -f ./target/doc/.lock - - name: Upload artifact - uses: actions/upload-pages-artifact@v2 - with: - path: 'target/doc' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 diff --git a/README.md b/README.md index 43d706d0f2a6..29d2a4b6160f 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ newer Rust features are only available on newer Rust toolchains: ## Platform support -[Platform-specific documentation (HEAD)][docs.head]. +You can see the platform(target)-specific docs on [docs.rs], select a platform you want to see. See [`ci/build.sh`](https://github.com/rust-lang/libc/blob/HEAD/ci/build.sh) @@ -107,4 +107,3 @@ dual licensed as above, without any additional terms or conditions. [Documentation]: https://docs.rs/libc/badge.svg [docs.rs]: https://docs.rs/libc [License]: https://img.shields.io/crates/l/libc.svg -[docs.head]: https://rust-lang.github.io/libc/#platform-specific-documentation diff --git a/ci/dox.sh b/ci/dox.sh deleted file mode 100644 index 6dd1e4a2282c..000000000000 --- a/ci/dox.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env sh - -# Builds documentation for all target triples that we have a registered URL for -# in liblibc. This scrapes the list of triples to document from `src/lib.rs` -# which has a bunch of `html_root_url` directives we pick up. - -set -ex - -TARGET_DOC_DIR="target/doc" -README="README.md" -PLATFORM_SUPPORT="platform-support.md" - -rm -rf "$TARGET_DOC_DIR" -mkdir -p "$TARGET_DOC_DIR" - -if ! rustc --version | grep -E "nightly" ; then - echo "Building the documentation requires a nightly Rust toolchain" - exit 1 -fi - -rustup component add rust-src - -# List all targets that do currently build successfully: -# shellcheck disable=SC1003 -grep '[\d|\w|-]* \\' ci/build.sh > targets -sed -i.bak 's/ \\//g' targets -grep '^[_a-zA-Z0-9-]*$' targets | sort > tmp && mv tmp targets - -# Create a markdown list of supported platforms in $PLATFORM_SUPPORT -rm $PLATFORM_SUPPORT || true - -printf '### Platform-specific documentation\n' >> $PLATFORM_SUPPORT - -while read -r target; do - echo "documenting ${target}" - - case "${target}" in - *apple*) - # FIXME: - # We can't build docs of apple targets from Linux yet. - continue - ;; - *) - ;; - esac - - rustup target add "${target}" || true - - # Enable extra configuration flags: - export RUSTDOCFLAGS="--cfg freebsd11" - - # If cargo doc fails, then try with unstable feature: - if ! cargo doc --target "${target}" \ - --no-default-features --features const-extern-fn,extra_traits ; then - cargo doc --target "${target}" \ - -Z build-std=core,alloc \ - --no-default-features --features const-extern-fn,extra_traits - fi - - mkdir -p "${TARGET_DOC_DIR}/${target}" - cp -r "target/${target}/doc" "${TARGET_DOC_DIR}/${target}" - - echo "* [${target}](${target}/doc/libc/index.html)" >> $PLATFORM_SUPPORT -done < targets - -# Replace
with the contents of $PLATFORM_SUPPORT -cp $README $TARGET_DOC_DIR -line=$(grep -n '
' $README | cut -d ":" -f 1) - -{ head -n "$((line-1))" $README; cat $PLATFORM_SUPPORT; tail -n "+$((line+1))" $README; } > $TARGET_DOC_DIR/$README - -cp $TARGET_DOC_DIR/$README $TARGET_DOC_DIR/index.md - -RUSTDOCFLAGS="--enable-index-page --index-page=${TARGET_DOC_DIR}/index.md -Zunstable-options" cargo doc - -# Tweak style -cp ci/rust.css $TARGET_DOC_DIR -sed -ie "8i " $TARGET_DOC_DIR/index.html -sed -ie "9i " $TARGET_DOC_DIR/index.html - -# Copy the licenses -cp LICENSE-* $TARGET_DOC_DIR/ diff --git a/src/lib.rs b/src/lib.rs index dc8f8312072e..1b6f0c077ab2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,4 @@ //! libc - Raw FFI bindings to platforms' system libraries -//! -//! [Documentation for other platforms][pd]. -//! -//! [pd]: https://rust-lang.github.io/libc/#platform-specific-documentation #![crate_name = "libc"] #![crate_type = "rlib"] #![allow( From 0a061968641e58c315dc5754420938d8d7895d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E6=B5=A9?= Date: Mon, 9 Oct 2023 21:07:36 +0800 Subject: [PATCH 2/2] bugfix for teeos use Option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 袁浩 --- src/teeos/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/teeos/mod.rs b/src/teeos/mod.rs index 13d8ce1b8ffd..cffe04197657 100644 --- a/src/teeos/mod.rs +++ b/src/teeos/mod.rs @@ -8,6 +8,8 @@ // only supported on Rust > 1.59, so we can directly reexport c_void from core. pub use core::ffi::c_void; +use Option; + pub type c_schar = i8; pub type c_uchar = u8;