From 9f153e971a57834c5f0ea4d9c6772d1041483169 Mon Sep 17 00:00:00 2001 From: gnzlbg <gonzalobg88@gmail.com> Date: Tue, 9 Jul 2019 12:19:53 +0200 Subject: [PATCH] Patch mingw libraries for windows gnu targets --- Cargo.toml | 2 +- azure-pipelines.yml | 21 ++++++++++++++++----- ci/README.md | 13 +++---------- ci/azure-install-rust.yml | 36 ++++++++++++++++++++++++++++++------ ci/dox.sh | 7 ------- 5 files changed, 50 insertions(+), 29 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bf6ff2c0..0b054a84 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ documentation = "http://doc.rust-lang.org/libc" keywords = ["libc", "ffi", "bindings", "operating", "system" ] categories = ["external-ffi-bindings", "no-std", "os"] build = "build.rs" -exclude = ["/ci/*", "/.travis.yml", "/appveyor.yml"] +exclude = ["/ci/*", "/azure-pipelines.yml"] description = """ Raw FFI bindings to platform libraries like libc. """ diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 02365216..0e7803d9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,5 +1,13 @@ -trigger: - - master +variables: + - group: secrets +resources: + repositories: + - repository: rustinfra + type: github + name: rust-lang/simpleinfra + endpoint: rust-lang +trigger: ["master"] +pr: ["master"] jobs: - job: DockerLinux @@ -99,13 +107,13 @@ jobs: matrix: x86_64-pc-windows-gnu: TARGET: x86_64-pc-windows-gnu - MSYS_BITS: 64 + ARCH_BITS: 64 ARCH: x86_64 x86_64-pc-windows-msvc: TARGET: x86_64-pc-windows-msvc i686-pc-windows-gnu: TARGET: i686-pc-windows-gnu - MSYS_BITS: 32 + ARCH_BITS: 32 ARCH: i686 i686-pc-windows-msvc: TARGET: i686-pc-windows-msvc @@ -118,7 +126,10 @@ jobs: - script: sh ci/style.sh displayName: Check style - script: sh ci/dox.sh - displayName: Generate and upload documentation + displayName: Generate documentation + - template: azure-configs/static-websites.yml@rustinfra + parameters: + deploy_dir: target/doc #- job: SemverLinux # continueOnError: true diff --git a/ci/README.md b/ci/README.md index 28152e5d..31235538 100644 --- a/ci/README.md +++ b/ci/README.md @@ -8,19 +8,12 @@ this project. First up, let's talk about the files in this directory: -* `run-travis.sh` - a shell script run by all Travis builders, this is - responsible for setting up the rest of the environment such as installing new - packages, downloading Rust target libraries, etc. +* `run-docker.sh` - a shell script run by most builders, it will execute + `run.sh` inside a Docker container configured for the target. * `run.sh` - the actual script which runs tests for a particular architecture. - Called from the `run-travis.sh` script this will run all tests for the target - specified. -* `cargo-config` - Cargo configuration of linkers to use copied into place by - the `run-travis.sh` script before builds are run. - -* `dox.sh` - script called from `run-travis.sh` on only the linux 64-bit nightly - Travis bots to build documentation for this crate. +* `dox.sh` - build the documentation of the crate and publish it to gh-pages. * `landing-page-*.html` - used by `dox.sh` to generate a landing page for all architectures' documentation. diff --git a/ci/azure-install-rust.yml b/ci/azure-install-rust.yml index 509bd6d6..c94f3dcd 100644 --- a/ci/azure-install-rust.yml +++ b/ci/azure-install-rust.yml @@ -15,9 +15,10 @@ steps: displayName: Install rust (unix) condition: ne( variables['Agent.OS'], 'Windows_NT' ) - script: | + @echo on if not defined TOOLCHAIN set TOOLCHAIN=nightly - rustup update %TOOLCHAIN% - rustup default %TOOLCHAIN% + rustup update %TOOLCHAIN%-%TARGET% + rustup default %TOOLCHAIN%-%TARGET% displayName: Install rust (windows) condition: eq( variables['Agent.OS'], 'Windows_NT' ) - script: | @@ -27,13 +28,31 @@ steps: fi condition: ne( variables['Agent.OS'], 'Windows_NT' ) displayName: Install target (unix) - - script: if defined TARGET rustup target add %TARGET% + - script: | + @echo on + if defined TARGET rustup target add %TARGET% condition: eq( variables['Agent.OS'], 'Windows_NT' ) displayName: Install target (windows) - #- script: if defined MSYS_BITS for %%I in (crt2.o dllcrt2.o libmsvcrt.a) do xcopy /Y "C:\msys64\mingw%MSYS_BITS%\%ARCH%-w64-mingw32\lib\%%I" "C:\Program Files (x86)\Rust\lib\rustlib\%TARGET%\lib" - # condition: eq( variables['Agent.OS'], 'Windows_NT' ) - # displayName: Fix MinGW (windows) - script: | + @echo on + if "%ARCH%" == "i686" choco install mingw --x86 --force + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + displayName: Install MinGW32 (windows) + - bash: | + set -ex + gcc -print-search-dirs + find "C:\ProgramData\Chocolatey" -name "crt2*" + find "C:\ProgramData\Chocolatey" -name "dllcrt2*" + find "C:\ProgramData\Chocolatey" -name "libmsvcrt*" + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + displayName: Find GCC libraries (windows) + - script: | + @echo on + if not defined TOOLCHAIN set TOOLCHAIN=nightly + if defined ARCH_BITS for %%I in (crt2.o dllcrt2.o libmsvcrt.a) do xcopy /Y "C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw%ARCH_BITS%\%ARCH%-w64-mingw32\lib\%%I" "C:\Program Files\Rust\.rustup\toolchains\%TOOLCHAIN%-%TARGET%\lib\rustlib\%TARGET%\lib\%%I" + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + displayName: Fix MinGW (windows) + - bash: | set -ex rustc -Vv cargo -V @@ -44,6 +63,11 @@ steps: which rustup displayName: Query rust and cargo versions - script: | + @echo on + where gcc + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + displayName: Query gcc path + - bash: | set -ex cargo generate-lockfile cargo generate-lockfile --manifest-path libc-test/Cargo.toml diff --git a/ci/dox.sh b/ci/dox.sh index 823c8113..49abd546 100644 --- a/ci/dox.sh +++ b/ci/dox.sh @@ -69,10 +69,3 @@ set -x # Copy the licenses cp LICENSE-* $TARGET_DOC_DIR/ - -# If we're on travis, not a PR, and on the right branch, publish! -if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then - pip install ghp_import --install-option="--prefix=$HOME/.local" - "${HOME}/.local/bin/ghp-import" $TARGET_DOC_DIR - git push -qf "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" gh-pages -fi -- GitLab