Skip to content

Commit c45e32e

Browse files
committed
Merge branch 'main' into pkgconfig.msvc
2 parents 0a2a3f8 + dce65df commit c45e32e

24 files changed

+896
-433
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 3

.github/workflows/ci.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
# This job downloads and stores `cross` as an artifact, so that it can be
7+
# redownloaded across all of the jobs. Currently this copied pasted between
8+
# `ci.yml` and `deploy.yml`. Make sure to update both places when making
9+
# changes.
10+
install-cross:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: XAMPPRocky/get-github-release@f014caa45687655545637a005866289b3af8c69e # v1.0.4
14+
id: cross
15+
with:
16+
owner: rust-embedded
17+
repo: cross
18+
matches: ${{ matrix.platform }}
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
21+
with:
22+
name: cross-${{ matrix.platform }}
23+
path: ${{ steps.cross.outputs.install_path }}
24+
strategy:
25+
matrix:
26+
platform: [linux-musl]
27+
28+
windows:
29+
runs-on: windows-latest
30+
# Windows technically doesn't need this, but if we don't block windows on it
31+
# some of the windows jobs could fill up the concurrent job queue before
32+
# one of the install-cross jobs has started, so this makes sure all
33+
# artifacts are downloaded first.
34+
needs: install-cross
35+
steps:
36+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
37+
with:
38+
submodules: true
39+
- if: matrix.mingw_package
40+
uses: msys2/setup-msys2@7efe20baefed56359985e327d329042cde2434ff # v2
41+
with:
42+
release: false
43+
install: ${{ matrix.mingw_package }}
44+
- run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }}
45+
shell: bash
46+
- run: ci/test.bash cargo ${{ matrix.target }}
47+
shell: bash
48+
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
channel: [stable, beta, nightly]
53+
target:
54+
- x86_64-pc-windows-msvc
55+
- x86_64-pc-windows-gnu
56+
- i686-pc-windows-msvc
57+
- i686-pc-windows-gnu
58+
include:
59+
- target: x86_64-pc-windows-gnu
60+
mingw_package: mingw-w64-x86_64-gcc
61+
- target: i686-pc-windows-gnu
62+
mingw_package: mingw-w64-i686-gcc
63+
64+
macos:
65+
runs-on: macos-latest
66+
# macOS isn't currently using this either, but see the note about Windows above.
67+
needs: install-cross
68+
steps:
69+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
70+
with:
71+
submodules: true
72+
- run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }}
73+
- run: ci/test.bash cargo ${{ matrix.target }}
74+
75+
strategy:
76+
fail-fast: false
77+
matrix:
78+
channel: [stable, beta, nightly]
79+
target:
80+
- x86_64-apple-darwin
81+
82+
linux:
83+
runs-on: ubuntu-latest
84+
needs: install-cross
85+
steps:
86+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
87+
with:
88+
submodules: true
89+
90+
- name: Download Cross
91+
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
92+
with:
93+
name: cross-linux-musl
94+
path: /tmp/
95+
- run: chmod +x /tmp/cross
96+
- run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }}
97+
- run: ci/test.bash /tmp/cross ${{ matrix.target }}
98+
99+
strategy:
100+
fail-fast: false
101+
matrix:
102+
channel: [stable, beta, nightly]
103+
target:
104+
- aarch64-unknown-linux-gnu
105+
- aarch64-unknown-linux-musl
106+
- arm-unknown-linux-gnueabihf
107+
- arm-unknown-linux-musleabihf
108+
- i686-unknown-linux-gnu
109+
- i686-unknown-linux-musl
110+
- s390x-unknown-linux-gnu
111+
- x86_64-unknown-linux-gnu
112+
- x86_64-unknown-linux-musl

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "src/zlib"]
22
path = src/zlib
33
url = https://github.com/madler/zlib
4+
[submodule "src/zlib-ng"]
5+
path = src/zlib-ng
6+
url = https://github.com/zlib-ng/zlib-ng

.travis.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

Cargo-zng.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[package]
2+
name = "libz-ng-sys"
3+
version = "1.1.9"
4+
authors = ["Alex Crichton <[email protected]>", "Josh Triplett <[email protected]>", "Sebastian Thiel <[email protected]>"]
5+
links = "z-ng"
6+
license = "MIT OR Apache-2.0"
7+
repository = "https://github.com/rust-lang/libz-sys"
8+
description = "Low-level bindings to zlib-ng (libz-ng), a high-performance zlib library."
9+
categories = ["compression", "external-ffi-bindings"]
10+
keywords = ["zlib", "zlib-ng"]
11+
edition = "2018"
12+
13+
exclude = [
14+
"/.github",
15+
"/.gitmodules",
16+
"/README.md",
17+
"/build.rs",
18+
"/cargo-zng",
19+
"/ci",
20+
"/src/smoke.c",
21+
"/src/zlib",
22+
"/systest",
23+
]
24+
25+
build = "build_zng.rs"
26+
readme = "README-zng.md"
27+
28+
[workspace]
29+
members = ["systest"]
30+
31+
[dependencies]
32+
libc = "0.2.43"
33+
34+
[build-dependencies]
35+
cmake = "0.1.44"

Cargo.toml

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,68 @@
11
[package]
2-
32
name = "libz-sys"
4-
version = "1.0.20"
5-
authors = ["Alex Crichton <[email protected]>"]
3+
version = "1.1.9"
4+
authors = ["Alex Crichton <[email protected]>", "Josh Triplett <[email protected]>", "Sebastian Thiel <[email protected]>"]
65
links = "z"
7-
build = "build.rs"
8-
license = "MIT/Apache-2.0"
9-
repository = "https://github.com/alexcrichton/libz-sys"
10-
documentation = "https://docs.rs/libz-sys"
11-
description = """
12-
Bindings to the system libz library (also known as zlib).
13-
"""
14-
categories = ["external-ffi-bindings"]
6+
license = "MIT OR Apache-2.0"
7+
repository = "https://github.com/rust-lang/libz-sys"
8+
description = "Low-level bindings to the system libz library (also known as zlib)."
9+
categories = ["compression", "external-ffi-bindings"]
10+
keywords = ["zlib", "zlib-ng"]
11+
edition = "2018"
12+
13+
exclude = [
14+
"/.github",
15+
"/.gitmodules",
16+
"/Cargo-zng.toml",
17+
"/cargo-zng",
18+
"/ci",
19+
"/systest"
20+
]
1521

1622
[workspace]
1723
members = ["systest"]
1824

1925
[dependencies]
20-
libc = "0.2.43"
26+
# When this feature is disabled, zlib will be built in Z_SOLO mode which
27+
# removes dependency on any external libraries like libc at the cost of
28+
# eliminating some high-level functions like gz*, compress* and
29+
# uncompress, and requiring embedder to provide memory allocation
30+
# routines to deflate and inflate.
31+
libc = { version = "0.2.43", optional = true }
2132

2233
[build-dependencies]
2334
pkg-config = "0.3.9"
2435
cc = "1.0.18"
36+
cmake = { version = "0.1.44", optional = true }
2537

2638
[target.'cfg(target_env = "msvc")'.build-dependencies]
2739
vcpkg = "0.2"
40+
41+
[features]
42+
default = ["libc", "stock-zlib"]
43+
# By default, libz-sys uses stock zlib. If you set default-features=false,
44+
# enable the zlib-ng feature, and don't enable the stock-zlib feature, libz-sys
45+
# will instead supply the high-performance zlib-ng, in zlib-compat mode. Any
46+
# application or library designed for zlib should work with zlib-ng in
47+
# zlib-compat mode, as long as it doesn't make assumptions about the exact size
48+
# or output of the deflated data (e.g. "compressing this data produces exactly
49+
# this many bytes"), and as long as you don't also dynamically pull in a copy
50+
# of stock zlib (which will produce conflicting symbols). If a single crate in
51+
# the dependency graph requests stock-zlib (or doesn't disable default
52+
# features), you'll get stock zlib.
53+
#
54+
# Library crates should use:
55+
# libz-sys = { version = "1.1.0", default-features = false, features = ["libc"] }
56+
# (Omit the libc feature if you don't require the corresponding functions.)
57+
#
58+
# This allows higher-level crates depending on your library to opt into zlib-ng
59+
# if desired.
60+
#
61+
# Building zlib-ng requires cmake.
62+
zlib-ng = ["libc", "cmake"]
63+
stock-zlib = []
64+
# Deprecated: the assembly routines are outdated, and either reduce performance
65+
# or cause segfaults.
66+
asm = []
67+
# Enable this feature if you want to have a statically linked libz
68+
static = []

LICENSE-MIT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Copyright (c) 2014 Alex Crichton
2+
Copyright (c) 2020 Josh Triplett
23

34
Permission is hereby granted, free of charge, to any
45
person obtaining a copy of this software and associated

README-zng.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# libz-ng-sys
2+
3+
A library for linking zlib-ng (`libz-ng`) to Rust programs natively, rather
4+
than in zlib-compat mode.
5+
6+
zlib-ng is a high-performance implementation of zlib. zlib-ng supports building
7+
in two modes: zlib-compat mode, in whih it provides the same API as zlib and
8+
generally works as a drop-in replacement, and native mode, in which it provides
9+
its own API. The native API is almost identical to the zlib-compat API, except
10+
that some types use more correct sizes (rather than the sizes required for zlib
11+
compatibility), and the functions all have a `zng_` prefix. The latter allows
12+
zlib and zlib-ng to coexist in the same program.
13+
14+
This crate provides bindings to the native zlib-ng API. However, for simplicity
15+
of porting, this crate exports the same API as libz-sys (without the `zng_`
16+
prefixes), making it easier to write Rust software compatible with both
17+
libz-sys and libz-ng-sys.
18+
19+
# High-level API
20+
21+
This crate provides bindings to the raw low-level C API. For a higher-level
22+
safe API to work with DEFLATE, zlib, or gzip streams, see
23+
[`flate2`](https://docs.rs/flate2). `flate2` supports many different
24+
implementations.
25+
26+
# Development
27+
28+
This crate is built from [the same sources as
29+
`libz-sys`](https://github.com/rust-lang/libz-sys). From within those sources,
30+
`Cargo.toml` is the manifest for `libz-sys`, and `Cargo-zng.toml` is the
31+
manifest for `libz-ng-sys`. The script `./cargo-zng` invokes Cargo on a
32+
temporary copy of the sources with `Cargo-zng.toml` replacing `Cargo.toml`; for
33+
instance, use `./cargo-zng publish` to publish `libz-ng-sys`.
34+
35+
# Minimum Supported Rust Version (MSRV) Policy
36+
37+
This crate uses the same MSRV policy as the
38+
[`flate2`](https://crates.io/crates/flate2) crate: This crate supports the
39+
current and previous stable versions of Rust. Older versions of Rust may work,
40+
but we don't guarantee these will continue to work.
41+
42+
# License
43+
44+
This project is licensed under either of
45+
46+
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
47+
http://www.apache.org/licenses/LICENSE-2.0)
48+
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
49+
http://opensource.org/licenses/MIT)
50+
51+
at your option.
52+
53+
### Contribution
54+
55+
Unless you explicitly state otherwise, any contribution intentionally submitted
56+
for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
57+
be dual licensed as above, without any additional terms or conditions.

0 commit comments

Comments
 (0)