From fc0aba647d3a881f5541d0bbb3d0e6d00debac72 Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Fri, 17 May 2024 12:08:19 +0200 Subject: [PATCH 01/10] Add missing package files --- Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index c3f0bdfe..beeabf09 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,8 @@ include = [ "LICENSE*", "/README.md", "build.rs", + "zng/cc.rs", + "zng/cmake.rs", "src/*.rs", "src/*.c", "src/zlib/*.[ch]", From e8b8465cee1ffeaa5dc78926f35c61f99800ec82 Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Fri, 17 May 2024 12:19:20 +0200 Subject: [PATCH 02/10] Add CI check for packaging --- .github/workflows/ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d4e874d..c42508d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,6 +80,18 @@ jobs: - x86_64-apple-darwin cc: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + submodules: true + # ensures packaging works + - run: | + cargo package --all-features + cargo package --no-default-features --features zlib-ng-no-cmake-experimental-community-maintained + cargo package --no-default-features --features zlib-ng + + package: runs-on: ubuntu-22.04 env: TARGET_TRIPLE: x86_64-unknown-linux-gnu From 34e6e40248f40bf8d6f11262c5b03ea890790f7e Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Fri, 17 May 2024 12:34:04 +0200 Subject: [PATCH 03/10] Bump version/CI --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index beeabf09..548be2ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libz-sys" -version = "1.1.17" +version = "1.1.18" authors = [ "Alex Crichton ", "Josh Triplett ", From 66b68f50d6971c59768729bb9b7fdb88a6fb5e4a Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Fri, 17 May 2024 13:56:06 +0200 Subject: [PATCH 04/10] Oops --- .github/workflows/ci.yml | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c42508d0..7d057dae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,32 +85,31 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: submodules: true - # ensures packaging works + # Ensures --all-features builds correctly, the current logic will mean it + # uses stock zlib, not cmake nor cc - run: | - cargo package --all-features - cargo package --no-default-features --features zlib-ng-no-cmake-experimental-community-maintained - cargo package --no-default-features --features zlib-ng + cargo test --all-features + cargo run --manifest-path systest/Cargo.toml --all-features + # Ensures zlib-ng builds and runs, though zlib-ng _could_ change internally + # and not use all optimizations available to the CI runner, we do this here + # just for x86_64-unknown-linux-gnu to validate a common target compiles + # on a more recent compiler than the incredibly ancient one currently used by cross + - run: | + cargo test --no-default-features --features zlib-ng-no-cmake-experimental-community-maintained || echo "::warning::failed to build libz-ng with --features zlib-ng-no-cmake-experimental-community-maintained" + cargo run --manifest-path systest/Cargo.toml --no-default-features --features zlib-ng-no-cmake-experimental-community-maintained || echo "::warning::failed to run systest with --features zlib-ng-no-cmake-experimental-community-maintained" + + # ensures packaging works package: runs-on: ubuntu-22.04 - env: - TARGET_TRIPLE: x86_64-unknown-linux-gnu steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: submodules: true - # Ensures --all-features builds correctly, the current logic will mean it - # uses stock zlib, not cmake nor cc - - run: | - cargo test --target $TARGET_TRIPLE --all-features - cargo run --target $TARGET_TRIPLE --manifest-path systest/Cargo.toml --all-features - # Ensures zlib-ng builds and runs, though zlib-ng _could_ change internally - # and not use all optimizations available to the CI runner, we do this here - # just for x86_64-unknown-linux-gnu to validate a common target compiles - # on a more recent compiler than the incredibly ancient one currently used by cross - run: | - cargo test --target $TARGET_TRIPLE --no-default-features --features zlib-ng-no-cmake-experimental-community-maintained || echo "::warning::failed to build libz-ng with --features zlib-ng-no-cmake-experimental-community-maintained" - cargo run --target $TARGET_TRIPLE --manifest-path systest/Cargo.toml --no-default-features --features zlib-ng-no-cmake-experimental-community-maintained || echo "::warning::failed to run systest with --features zlib-ng-no-cmake-experimental-community-maintained" + cargo package --all-features + cargo package --no-default-features --features zlib-ng-no-cmake-experimental-community-maintained + cargo package --no-default-features --features zlib-ng linux: runs-on: ubuntu-latest From 9c2bf78435dbd2bd0fc1b3fb7122f7abc4302c6c Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Fri, 17 May 2024 17:37:55 +0200 Subject: [PATCH 05/10] Fix packaging issues --- Cargo.toml | 17 ++++++++++++++++- zng/cc.rs | 12 +++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 548be2ce..f387648a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,21 @@ include = [ "src/*.c", "src/zlib/*.[ch]", "src/zlib/*.pc.in", + # zlib-ng + "src/zlib-ng/**.[ch]", + "src/zlib-ng/arch/arm/**.[ch]", + "src/zlib-ng/arch/generic/**.[ch]", + "src/zlib-ng/arch/power/**.[ch]", + "src/zlib-ng/arch/riscv/**.[ch]", + "src/zlib-ng/arch/s390x/**.[ch]", + "src/zlib-ng/arch/x86/**.[ch]", + "src/zlib-ng/*.[ch].in", + "src/zlib-ng/*.pc.in", + "src/zlib-ng/zlib_name_mangling.h.empty", + # zlib-ng cmake + "src/zlib-ng/CMakeLists.txt", + "src/zlib-ng/zlib.pc.cmakein", + "src/zlib-ng/cmake", ] [workspace] @@ -39,7 +54,7 @@ libc = { version = "0.2.43", optional = true } [build-dependencies] pkg-config = "0.3.9" -cc = "1.0.18" +cc = "1.0.97" cmake = { version = "0.1.50", optional = true } vcpkg = "0.2" diff --git a/zng/cc.rs b/zng/cc.rs index 3fe5a5ee..0bbac907 100644 --- a/zng/cc.rs +++ b/zng/cc.rs @@ -11,7 +11,17 @@ struct Build { impl Build { fn new(cfg: cc::Build) -> Self { - let is_msvc = cfg.get_compiler().is_like_msvc(); + // cc currently has a bug where they create a named temp file in a directory + // without ensuring the directory exists first, so apply this workaround + // until it can be fixed upstream + let mut pb = PathBuf::from(env::var_os("OUT_DIR").expect("this should always be set")); + pb.push("lib"); + if let Err(err) = std::fs::create_dir_all(&pb) { + panic!("failed to create {:?}: {}", pb, err); + } + + let is_msvc = cfg.try_get_compiler().unwrap().is_like_msvc(); + Self { cfg, is_msvc } } From 530b1a58fba27734a1fcbf6d5c7338b7c68e2ee8 Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Sat, 18 May 2024 11:15:05 +0200 Subject: [PATCH 06/10] Note PR Co-authored-by: Sebastian Thiel --- zng/cc.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/zng/cc.rs b/zng/cc.rs index 0bbac907..5d523c0e 100644 --- a/zng/cc.rs +++ b/zng/cc.rs @@ -14,6 +14,7 @@ impl Build { // cc currently has a bug where they create a named temp file in a directory // without ensuring the directory exists first, so apply this workaround // until it can be fixed upstream + // Can be removed once https://github.com/rust-lang/cc-rs/pull/1072 is merged and released. let mut pb = PathBuf::from(env::var_os("OUT_DIR").expect("this should always be set")); pb.push("lib"); if let Err(err) = std::fs::create_dir_all(&pb) { From 85afe16030e32c4944a5beae6d4c79e9ad62fefa Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Sun, 19 May 2024 10:02:43 +0200 Subject: [PATCH 07/10] Try force disabling lld on nightly --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d057dae..08c4510e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,7 +126,11 @@ jobs: path: /tmp/ - run: chmod +x /tmp/cross - run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }} - - run: ci/test.bash /tmp/cross ${{ matrix.target }} + - run: | + if [ "${{ matrix.channel }}" == "nightly"]; then + export RUSTFLAGS='-Z linker-features=-lld' + fi + ci/test.bash /tmp/cross ${{ matrix.target }} strategy: fail-fast: false From 3e1c547f98fcb99db76686ee89afa600e1cbf9cc Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Sun, 19 May 2024 16:39:41 +0200 Subject: [PATCH 08/10] Oops --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08c4510e..d3b81604 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,7 +127,7 @@ jobs: - run: chmod +x /tmp/cross - run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }} - run: | - if [ "${{ matrix.channel }}" == "nightly"]; then + if [ "${{ matrix.channel }}" == "nightly" ]; then export RUSTFLAGS='-Z linker-features=-lld' fi ci/test.bash /tmp/cross ${{ matrix.target }} From 3ffe600d3459586df9fc3ead14371aa65cc18d66 Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Tue, 21 May 2024 16:11:08 +0200 Subject: [PATCH 09/10] maybe this works --- .github/workflows/ci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3b81604..5618a7ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -125,12 +125,10 @@ jobs: name: cross-linux-musl path: /tmp/ - run: chmod +x /tmp/cross + - run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zlinker-features=-lld >> $GITHUB_ENV + if: matrix.channel == 'nightly' - run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }} - - run: | - if [ "${{ matrix.channel }}" == "nightly" ]; then - export RUSTFLAGS='-Z linker-features=-lld' - fi - ci/test.bash /tmp/cross ${{ matrix.target }} + - run: ci/test.bash /tmp/cross ${{ matrix.target }} strategy: fail-fast: false From e3d7095e28473c2215370a176bc4e131693eb0c1 Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Fri, 24 May 2024 16:08:42 +0200 Subject: [PATCH 10/10] Use updated cc --- Cargo.toml | 2 +- zng/cc.rs | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f387648a..441f3a1b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,7 +54,7 @@ libc = { version = "0.2.43", optional = true } [build-dependencies] pkg-config = "0.3.9" -cc = "1.0.97" +cc = "1.0.98" cmake = { version = "0.1.50", optional = true } vcpkg = "0.2" diff --git a/zng/cc.rs b/zng/cc.rs index 5d523c0e..10ec3e65 100644 --- a/zng/cc.rs +++ b/zng/cc.rs @@ -11,18 +11,7 @@ struct Build { impl Build { fn new(cfg: cc::Build) -> Self { - // cc currently has a bug where they create a named temp file in a directory - // without ensuring the directory exists first, so apply this workaround - // until it can be fixed upstream - // Can be removed once https://github.com/rust-lang/cc-rs/pull/1072 is merged and released. - let mut pb = PathBuf::from(env::var_os("OUT_DIR").expect("this should always be set")); - pb.push("lib"); - if let Err(err) = std::fs::create_dir_all(&pb) { - panic!("failed to create {:?}: {}", pb, err); - } - let is_msvc = cfg.try_get_compiler().unwrap().is_like_msvc(); - Self { cfg, is_msvc } }