mux: allow build-time version label override (FREEMKV_BUILD_LABEL)
build.rs emits FREEMKV_VERSION = FREEMKV_BUILD_LABEL when that env is set (non-empty), else the Cargo package version. The muxing/writing-application field and the FVI generator tag use it, so a pre-release/test build can be stamped without bumping Cargo.toml and disturbing the tag-pinned [patch] version matching. The git short hash is still appended either way.
This commit is contained in:
@@ -57,6 +57,18 @@ fn main() {
|
||||
/// leaving just the package version. Always emitted so `env!("GIT_SUFFIX")`
|
||||
/// resolves on every target.
|
||||
fn emit_git_suffix() {
|
||||
// Version label for the muxing-app / FVI generator tag. `FREEMKV_BUILD_LABEL`
|
||||
// overrides the Cargo package version when set (non-empty) — used to stamp a
|
||||
// pre-release/test build without bumping Cargo.toml and disturbing the
|
||||
// tag-pinned [patch] version matching. Unset → the package version.
|
||||
let version = std::env::var("FREEMKV_BUILD_LABEL")
|
||||
.ok()
|
||||
.filter(|s| !s.trim().is_empty())
|
||||
.or_else(|| std::env::var("CARGO_PKG_VERSION").ok())
|
||||
.unwrap_or_default();
|
||||
println!("cargo:rustc-env=FREEMKV_VERSION={version}");
|
||||
println!("cargo:rerun-if-env-changed=FREEMKV_BUILD_LABEL");
|
||||
|
||||
let suffix = git_short_hash()
|
||||
.map(|h| format!(" (g{h})"))
|
||||
.unwrap_or_default();
|
||||
|
||||
+1
-1
@@ -774,7 +774,7 @@ impl<W: Write + Seek> MkvMuxer<W> {
|
||||
// Stamp the freemkv version so any muxed file is traceable to the build
|
||||
// that produced it (MediaInfo "Writing application"/"library").
|
||||
const FREEMKV_MUX_APP: &str =
|
||||
concat!("freemkv ", env!("CARGO_PKG_VERSION"), env!("GIT_SUFFIX"));
|
||||
concat!("freemkv ", env!("FREEMKV_VERSION"), env!("GIT_SUFFIX"));
|
||||
ebml::write_string(&mut writer, ebml::MUXING_APP, FREEMKV_MUX_APP)?;
|
||||
ebml::write_string(&mut writer, ebml::WRITING_APP, FREEMKV_MUX_APP)?;
|
||||
if let Some(t) = title {
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ pub const FVI_VERSION: u32 = 1;
|
||||
|
||||
/// Producing tool tag for the header `"generator"` member
|
||||
/// (`docs/FVI_FORMAT.md` §6).
|
||||
pub const FVI_GENERATOR: &str = concat!("freemkv/", env!("CARGO_PKG_VERSION"), env!("GIT_SUFFIX"));
|
||||
pub const FVI_GENERATOR: &str = concat!("freemkv/", env!("FREEMKV_VERSION"), env!("GIT_SUFFIX"));
|
||||
|
||||
/// Header `"timescale"` for all `pts`/`dts` ticks (`docs/FVI_FORMAT.md` §10).
|
||||
/// The highway carries presentation timestamps in nanoseconds, so the timescale
|
||||
|
||||
Reference in New Issue
Block a user