diff -Nru rust-libz-sys-1.1.2/build.rs rust-libz-sys-1.1.8/build.rs --- rust-libz-sys-1.1.2/build.rs 2020-09-03 23:01:45.000000000 +0000 +++ rust-libz-sys-1.1.8/build.rs 1973-11-29 21:33:09.000000000 +0000 @@ -1,8 +1,3 @@ -extern crate cc; -extern crate pkg_config; -#[cfg(target_env = "msvc")] -extern crate vcpkg; - use std::env; use std::fs; use std::path::PathBuf; @@ -19,7 +14,7 @@ let want_ng = cfg!(feature = "zlib-ng") && !cfg!(feature = "stock-zlib"); if want_ng && target != "wasm32-unknown-unknown" { - return build_zlib_ng(&target); + return build_zlib_ng(&target, true); } // Don't run pkg-config if we're linking statically (we'll build below) and @@ -41,8 +36,11 @@ .cargo_metadata(true) .print_system_libs(false) .probe("zlib"); - if zlib.is_ok() { - return; + match zlib { + Ok(_) => return, + Err(e) => { + println!("cargo-warning={}", e.to_string()) + } } } @@ -53,8 +51,9 @@ } // All android compilers should come with libz by default, so let's just use - // the one already there. - if target.contains("android") { + // the one already there. Likewise, Haiku always ships with libz, so we can + // link to it even when cross-compiling. + if target.contains("android") || target.contains("haiku") { println!("cargo:rustc-link-lib=z"); return; } @@ -64,13 +63,17 @@ // Situations where we build unconditionally. // // MSVC basically never has it preinstalled, MinGW picks up a bunch of weird - // paths we don't like, `want_static` may force us, cross compiling almost - // never has a prebuilt version, and musl is almost always static. + // paths we don't like, `want_static` may force us, and cross compiling almost + // never has a prebuilt version. + // + // Apple platforms have libz.1.dylib, and it's usually available even when + // cross compiling (via fat binary or in the target's Xcode SDK) + let cross_compiling = target != host; + let apple_to_apple = host.contains("-apple-") && target.contains("-apple-"); if target.contains("msvc") || target.contains("pc-windows-gnu") || want_static - || target != host - || target.contains("musl") + || (cross_compiling && !apple_to_apple) { return build_zlib(&mut cfg, &target); } @@ -91,9 +94,9 @@ fn build_zlib(cfg: &mut cc::Build, target: &str) { let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap()); - let build = dst.join("build"); + let lib = dst.join("lib"); - cfg.warnings(false).out_dir(&build).include("src/zlib"); + cfg.warnings(false).out_dir(&lib).include("src/zlib"); cfg.file("src/zlib/adler32.c") .file("src/zlib/compress.c") @@ -107,7 +110,7 @@ .file("src/zlib/uncompr.c") .file("src/zlib/zutil.c"); - if !cfg!(feature = "libc") || target == "wasm32-unknown-unknown" { + if !cfg!(feature = "libc") || target.starts_with("wasm32") { cfg.define("Z_SOLO", None); } else { cfg.file("src/zlib/gzclose.c") @@ -131,13 +134,13 @@ cfg.compile("z"); - fs::create_dir_all(dst.join("lib/pkgconfig")).unwrap(); fs::create_dir_all(dst.join("include")).unwrap(); fs::copy("src/zlib/zlib.h", dst.join("include/zlib.h")).unwrap(); fs::copy("src/zlib/zconf.h", dst.join("include/zconf.h")).unwrap(); + fs::create_dir_all(lib.join("pkgconfig")).unwrap(); fs::write( - dst.join("lib/pkgconfig/zlib.pc"), + lib.join("pkgconfig/zlib.pc"), fs::read_to_string("src/zlib/zlib.pc.in") .unwrap() .replace("@prefix@", dst.to_str().unwrap()), @@ -145,38 +148,17 @@ .unwrap(); println!("cargo:root={}", dst.to_str().unwrap()); + println!("cargo:rustc-link-search=native={}", lib.to_str().unwrap()); println!("cargo:include={}/include", dst.to_str().unwrap()); } #[cfg(not(feature = "zlib-ng"))] -fn build_zlib_ng(_target: &str) {} +fn build_zlib_ng(_target: &str, _compat: bool) {} #[cfg(feature = "zlib-ng")] -fn build_zlib_ng(target: &str) { - let install_dir = cmake::Config::new("src/zlib-ng") - .define("BUILD_SHARED_LIBS", "OFF") - .define("ZLIB_COMPAT", "ON") - .define("WITH_GZFILEOP", "ON") - .build(); - let includedir = install_dir.join("include"); - let libdir = install_dir.join("lib"); - println!( - "cargo:rustc-link-search=native={}", - libdir.to_str().unwrap() - ); - let libname = if target.contains("windows") { - if target.contains("msvc") && env::var("OPT_LEVEL").unwrap() == "0" { - "zlibd" - } else { - "zlib" - } - } else { - "z" - }; - println!("cargo:rustc-link-lib=static={}", libname); - println!("cargo:root={}", install_dir.to_str().unwrap()); - println!("cargo:include={}", includedir.to_str().unwrap()); -} +mod build_zng; +#[cfg(feature = "zlib-ng")] +use build_zng::build_zlib_ng; #[cfg(not(target_env = "msvc"))] fn try_vcpkg() -> bool { diff -Nru rust-libz-sys-1.1.2/build_zng.rs rust-libz-sys-1.1.8/build_zng.rs --- rust-libz-sys-1.1.2/build_zng.rs 1970-01-01 00:00:00.000000000 +0000 +++ rust-libz-sys-1.1.8/build_zng.rs 1973-11-29 21:33:09.000000000 +0000 @@ -0,0 +1,55 @@ +use std::env; + +pub fn build_zlib_ng(target: &str, compat: bool) { + let mut cmake = cmake::Config::new("src/zlib-ng"); + cmake + .define("BUILD_SHARED_LIBS", "OFF") + .define("ZLIB_COMPAT", if compat { "ON" } else { "OFF" }) + .define("ZLIB_ENABLE_TESTS", "OFF") + .define("WITH_GZFILEOP", "ON"); + if target.contains("s390x") { + // Enable hardware compression on s390x. + cmake + .define("WITH_DFLTCC_DEFLATE", "1") + .define("WITH_DFLTCC_INFLATE", "1") + .cflag("-DDFLTCC_LEVEL_MASK=0x7e"); + } + if target == "i686-pc-windows-msvc" { + cmake.define("CMAKE_GENERATOR_PLATFORM", "Win32"); + } + + let install_dir = cmake.build(); + + let includedir = install_dir.join("include"); + let libdir = install_dir.join("lib"); + println!( + "cargo:rustc-link-search=native={}", + libdir.to_str().unwrap() + ); + let mut debug_suffix = ""; + let libname = if target.contains("windows") && target.contains("msvc") { + if env::var("OPT_LEVEL").unwrap() == "0" { + debug_suffix = "d"; + } + "zlibstatic" + } else { + "z" + }; + println!( + "cargo:rustc-link-lib=static={}{}{}", + libname, + if compat { "" } else { "-ng" }, + debug_suffix, + ); + println!("cargo:root={}", install_dir.to_str().unwrap()); + println!("cargo:include={}", includedir.to_str().unwrap()); + if !compat { + println!("cargo:rustc-cfg=zng"); + } +} + +#[allow(dead_code)] +fn main() { + let target = env::var("TARGET").unwrap(); + build_zlib_ng(&target, false); +} diff -Nru rust-libz-sys-1.1.2/Cargo.toml rust-libz-sys-1.1.8/Cargo.toml --- rust-libz-sys-1.1.2/Cargo.toml 2020-09-04 03:51:53.000000000 +0000 +++ rust-libz-sys-1.1.8/Cargo.toml 1970-01-01 00:00:01.000000000 +0000 @@ -3,28 +3,45 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies +# to registry (e.g., crates.io) dependencies. # -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. [package] +edition = "2018" name = "libz-sys" -version = "1.1.2" -authors = ["Alex Crichton ", "Josh Triplett "] -build = "build.rs" +version = "1.1.8" +authors = [ + "Alex Crichton ", + "Josh Triplett ", +] links = "z" -description = "Low-level bindings to the system libz library (also known as zlib).\n" -documentation = "https://docs.rs/libz-sys" -keywords = ["zlib", "zlib-ng"] -categories = ["compression", "external-ffi-bindings"] +exclude = [ + "/.github", + "/.gitmodules", + "/Cargo-zng.toml", + "/cargo-zng", + "/ci", + "/systest", +] +description = "Low-level bindings to the system libz library (also known as zlib)." +keywords = [ + "zlib", + "zlib-ng", +] +categories = [ + "compression", + "external-ffi-bindings", +] license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/libz-sys" + [dependencies.libc] version = "0.2.43" optional = true + [build-dependencies.cc] version = "1.0.18" @@ -37,9 +54,16 @@ [features] asm = [] -default = ["libc", "stock-zlib"] +default = [ + "libc", + "stock-zlib", +] static = [] stock-zlib = [] -zlib-ng = ["libc", "cmake"] +zlib-ng = [ + "libc", + "cmake", +] + [target."cfg(target_env = \"msvc\")".build-dependencies.vcpkg] version = "0.2" diff -Nru rust-libz-sys-1.1.2/Cargo.toml.orig rust-libz-sys-1.1.8/Cargo.toml.orig --- rust-libz-sys-1.1.2/Cargo.toml.orig 2020-09-04 03:49:56.000000000 +0000 +++ rust-libz-sys-1.1.8/Cargo.toml.orig 1973-11-29 21:33:09.000000000 +0000 @@ -1,17 +1,23 @@ [package] name = "libz-sys" -version = "1.1.2" +version = "1.1.8" authors = ["Alex Crichton ", "Josh Triplett "] links = "z" -build = "build.rs" license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/libz-sys" -documentation = "https://docs.rs/libz-sys" -description = """ -Low-level bindings to the system libz library (also known as zlib). -""" +description = "Low-level bindings to the system libz library (also known as zlib)." categories = ["compression", "external-ffi-bindings"] keywords = ["zlib", "zlib-ng"] +edition = "2018" + +exclude = [ + "/.github", + "/.gitmodules", + "/Cargo-zng.toml", + "/cargo-zng", + "/ci", + "/systest" +] [workspace] members = ["systest"] diff -Nru rust-libz-sys-1.1.2/.cargo_vcs_info.json rust-libz-sys-1.1.8/.cargo_vcs_info.json --- rust-libz-sys-1.1.2/.cargo_vcs_info.json 2020-09-04 03:51:53.000000000 +0000 +++ rust-libz-sys-1.1.8/.cargo_vcs_info.json 1970-01-01 00:00:01.000000000 +0000 @@ -1,5 +1,6 @@ { "git": { - "sha1": "36b3071331d9a87712c9d23fd7aea79208425c73" - } -} + "sha1": "b4d8564f38ac5dc928da5e6325ef3f4dd9cfd519" + }, + "path_in_vcs": "" +} \ No newline at end of file diff -Nru rust-libz-sys-1.1.2/ci/Dockerfile rust-libz-sys-1.1.8/ci/Dockerfile --- rust-libz-sys-1.1.2/ci/Dockerfile 2020-08-14 22:06:33.000000000 +0000 +++ rust-libz-sys-1.1.8/ci/Dockerfile 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -FROM ubuntu:18.04 - -RUN apt-get update -y && apt-get install -y --no-install-recommends \ - gcc \ - libc6-dev \ - ca-certificates - diff -Nru rust-libz-sys-1.1.2/ci/run-docker.sh rust-libz-sys-1.1.8/ci/run-docker.sh --- rust-libz-sys-1.1.2/ci/run-docker.sh 2020-08-14 22:18:07.000000000 +0000 +++ rust-libz-sys-1.1.8/ci/run-docker.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -#!/bin/sh -set -ex - -mkdir -p target - -docker build --rm -t libz-sys-ci ci -docker run \ - --rm \ - --init \ - --user $(id -u):$(id -g) \ - --volume `rustc --print sysroot`:/usr/local:ro \ - --volume `pwd`:/src:ro \ - --volume `pwd`/target:/src/target \ - --workdir /src \ - --env CARGO_HOME=/cargo \ - --volume $HOME/.cargo:/cargo \ - -it \ - libz-sys-ci \ - cargo run --manifest-path systest/Cargo.toml -vv diff -Nru rust-libz-sys-1.1.2/ci/set_rust_version.bash rust-libz-sys-1.1.8/ci/set_rust_version.bash --- rust-libz-sys-1.1.2/ci/set_rust_version.bash 2020-08-18 03:56:47.000000000 +0000 +++ rust-libz-sys-1.1.8/ci/set_rust_version.bash 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -set -e -rustup default $1 -rustup target add $2 diff -Nru rust-libz-sys-1.1.2/ci/test.bash rust-libz-sys-1.1.8/ci/test.bash --- rust-libz-sys-1.1.2/ci/test.bash 2020-08-18 03:56:47.000000000 +0000 +++ rust-libz-sys-1.1.8/ci/test.bash 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -#!/usr/bin/env bash -# Script for building your rust projects. -set -e - -required_arg() { - if [ -z "$1" ]; then - echo "Required argument $2 missing" - exit 1 - fi -} - -# $1 {path} = Path to cross/cargo executable -CROSS=$1 -# $2 {string} = -TARGET_TRIPLE=$2 - -required_arg $CROSS 'CROSS' -required_arg $TARGET_TRIPLE '' - -if [ "${TARGET_TRIPLE%-windows-gnu}" != "$TARGET_TRIPLE" ]; then - # On windows-gnu targets, we need to set the PATH to include MinGW - if [ "${TARGET_TRIPLE#x86_64-}" != "$TARGET_TRIPLE" ]; then - PATH=/c/msys64/mingw64/bin:/c/msys64/usr/bin:$PATH - elif [ "${TARGET_TRIPLE#i?86-}" != "$TARGET_TRIPLE" ]; then - PATH=/c/msys64/mingw32/bin:/c/msys64/usr/bin:$PATH - else - echo Unknown windows-gnu target - exit 1 - fi -fi - -$CROSS test --target $TARGET_TRIPLE -$CROSS run --target $TARGET_TRIPLE --manifest-path systest/Cargo.toml -echo === zlib-ng build === -$CROSS test --target $TARGET_TRIPLE --no-default-features --features zlib-ng -$CROSS run --target $TARGET_TRIPLE --manifest-path systest/Cargo.toml --no-default-features --features zlib-ng diff -Nru rust-libz-sys-1.1.2/debian/cargo-checksum.json rust-libz-sys-1.1.8/debian/cargo-checksum.json --- rust-libz-sys-1.1.2/debian/cargo-checksum.json 2020-12-10 18:01:47.000000000 +0000 +++ rust-libz-sys-1.1.8/debian/cargo-checksum.json 2022-10-18 15:59:08.000000000 +0000 @@ -1 +1 @@ -{"package":"602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655","files":{}} +{"package":"Could not get crate checksum","files":{}} diff -Nru rust-libz-sys-1.1.2/debian/changelog rust-libz-sys-1.1.8/debian/changelog --- rust-libz-sys-1.1.2/debian/changelog 2020-12-10 18:01:47.000000000 +0000 +++ rust-libz-sys-1.1.8/debian/changelog 2022-10-18 15:59:08.000000000 +0000 @@ -1,3 +1,19 @@ +rust-libz-sys (1.1.8-2) unstable; urgency=medium + + * Team upload. + * Package libz-sys 1.1.8 from crates.io using debcargo 2.5.0 + * Upload to unstable. + + -- Peter Michael Green Tue, 18 Oct 2022 15:59:08 +0000 + +rust-libz-sys (1.1.8-1) experimental; urgency=medium + + * Team upload. + * Package libz-sys 1.1.8 from crates.io using debcargo 2.5.0 + * Closes: #972361 - zlib-ng dependency and feature dropped + + -- Fabian Gruenbichler Tue, 27 Sep 2022 20:32:33 -0400 + rust-libz-sys (1.1.2-3) unstable; urgency=medium * Team upload. diff -Nru rust-libz-sys-1.1.2/debian/compat rust-libz-sys-1.1.8/debian/compat --- rust-libz-sys-1.1.2/debian/compat 2020-12-10 18:01:47.000000000 +0000 +++ rust-libz-sys-1.1.8/debian/compat 2022-10-18 15:59:08.000000000 +0000 @@ -1 +1 @@ -11 +12 diff -Nru rust-libz-sys-1.1.2/debian/control rust-libz-sys-1.1.8/debian/control --- rust-libz-sys-1.1.2/debian/control 2020-12-10 18:01:47.000000000 +0000 +++ rust-libz-sys-1.1.8/debian/control 2022-10-18 15:59:08.000000000 +0000 @@ -1,12 +1,11 @@ Source: rust-libz-sys Section: rust Priority: optional -Build-Depends: debhelper (>= 11), - dh-cargo (>= 18), +Build-Depends: debhelper (>= 12), + dh-cargo (>= 25), cargo:native , rustc:native , libstd-rust-dev , - librust-cc-1+default-dev (>= 1.0.18-~~) , librust-libc-0.2+default-dev (>= 0.2.43-~~) , librust-pkg-config-0.3+default-dev (>= 0.3.9-~~) , librust-vcpkg-0.2+default-dev , @@ -15,72 +14,51 @@ Maintainer: Debian Rust Maintainers Uploaders: Ximin Luo -Standards-Version: 4.4.1 +Standards-Version: 4.5.1 Vcs-Git: https://salsa.debian.org/rust-team/debcargo-conf.git [src/libz-sys] Vcs-Browser: https://salsa.debian.org/rust-team/debcargo-conf/tree/master/src/libz-sys +Rules-Requires-Root: no Package: librust-libz-sys-dev Architecture: any Multi-Arch: same Depends: ${misc:Depends}, - librust-cc-1+default-dev (>= 1.0.18-~~), librust-pkg-config-0.3+default-dev (>= 0.3.9-~~), librust-vcpkg-0.2+default-dev, zlib1g-dev Recommends: librust-libz-sys+default-dev (= ${binary:Version}) Suggests: - librust-libz-sys+cmake-dev (= ${binary:Version}), - librust-libz-sys+libc-dev (= ${binary:Version}), - librust-libz-sys+zlib-ng-dev (= ${binary:Version}) + librust-libz-sys+libc-dev (= ${binary:Version}) Provides: librust-libz-sys+asm-dev (= ${binary:Version}), - librust-libz-sys+static-dev (= ${binary:Version}), librust-libz-sys+stock-zlib-dev (= ${binary:Version}), librust-libz-sys-1-dev (= ${binary:Version}), librust-libz-sys-1+asm-dev (= ${binary:Version}), - librust-libz-sys-1+static-dev (= ${binary:Version}), librust-libz-sys-1+stock-zlib-dev (= ${binary:Version}), librust-libz-sys-1.1-dev (= ${binary:Version}), librust-libz-sys-1.1+asm-dev (= ${binary:Version}), - librust-libz-sys-1.1+static-dev (= ${binary:Version}), librust-libz-sys-1.1+stock-zlib-dev (= ${binary:Version}), - librust-libz-sys-1.1.2-dev (= ${binary:Version}), - librust-libz-sys-1.1.2+asm-dev (= ${binary:Version}), - librust-libz-sys-1.1.2+static-dev (= ${binary:Version}), - librust-libz-sys-1.1.2+stock-zlib-dev (= ${binary:Version}) + librust-libz-sys-1.1.8-dev (= ${binary:Version}), + librust-libz-sys-1.1.8+asm-dev (= ${binary:Version}), + librust-libz-sys-1.1.8+stock-zlib-dev (= ${binary:Version}) Description: Low-level bindings to the system libz library (also known as zlib) - Rust source code This package contains the source for the Rust libz-sys crate, packaged by debcargo for use with cargo and dh-cargo. -Package: librust-libz-sys+cmake-dev -Architecture: any -Multi-Arch: same -Depends: - ${misc:Depends}, - librust-libz-sys-dev (= ${binary:Version}), - librust-cmake-0.1+default-dev (>= 0.1.44-~~) -Provides: - librust-libz-sys-1+cmake-dev (= ${binary:Version}), - librust-libz-sys-1.1+cmake-dev (= ${binary:Version}), - librust-libz-sys-1.1.2+cmake-dev (= ${binary:Version}) -Description: Low-level bindings to the system libz library (also known as zlib) - feature "cmake" - This metapackage enables feature "cmake" for the Rust libz-sys crate, by - pulling in any additional dependencies needed by that feature. - Package: librust-libz-sys+default-dev Architecture: any Multi-Arch: same Depends: ${misc:Depends}, librust-libz-sys-dev (= ${binary:Version}), - librust-libz-sys+stock-zlib-dev (= ${binary:Version}), - librust-libc-0.2+default-dev (>= 0.2.43-~~) + librust-libz-sys+libc-dev (= ${binary:Version}), + librust-libz-sys+stock-zlib-dev (= ${binary:Version}) Provides: librust-libz-sys-1+default-dev (= ${binary:Version}), librust-libz-sys-1.1+default-dev (= ${binary:Version}), - librust-libz-sys-1.1.2+default-dev (= ${binary:Version}) + librust-libz-sys-1.1.8+default-dev (= ${binary:Version}) Description: Low-level bindings to the system libz library (also known as zlib) - feature "default" This metapackage enables feature "default" for the Rust libz-sys crate, by pulling in any additional dependencies needed by that feature. @@ -95,23 +73,7 @@ Provides: librust-libz-sys-1+libc-dev (= ${binary:Version}), librust-libz-sys-1.1+libc-dev (= ${binary:Version}), - librust-libz-sys-1.1.2+libc-dev (= ${binary:Version}) + librust-libz-sys-1.1.8+libc-dev (= ${binary:Version}) Description: Low-level bindings to the system libz library (also known as zlib) - feature "libc" This metapackage enables feature "libc" for the Rust libz-sys crate, by pulling in any additional dependencies needed by that feature. - -Package: librust-libz-sys+zlib-ng-dev -Architecture: any -Multi-Arch: same -Depends: - ${misc:Depends}, - librust-libz-sys-dev (= ${binary:Version}), - librust-cmake-0.1+default-dev (>= 0.1.44-~~), - librust-libc-0.2+default-dev (>= 0.2.43-~~) -Provides: - librust-libz-sys-1+zlib-ng-dev (= ${binary:Version}), - librust-libz-sys-1.1+zlib-ng-dev (= ${binary:Version}), - librust-libz-sys-1.1.2+zlib-ng-dev (= ${binary:Version}) -Description: Low-level bindings to the system libz library (also known as zlib) - feature "zlib-ng" - This metapackage enables feature "zlib-ng" for the Rust libz-sys crate, by - pulling in any additional dependencies needed by that feature. diff -Nru rust-libz-sys-1.1.2/debian/copyright.debcargo.hint rust-libz-sys-1.1.8/debian/copyright.debcargo.hint --- rust-libz-sys-1.1.2/debian/copyright.debcargo.hint 2020-12-10 18:01:47.000000000 +0000 +++ rust-libz-sys-1.1.8/debian/copyright.debcargo.hint 2022-10-18 15:59:08.000000000 +0000 @@ -27,8 +27,8 @@ Files: debian/* Copyright: - 2018-2020 Debian Rust Maintainers - 2018-2020 Ximin Luo + 2018-2022 Debian Rust Maintainers + 2018-2022 Ximin Luo License: MIT or Apache-2.0 License: Apache-2.0 diff -Nru rust-libz-sys-1.1.2/debian/librust-libz-sys+default-dev.lintian-overrides rust-libz-sys-1.1.8/debian/librust-libz-sys+default-dev.lintian-overrides --- rust-libz-sys-1.1.2/debian/librust-libz-sys+default-dev.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ rust-libz-sys-1.1.8/debian/librust-libz-sys+default-dev.lintian-overrides 2022-10-18 15:59:08.000000000 +0000 @@ -0,0 +1 @@ +librust-libz-sys+default-dev binary: empty-rust-library-declares-provides * \ No newline at end of file diff -Nru rust-libz-sys-1.1.2/debian/librust-libz-sys+libc-dev.lintian-overrides rust-libz-sys-1.1.8/debian/librust-libz-sys+libc-dev.lintian-overrides --- rust-libz-sys-1.1.2/debian/librust-libz-sys+libc-dev.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ rust-libz-sys-1.1.8/debian/librust-libz-sys+libc-dev.lintian-overrides 2022-10-18 15:59:08.000000000 +0000 @@ -0,0 +1 @@ +librust-libz-sys+libc-dev binary: empty-rust-library-declares-provides * \ No newline at end of file diff -Nru rust-libz-sys-1.1.2/debian/patches/disable-zlib-ng.patch rust-libz-sys-1.1.8/debian/patches/disable-zlib-ng.patch --- rust-libz-sys-1.1.2/debian/patches/disable-zlib-ng.patch 1970-01-01 00:00:00.000000000 +0000 +++ rust-libz-sys-1.1.8/debian/patches/disable-zlib-ng.patch 2022-10-18 15:59:08.000000000 +0000 @@ -0,0 +1,32 @@ +Index: libz-sys/Cargo.toml +=================================================================== +--- libz-sys.orig/Cargo.toml ++++ libz-sys/Cargo.toml +@@ -60,10 +60,6 @@ default = [ + ] + static = [] + stock-zlib = [] +-zlib-ng = [ +- "libc", +- "cmake", +-] + + [target."cfg(target_env = \"msvc\")".build-dependencies.vcpkg] + version = "0.2" +Index: libz-sys/build.rs +=================================================================== +--- libz-sys.orig/build.rs ++++ libz-sys/build.rs +@@ -11,12 +11,6 @@ fn main() { + + let host_and_target_contain = |s| host.contains(s) && target.contains(s); + +- let want_ng = cfg!(feature = "zlib-ng") && !cfg!(feature = "stock-zlib"); +- +- if want_ng && target != "wasm32-unknown-unknown" { +- return build_zlib_ng(&target, true); +- } +- + // Don't run pkg-config if we're linking statically (we'll build below) and + // also don't run pkg-config on macOS/FreeBSD/DragonFly. That'll end up printing + // `-L /usr/lib` which wreaks havoc with linking to an OpenSSL in /usr/local/lib diff -Nru rust-libz-sys-1.1.2/debian/patches/remove-static.patch rust-libz-sys-1.1.8/debian/patches/remove-static.patch --- rust-libz-sys-1.1.2/debian/patches/remove-static.patch 1970-01-01 00:00:00.000000000 +0000 +++ rust-libz-sys-1.1.8/debian/patches/remove-static.patch 2022-10-18 15:59:08.000000000 +0000 @@ -0,0 +1,200 @@ +Index: libz-sys/Cargo.toml +=================================================================== +--- libz-sys.orig/Cargo.toml ++++ libz-sys/Cargo.toml +@@ -42,13 +42,6 @@ repository = "https://github.com/rust-la + version = "0.2.43" + optional = true + +-[build-dependencies.cc] +-version = "1.0.18" +- +-[build-dependencies.cmake] +-version = "0.1.44" +-optional = true +- + [build-dependencies.pkg-config] + version = "0.3.9" + +@@ -58,7 +51,6 @@ default = [ + "libc", + "stock-zlib", + ] +-static = [] + stock-zlib = [] + + [target."cfg(target_env = \"msvc\")".build-dependencies.vcpkg] +Index: libz-sys/build.rs +=================================================================== +--- libz-sys.orig/build.rs ++++ libz-sys/build.rs +@@ -11,12 +11,8 @@ fn main() { + + let host_and_target_contain = |s| host.contains(s) && target.contains(s); + +- // Don't run pkg-config if we're linking statically (we'll build below) and +- // also don't run pkg-config on macOS/FreeBSD/DragonFly. That'll end up printing +- // `-L /usr/lib` which wreaks havoc with linking to an OpenSSL in /usr/local/lib +- // (Homebrew, Ports, etc.) +- let want_static = +- cfg!(feature = "static") || env::var("LIBZ_SYS_STATIC").unwrap_or(String::new()) == "1"; ++ // never build static ++ let want_static = false; + if !want_static && + !target.contains("msvc") && // pkg-config just never works here + !(host_and_target_contain("apple") || +@@ -38,12 +34,6 @@ fn main() { + } + } + +- if target.contains("msvc") { +- if try_vcpkg() { +- return; +- } +- } +- + // All android compilers should come with libz by default, so let's just use + // the one already there. Likewise, Haiku always ships with libz, so we can + // link to it even when cross-compiling. +@@ -52,140 +42,5 @@ fn main() { + return; + } + +- let mut cfg = cc::Build::new(); +- +- // Situations where we build unconditionally. +- // +- // MSVC basically never has it preinstalled, MinGW picks up a bunch of weird +- // paths we don't like, `want_static` may force us, and cross compiling almost +- // never has a prebuilt version. +- // +- // Apple platforms have libz.1.dylib, and it's usually available even when +- // cross compiling (via fat binary or in the target's Xcode SDK) +- let cross_compiling = target != host; +- let apple_to_apple = host.contains("-apple-") && target.contains("-apple-"); +- if target.contains("msvc") +- || target.contains("pc-windows-gnu") +- || want_static +- || (cross_compiling && !apple_to_apple) +- { +- return build_zlib(&mut cfg, &target); +- } +- +- // If we've gotten this far we're probably a pretty standard platform. +- // Almost all platforms here ship libz by default, but some don't have +- // pkg-config files that we would find above. +- // +- // In any case test if zlib is actually installed and if so we link to it, +- // otherwise continue below to build things. +- if zlib_installed(&mut cfg) { +- println!("cargo:rustc-link-lib=z"); +- return; +- } +- +- build_zlib(&mut cfg, &target) +-} +- +-fn build_zlib(cfg: &mut cc::Build, target: &str) { +- let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap()); +- let lib = dst.join("lib"); +- +- cfg.warnings(false).out_dir(&lib).include("src/zlib"); +- +- cfg.file("src/zlib/adler32.c") +- .file("src/zlib/compress.c") +- .file("src/zlib/crc32.c") +- .file("src/zlib/deflate.c") +- .file("src/zlib/infback.c") +- .file("src/zlib/inffast.c") +- .file("src/zlib/inflate.c") +- .file("src/zlib/inftrees.c") +- .file("src/zlib/trees.c") +- .file("src/zlib/uncompr.c") +- .file("src/zlib/zutil.c"); +- +- if !cfg!(feature = "libc") || target.starts_with("wasm32") { +- cfg.define("Z_SOLO", None); +- } else { +- cfg.file("src/zlib/gzclose.c") +- .file("src/zlib/gzlib.c") +- .file("src/zlib/gzread.c") +- .file("src/zlib/gzwrite.c"); +- } +- +- if !target.contains("windows") { +- cfg.define("STDC", None); +- cfg.define("_LARGEFILE64_SOURCE", None); +- cfg.define("_POSIX_SOURCE", None); +- cfg.flag("-fvisibility=hidden"); +- } +- if target.contains("apple") { +- cfg.define("_C99_SOURCE", None); +- } +- if target.contains("solaris") { +- cfg.define("_XOPEN_SOURCE", "700"); +- } +- +- cfg.compile("z"); +- +- fs::create_dir_all(dst.join("include")).unwrap(); +- fs::copy("src/zlib/zlib.h", dst.join("include/zlib.h")).unwrap(); +- fs::copy("src/zlib/zconf.h", dst.join("include/zconf.h")).unwrap(); +- +- fs::create_dir_all(lib.join("pkgconfig")).unwrap(); +- fs::write( +- lib.join("pkgconfig/zlib.pc"), +- fs::read_to_string("src/zlib/zlib.pc.in") +- .unwrap() +- .replace("@prefix@", dst.to_str().unwrap()), +- ) +- .unwrap(); +- +- println!("cargo:root={}", dst.to_str().unwrap()); +- println!("cargo:rustc-link-search=native={}", lib.to_str().unwrap()); +- println!("cargo:include={}/include", dst.to_str().unwrap()); +-} +- +-#[cfg(not(feature = "zlib-ng"))] +-fn build_zlib_ng(_target: &str, _compat: bool) {} +- +-#[cfg(feature = "zlib-ng")] +-mod build_zng; +-#[cfg(feature = "zlib-ng")] +-use build_zng::build_zlib_ng; +- +-#[cfg(not(target_env = "msvc"))] +-fn try_vcpkg() -> bool { +- false +-} +- +-#[cfg(target_env = "msvc")] +-fn try_vcpkg() -> bool { +- // see if there is a vcpkg tree with zlib installed +- match vcpkg::Config::new() +- .emit_includes(true) +- .lib_names("zlib", "zlib1") +- .probe("zlib") +- { +- Ok(_) => true, +- Err(e) => { +- println!("note, vcpkg did not find zlib: {}", e); +- false +- } +- } +-} +- +-fn zlib_installed(cfg: &mut cc::Build) -> bool { +- let compiler = cfg.get_compiler(); +- let mut cmd = Command::new(compiler.path()); +- cmd.arg("src/smoke.c").arg("-o").arg("/dev/null").arg("-lz"); +- +- println!("running {:?}", cmd); +- if let Ok(status) = cmd.status() { +- if status.success() { +- return true; +- } +- } +- +- false ++ panic!("librust-libz-sys only supports linking with system lib on Debian!"); + } diff -Nru rust-libz-sys-1.1.2/debian/patches/series rust-libz-sys-1.1.8/debian/patches/series --- rust-libz-sys-1.1.2/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ rust-libz-sys-1.1.8/debian/patches/series 2022-10-18 15:59:08.000000000 +0000 @@ -0,0 +1,2 @@ +disable-zlib-ng.patch +remove-static.patch diff -Nru rust-libz-sys-1.1.2/debian/tests/control rust-libz-sys-1.1.8/debian/tests/control --- rust-libz-sys-1.1.2/debian/tests/control 2020-12-10 18:01:47.000000000 +0000 +++ rust-libz-sys-1.1.8/debian/tests/control 2022-10-18 15:59:08.000000000 +0000 @@ -1,29 +1,29 @@ -Test-Command: /usr/share/cargo/bin/cargo-auto-test libz-sys 1.1.2 --all-targets --all-features -Features: test-name=@ +Test-Command: /usr/share/cargo/bin/cargo-auto-test libz-sys 1.1.8 --all-targets --all-features +Features: test-name=rust-libz-sys:@ Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable, flaky -Test-Command: /usr/share/cargo/bin/cargo-auto-test libz-sys 1.1.2 --all-targets --no-default-features -Features: test-name=librust-libz-sys-dev +Test-Command: /usr/share/cargo/bin/cargo-auto-test libz-sys 1.1.8 --all-targets --no-default-features --features asm +Features: test-name=librust-libz-sys-dev:asm Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test libz-sys 1.1.2 --all-targets --features cmake -Features: test-name=librust-libz-sys+cmake-dev +Test-Command: /usr/share/cargo/bin/cargo-auto-test libz-sys 1.1.8 --all-targets --no-default-features --features stock-zlib +Features: test-name=librust-libz-sys-dev:stock-zlib Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test libz-sys 1.1.2 --all-targets --features default -Features: test-name=librust-libz-sys+default-dev +Test-Command: /usr/share/cargo/bin/cargo-auto-test libz-sys 1.1.8 --all-targets --no-default-features +Features: test-name=librust-libz-sys-dev: Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test libz-sys 1.1.2 --all-targets --features libc -Features: test-name=librust-libz-sys+libc-dev +Test-Command: /usr/share/cargo/bin/cargo-auto-test libz-sys 1.1.8 --all-targets +Features: test-name=librust-libz-sys+default-dev:default Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test libz-sys 1.1.2 --all-targets --features zlib-ng -Features: test-name=librust-libz-sys+zlib-ng-dev +Test-Command: /usr/share/cargo/bin/cargo-auto-test libz-sys 1.1.8 --all-targets --no-default-features --features libc +Features: test-name=librust-libz-sys+libc-dev:libc Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable diff -Nru rust-libz-sys-1.1.2/.github/workflows/ci.yml rust-libz-sys-1.1.8/.github/workflows/ci.yml --- rust-libz-sys-1.1.2/.github/workflows/ci.yml 2020-08-18 03:56:47.000000000 +0000 +++ rust-libz-sys-1.1.8/.github/workflows/ci.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,112 +0,0 @@ -name: CI - -on: [push, pull_request] - -jobs: - # This job downloads and stores `cross` as an artifact, so that it can be - # redownloaded across all of the jobs. Currently this copied pasted between - # `ci.yml` and `deploy.yml`. Make sure to update both places when making - # changes. - install-cross: - runs-on: ubuntu-latest - steps: - - uses: XAMPPRocky/get-github-release@v1 - id: cross - with: - owner: rust-embedded - repo: cross - matches: ${{ matrix.platform }} - token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/upload-artifact@v2 - with: - name: cross-${{ matrix.platform }} - path: ${{ steps.cross.outputs.install_path }} - strategy: - matrix: - platform: [linux-musl] - - windows: - runs-on: windows-latest - # Windows technically doesn't need this, but if we don't block windows on it - # some of the windows jobs could fill up the concurrent job queue before - # one of the install-cross jobs has started, so this makes sure all - # artifacts are downloaded first. - needs: install-cross - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }} - shell: bash - - run: ci/test.bash cargo ${{ matrix.target }} - shell: bash - - strategy: - fail-fast: false - matrix: - channel: [stable, beta, nightly] - target: - - i686-pc-windows-msvc - - x86_64-pc-windows-msvc - - i686-pc-windows-gnu - - x86_64-pc-windows-gnu - - macos: - runs-on: macos-latest - # macOS isn't currently using this either, but see the note about Windows above. - needs: install-cross - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }} - - run: ci/test.bash cargo ${{ matrix.target }} - - strategy: - fail-fast: false - matrix: - channel: [stable, beta, nightly] - target: - - x86_64-apple-darwin - - linux: - runs-on: ubuntu-latest - needs: install-cross - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - - name: Download Cross - uses: actions/download-artifact@v1 - with: - name: cross-linux-musl - 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 }} - - strategy: - fail-fast: false - matrix: - channel: [stable, beta, nightly] - target: - - aarch64-unknown-linux-gnu - - aarch64-unknown-linux-musl - #- arm-unknown-linux-gnueabi - - arm-unknown-linux-gnueabihf - #- arm-unknown-linux-musleabi - - arm-unknown-linux-musleabihf - #- armv5te-unknown-linux-musleabi - - armv7-unknown-linux-gnueabihf - - armv7-unknown-linux-musleabihf - - i586-unknown-linux-gnu - - i586-unknown-linux-musl - - i686-unknown-linux-gnu - - i686-unknown-linux-musl - #- powerpc-unknown-linux-gnu - #- powerpc64-unknown-linux-gnu - #- powerpc64le-unknown-linux-gnu - - s390x-unknown-linux-gnu - - x86_64-unknown-linux-gnu - - x86_64-unknown-linux-musl diff -Nru rust-libz-sys-1.1.2/.gitmodules rust-libz-sys-1.1.8/.gitmodules --- rust-libz-sys-1.1.2/.gitmodules 2020-08-30 21:20:54.000000000 +0000 +++ rust-libz-sys-1.1.8/.gitmodules 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -[submodule "src/zlib"] - path = src/zlib - url = https://github.com/madler/zlib -[submodule "src/zlib-ng"] - path = src/zlib-ng - url = https://github.com/zlib-ng/zlib-ng diff -Nru rust-libz-sys-1.1.2/README.md rust-libz-sys-1.1.8/README.md --- rust-libz-sys-1.1.2/README.md 2020-08-17 00:36:27.000000000 +0000 +++ rust-libz-sys-1.1.8/README.md 1973-11-29 21:33:09.000000000 +0000 @@ -4,6 +4,10 @@ [Documentation](https://docs.rs/libz-sys) +This also serves as the source for the `libz-ng-sys` crate, which builds +zlib-ng natively (not in zlib-compat mode). See +[`README-zng.md`](README-zng.md) for details. + # High-level API This crate provides bindings to the raw low-level C API. For a higher-level diff -Nru rust-libz-sys-1.1.2/README-zng.md rust-libz-sys-1.1.8/README-zng.md --- rust-libz-sys-1.1.2/README-zng.md 1970-01-01 00:00:00.000000000 +0000 +++ rust-libz-sys-1.1.8/README-zng.md 1973-11-29 21:33:09.000000000 +0000 @@ -0,0 +1,41 @@ +# libz-ng-sys + +A library for linking zlib-ng (`libz-ng`) to Rust programs natively, rather +than in zlib-compat mode. + +zlib-ng is a high-performance implementation of zlib. zlib-ng supports building +in two modes: zlib-compat mode, in whih it provides the same API as zlib and +generally works as a drop-in replacement, and native mode, in which it provides +its own API. The native API is almost identical to the zlib-compat API, except +that some types use more correct sizes (rather than the sizes required for zlib +compatibility), and the functions all have a `zng_` prefix. The latter allows +zlib and zlib-ng to coexist in the same program. + +This crate provides bindings to the native zlib-ng API. However, for simplicity +of porting, this crate exports the same API as libz-sys (without the `zng_` +prefixes), making it easier to write Rust software compatible with both +libz-sys and libz-ng-sys. + +# High-level API + +This crate provides bindings to the raw low-level C API. For a higher-level +safe API to work with DEFLATE, zlib, or gzip streams, see +[`flate2`](https://docs.rs/flate2). `flate2` supports many different +implementations. + +# License + +This project is licensed under either of + + * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or + http://www.apache.org/licenses/LICENSE-2.0) + * MIT license ([LICENSE-MIT](LICENSE-MIT) or + http://opensource.org/licenses/MIT) + +at your option. + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate by you, as defined in the Apache-2.0 license, shall +be dual licensed as above, without any additional terms or conditions. diff -Nru rust-libz-sys-1.1.2/src/lib.rs rust-libz-sys-1.1.8/src/lib.rs --- rust-libz-sys-1.1.2/src/lib.rs 2020-08-14 22:11:37.000000000 +0000 +++ rust-libz-sys-1.1.8/src/lib.rs 1973-11-29 21:33:09.000000000 +0000 @@ -1,12 +1,33 @@ -#![doc(html_root_url = "https://docs.rs/libz-sys/1.0")] #![allow(non_camel_case_types)] use std::os::raw::{c_char, c_int, c_long, c_uchar, c_uint, c_ulong, c_void}; +// Macro for variances between zlib-ng in native mode and either zlib or zlib-ng in zlib compat +// mode. Note in particular that zlib-ng in compat mode does *not* use the zng case. +#[cfg(not(zng))] +macro_rules! if_zng { + ($_zng:tt, $not_zng:tt) => { + $not_zng + }; +} + +#[cfg(zng)] +macro_rules! if_zng { + ($zng:tt, $_not_zng:tt) => { + $zng + }; +} + +// zlib uses unsigned long for various sizes; zlib-ng uses size_t. +type z_size = if_zng!(usize, c_ulong); + +// zlib stores Adler-32 and CRC-32 checksums in unsigned long; zlib-ng uses uint32_t. +type z_checksum = if_zng!(u32, c_ulong); + pub type alloc_func = unsafe extern "C" fn(voidpf, uInt, uInt) -> voidpf; pub type Bytef = u8; pub type free_func = unsafe extern "C" fn(voidpf, voidpf); -#[cfg(feature = "libc")] +#[cfg(any(zng, feature = "libc"))] pub type gzFile = *mut gzFile_s; pub type in_func = unsafe extern "C" fn(*mut c_void, *mut *const c_uchar) -> c_uint; pub type out_func = unsafe extern "C" fn(*mut c_void, *mut c_uchar, c_uint) -> c_int; @@ -17,13 +38,27 @@ pub type voidpc = *const c_void; pub type voidpf = *mut c_void; -#[cfg(feature = "libc")] +#[cfg(any(zng, feature = "libc"))] pub enum gzFile_s {} pub enum internal_state {} -#[cfg(feature = "libc")] +#[cfg(all( + not(zng), + feature = "libc", + not(all(target_family = "wasm", target_os = "unknown")) +))] pub type z_off_t = libc::off_t; +#[cfg(all( + not(zng), + feature = "libc", + all(target_family = "wasm", target_os = "unknown") +))] +pub type z_off_t = c_long; + +#[cfg(zng)] +pub type z_off_t = i64; + #[repr(C)] #[derive(Copy, Clone)] pub struct gz_header { @@ -48,142 +83,236 @@ pub struct z_stream { pub next_in: *mut Bytef, pub avail_in: uInt, - pub total_in: uLong, + pub total_in: z_size, pub next_out: *mut Bytef, pub avail_out: uInt, - pub total_out: uLong, + pub total_out: z_size, pub msg: *mut c_char, pub state: *mut internal_state, pub zalloc: alloc_func, pub zfree: free_func, pub opaque: voidpf, pub data_type: c_int, - pub adler: uLong, + pub adler: z_checksum, pub reserved: uLong, } pub type z_streamp = *mut z_stream; +// Ideally, this should instead use a macro that parses the whole block of externs, and generates +// the appropriate link_name attributes, without duplicating the function names. However, ctest2 +// can't parse that. +#[cfg(not(zng))] +macro_rules! zng_prefix { + ($name:expr) => { stringify!($name) } +} + +#[cfg(zng)] +macro_rules! zng_prefix { + ($name:expr) => { concat!("zng_", stringify!($name)) } +} + extern "C" { - pub fn adler32(adler: uLong, buf: *const Bytef, len: uInt) -> uLong; - pub fn crc32(crc: uLong, buf: *const Bytef, len: uInt) -> uLong; + #[link_name = zng_prefix!(adler32)] + pub fn adler32(adler: z_checksum, buf: *const Bytef, len: uInt) -> z_checksum; + #[link_name = zng_prefix!(crc32)] + pub fn crc32(crc: z_checksum, buf: *const Bytef, len: uInt) -> z_checksum; + #[link_name = zng_prefix!(deflate)] pub fn deflate(strm: z_streamp, flush: c_int) -> c_int; + #[link_name = zng_prefix!(deflateBound)] pub fn deflateBound(strm: z_streamp, sourceLen: uLong) -> uLong; + #[link_name = zng_prefix!(deflateCopy)] pub fn deflateCopy(dest: z_streamp, source: z_streamp) -> c_int; + #[link_name = zng_prefix!(deflateEnd)] pub fn deflateEnd(strm: z_streamp) -> c_int; - pub fn deflateInit_(strm: z_streamp, level: c_int, - version: *const c_char, - stream_size: c_int) -> c_int; - pub fn deflateInit2_(strm: z_streamp, - level: c_int, - method: c_int, - windowBits: c_int, - memLevel: c_int, - strategy: c_int, - version: *const c_char, - stream_size: c_int) -> c_int; - pub fn deflateParams(strm: z_streamp, - level: c_int, - strategy: c_int) -> c_int; + #[link_name = zng_prefix!(deflateInit_)] + pub fn deflateInit_( + strm: z_streamp, + level: c_int, + version: *const c_char, + stream_size: c_int, + ) -> c_int; + #[link_name = zng_prefix!(deflateInit2_)] + pub fn deflateInit2_( + strm: z_streamp, + level: c_int, + method: c_int, + windowBits: c_int, + memLevel: c_int, + strategy: c_int, + version: *const c_char, + stream_size: c_int, + ) -> c_int; + #[link_name = zng_prefix!(deflateParams)] + pub fn deflateParams(strm: z_streamp, level: c_int, strategy: c_int) -> c_int; + #[link_name = zng_prefix!(deflatePrime)] pub fn deflatePrime(strm: z_streamp, bits: c_int, value: c_int) -> c_int; + #[link_name = zng_prefix!(deflateReset)] pub fn deflateReset(strm: z_streamp) -> c_int; - pub fn deflateSetDictionary(strm: z_streamp, - dictionary: *const Bytef, - dictLength: uInt) -> c_int; + #[link_name = zng_prefix!(deflateSetDictionary)] + pub fn deflateSetDictionary( + strm: z_streamp, + dictionary: *const Bytef, + dictLength: uInt, + ) -> c_int; + #[link_name = zng_prefix!(deflateSetHeader)] pub fn deflateSetHeader(strm: z_streamp, head: gz_headerp) -> c_int; - pub fn deflateTune(strm: z_streamp, - good_length: c_int, - max_lazy: c_int, - nice_length: c_int, - max_chain: c_int) -> c_int; + #[link_name = zng_prefix!(deflateTune)] + pub fn deflateTune( + strm: z_streamp, + good_length: c_int, + max_lazy: c_int, + nice_length: c_int, + max_chain: c_int, + ) -> c_int; + #[link_name = zng_prefix!(inflate)] pub fn inflate(strm: z_streamp, flush: c_int) -> c_int; - pub fn inflateBack(strm: z_streamp, - _in: in_func, - in_desc: *mut c_void, - out: out_func, - out_desc: *mut c_void) -> c_int; + #[link_name = zng_prefix!(inflateBack)] + pub fn inflateBack( + strm: z_streamp, + _in: in_func, + in_desc: *mut c_void, + out: out_func, + out_desc: *mut c_void, + ) -> c_int; + #[link_name = zng_prefix!(inflateBackEnd)] pub fn inflateBackEnd(strm: z_streamp) -> c_int; - pub fn inflateBackInit_(strm: z_streamp, - windowBits: c_int, - window: *mut c_uchar, - version: *const c_char, - stream_size: c_int) -> c_int; + #[link_name = zng_prefix!(inflateBackInit_)] + pub fn inflateBackInit_( + strm: z_streamp, + windowBits: c_int, + window: *mut c_uchar, + version: *const c_char, + stream_size: c_int, + ) -> c_int; + #[link_name = zng_prefix!(inflateCopy)] pub fn inflateCopy(dest: z_streamp, source: z_streamp) -> c_int; + #[link_name = zng_prefix!(inflateEnd)] pub fn inflateEnd(strm: z_streamp) -> c_int; + #[link_name = zng_prefix!(inflateGetHeader)] pub fn inflateGetHeader(strm: z_streamp, head: gz_headerp) -> c_int; - pub fn inflateInit_(strm: z_streamp, - version: *const c_char, - stream_size: c_int) -> c_int; - pub fn inflateInit2_(strm: z_streamp, - windowBits: c_int, - version: *const c_char, - stream_size: c_int) -> c_int; + #[link_name = zng_prefix!(inflateInit_)] + pub fn inflateInit_(strm: z_streamp, version: *const c_char, stream_size: c_int) -> c_int; + #[link_name = zng_prefix!(inflateInit2_)] + pub fn inflateInit2_( + strm: z_streamp, + windowBits: c_int, + version: *const c_char, + stream_size: c_int, + ) -> c_int; + #[link_name = zng_prefix!(inflateMark)] pub fn inflateMark(strm: z_streamp) -> c_long; + #[link_name = zng_prefix!(inflatePrime)] pub fn inflatePrime(strm: z_streamp, bits: c_int, value: c_int) -> c_int; + #[link_name = zng_prefix!(inflateReset)] pub fn inflateReset(strm: z_streamp) -> c_int; + #[link_name = zng_prefix!(inflateReset2)] pub fn inflateReset2(strm: z_streamp, windowBits: c_int) -> c_int; - pub fn inflateSetDictionary(strm: z_streamp, - dictionary: *const Bytef, - dictLength: uInt) -> c_int; + #[link_name = zng_prefix!(inflateSetDictionary)] + pub fn inflateSetDictionary( + strm: z_streamp, + dictionary: *const Bytef, + dictLength: uInt, + ) -> c_int; + #[link_name = zng_prefix!(inflateSync)] pub fn inflateSync(strm: z_streamp) -> c_int; + #[link_name = zng_prefix!(zlibCompileFlags)] pub fn zlibCompileFlags() -> uLong; - pub fn zlibVersion() -> *const c_char; + // The above set of functions currently target 1.2.3.4 (what's present on Ubuntu + // 12.04, but there's some other APIs that were added later. Should figure out + // how to expose them... + // + // Added in 1.2.5.1 + // + // pub fn deflatePending(strm: z_streamp, + // pending: *mut c_uint, + // bits: *mut c_int) -> c_int; + // + // Addedin 1.2.7.1 + // pub fn inflateGetDictionary(strm: z_streamp, + // dictionary: *mut Bytef, + // dictLength: *mut uInt) -> c_int; + // + // Added in 1.2.3.5 + // pub fn gzbuffer(file: gzFile, size: c_uint) -> c_int; + // pub fn gzclose_r(file: gzFile) -> c_int; + // pub fn gzclose_w(file: gzFile) -> c_int; + // pub fn gzoffset(file: gzFile) -> z_off_t; +} -// The above set of functions currently target 1.2.3.4 (what's present on Ubuntu -// 12.04, but there's some other APIs that were added later. Should figure out -// how to expose them... -// -// Added in 1.2.5.1 -// -// pub fn deflatePending(strm: z_streamp, -// pending: *mut c_uint, -// bits: *mut c_int) -> c_int; -// -// Addedin 1.2.7.1 -// pub fn inflateGetDictionary(strm: z_streamp, -// dictionary: *mut Bytef, -// dictLength: *mut uInt) -> c_int; -// -// Added in 1.2.3.5 -// pub fn gzbuffer(file: gzFile, size: c_uint) -> c_int; -// pub fn gzclose_r(file: gzFile) -> c_int; -// pub fn gzclose_w(file: gzFile) -> c_int; -// pub fn gzoffset(file: gzFile) -> z_off_t; +extern "C" { + #[link_name = if_zng!("zlibng_version", "zlibVersion")] + pub fn zlibVersion() -> *const c_char; } -#[cfg(feature = "libc")] +#[cfg(any(zng, feature = "libc"))] extern "C" { - pub fn adler32_combine(adler1: uLong, adler2: uLong, len2: z_off_t) -> uLong; - pub fn compress(dest: *mut Bytef, destLen: *mut uLongf, - source: *const Bytef, sourceLen: uLong) -> c_int; - pub fn compress2(dest: *mut Bytef, destLen: *mut uLongf, - source: *const Bytef, sourceLen: uLong, - level: c_int) -> c_int; - pub fn compressBound(sourceLen: uLong) -> uLong; - pub fn crc32_combine(crc1: uLong, crc2: uLong, len2: z_off_t) -> uLong; + #[link_name = zng_prefix!(adler32_combine)] + pub fn adler32_combine(adler1: z_checksum, adler2: z_checksum, len2: z_off_t) -> z_checksum; + #[link_name = zng_prefix!(compress)] + pub fn compress( + dest: *mut Bytef, + destLen: *mut z_size, + source: *const Bytef, + sourceLen: z_size, + ) -> c_int; + #[link_name = zng_prefix!(compress2)] + pub fn compress2( + dest: *mut Bytef, + destLen: *mut z_size, + source: *const Bytef, + sourceLen: z_size, + level: c_int, + ) -> c_int; + #[link_name = zng_prefix!(compressBound)] + pub fn compressBound(sourceLen: z_size) -> z_size; + #[link_name = zng_prefix!(crc32_combine)] + pub fn crc32_combine(crc1: z_checksum, crc2: z_checksum, len2: z_off_t) -> z_checksum; + #[link_name = zng_prefix!(gzdirect)] pub fn gzdirect(file: gzFile) -> c_int; + #[link_name = zng_prefix!(gzdopen)] pub fn gzdopen(fd: c_int, mode: *const c_char) -> gzFile; + #[link_name = zng_prefix!(gzclearerr)] pub fn gzclearerr(file: gzFile); + #[link_name = zng_prefix!(gzclose)] pub fn gzclose(file: gzFile) -> c_int; + #[link_name = zng_prefix!(gzeof)] pub fn gzeof(file: gzFile) -> c_int; + #[link_name = zng_prefix!(gzerror)] pub fn gzerror(file: gzFile, errnum: *mut c_int) -> *const c_char; + #[link_name = zng_prefix!(gzflush)] pub fn gzflush(file: gzFile, flush: c_int) -> c_int; + #[link_name = zng_prefix!(gzgetc)] pub fn gzgetc(file: gzFile) -> c_int; + #[link_name = zng_prefix!(gzgets)] pub fn gzgets(file: gzFile, buf: *mut c_char, len: c_int) -> *mut c_char; + #[link_name = zng_prefix!(gzopen)] pub fn gzopen(path: *const c_char, mode: *const c_char) -> gzFile; + #[link_name = zng_prefix!(gzputc)] pub fn gzputc(file: gzFile, c: c_int) -> c_int; + #[link_name = zng_prefix!(gzputs)] pub fn gzputs(file: gzFile, s: *const c_char) -> c_int; + #[link_name = zng_prefix!(gzread)] pub fn gzread(file: gzFile, buf: voidp, len: c_uint) -> c_int; + #[link_name = zng_prefix!(gzrewind)] pub fn gzrewind(file: gzFile) -> c_int; + #[link_name = zng_prefix!(gzseek)] pub fn gzseek(file: gzFile, offset: z_off_t, whence: c_int) -> z_off_t; + #[link_name = zng_prefix!(gzsetparams)] pub fn gzsetparams(file: gzFile, level: c_int, strategy: c_int) -> c_int; + #[link_name = zng_prefix!(gztell)] pub fn gztell(file: gzFile) -> z_off_t; + #[link_name = zng_prefix!(gzungetc)] pub fn gzungetc(c: c_int, file: gzFile) -> c_int; + #[link_name = zng_prefix!(gzwrite)] pub fn gzwrite(file: gzFile, buf: voidpc, len: c_uint) -> c_int; - pub fn uncompress(dest: *mut Bytef, - destLen: *mut uLongf, - source: *const Bytef, - sourceLen: uLong) -> c_int; + #[link_name = zng_prefix!(uncompress)] + pub fn uncompress( + dest: *mut Bytef, + destLen: *mut z_size, + source: *const Bytef, + sourceLen: z_size, + ) -> c_int; } pub const Z_NO_FLUSH: c_int = 0;