Skip to content

Commit 1add424

Browse files
kixelatedclaude
andcommitted
Prep for first publish: fix docs.rs build and crates.io metadata
- build.rs: stop short-circuiting on CARGO_DOC/DOCS_RS. src/bindings.rs include!s $OUT_DIR/bindings.rs, so skipping bindgen during doc builds made `cargo doc` (and docs.rs) fail to compile. The build is hermetic (libclang + vendored headers, both available on docs.rs), so always generate the bindings. - src/bindings.rs: allow(rustdoc::all) to silence ~144 rustdoc warnings from the generated C-header doc comments (bare URLs, etc.). - Cargo.toml: add readme, keywords, categories for crates.io, and exclude dev-only tooling (flake.*, justfile, deny.toml, toolchain) from the published tarball. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 27a218a commit 1add424

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ description = "VA-API H.264 hardware encoder, vendored and trimmed from cros-lib
55
authors = ["The ChromiumOS Authors", "Discord", "Luke Curley <kixelated@gmail.com>"]
66
repository = "https://github.com/moq-dev/vaapi"
77
license = "BSD-3-Clause"
8+
readme = "README.md"
9+
keywords = ["vaapi", "h264", "encoder", "video", "hardware"]
10+
categories = ["multimedia::encoding", "hardware-support", "external-ffi-bindings"]
811
edition = "2021"
912
rust-version = "1.85"
1013

14+
# Dev-only tooling; not needed to build the crate from the published tarball.
15+
exclude = ["flake.nix", "flake.lock", "justfile", "deny.toml", "rust-toolchain.toml", ".rustfmt.toml"]
16+
1117
# The build is hermetic: bindgen reads the vendored libva headers checked into
1218
# `libva/` (refreshed by `just vendor`, pinned to a known VA-API version so a
1319
# system libva bump can't drift the bindings), and libva is dlopen'd at runtime

build.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,10 @@ fn generate_vendored_version_header(out_dir: &Path) -> (u32, u32) {
6060
}
6161

6262
fn main() {
63-
// Do not require dependencies when generating docs.
64-
if std::env::var("CARGO_DOC").is_ok() || std::env::var("DOCS_RS").is_ok() {
65-
return;
66-
}
67-
63+
// NOTE: do not short-circuit for docs builds (CARGO_DOC / DOCS_RS). `src/bindings.rs`
64+
// `include!`s the generated `$OUT_DIR/bindings.rs`, so skipping bindgen makes
65+
// `cargo doc` (and docs.rs) fail to compile. The build is hermetic — it only needs
66+
// libclang and the vendored headers, both available on docs.rs — so always generate.
6867
let out_dir = PathBuf::from(env::var("OUT_DIR").expect("`OUT_DIR` is not set"));
6968

7069
// Always build against the vendored libva headers (checked into `libva/`,

src/bindings.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
#![allow(non_snake_case)]
1212
#![allow(non_camel_case_types)]
1313
#![allow(dead_code)]
14+
// The bindings are generated from vendored C headers; their doc comments carry
15+
// bare URLs and other rustdoc-unfriendly markup. Don't lint generated docs.
16+
#![allow(rustdoc::all)]
1417

1518
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

0 commit comments

Comments
 (0)