From 99042ccf67f83ca4236b3d76c719f78a176584de Mon Sep 17 00:00:00 2001 From: Shiva Kiran Koninty Date: Fri, 7 Aug 2026 15:51:06 +0530 Subject: [PATCH 1/9] Add rustfmt configuration --- .rustfmt.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .rustfmt.toml diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..f3e454b --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,2 @@ +edition = "2024" +style_edition = "2024" From e996294d5d2388c525d6193c571e6e1640216066 Mon Sep 17 00:00:00 2001 From: Shiva Kiran Koninty Date: Fri, 7 Aug 2026 11:54:38 +0530 Subject: [PATCH 2/9] Represent the native library's version in version metadata --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 83be58a..99b4093 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libcdio-sys" -version = "2.0.0" +version = "3.0.0+2.4.0p2.0.2" edition = "2024" authors = ["Joaquim Monteiro "] description = "Native bindings to the libcdio (and libcdio-paranoia) library" From 8b456046c74cc3a93d2491a8974512bb1a8914fd Mon Sep 17 00:00:00 2001 From: Shiva Kiran Koninty Date: Sat, 8 Aug 2026 14:43:34 +0530 Subject: [PATCH 3/9] Probe system libraries based on crate versioning The native library version is reflected in the semver metadata of the crate's version. Declare this as a minimum version when probing the system for the native library. --- Cargo.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 99b4093..47a65fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,11 +24,11 @@ cdda = [] paranoia = ["cdda"] [package.metadata.system-deps] -libcdio = "0" -libiso9660 = { version = "0", feature = "iso9660" } -libudf = { version = "0", feature = "udf" } -libcdio_cdda = { version = "0", feature = "cdda" } -libcdio_paranoia = { version = "0", feature = "paranoia" } +libcdio = ">= 2.4.0, < 3.0.0" +libiso9660 = { version = ">= 2.4.0, < 3.0.0", feature = "iso9660" } +libudf = { version = ">= 2.4.0, < 3.0.0", feature = "udf" } +libcdio_cdda = { version = ">= 10.2+2.0.2, < 10.2+3.0.0", feature = "cdda" } +libcdio_paranoia = { version = ">= 10.2+2.0.2, < 10.2+3.0.0", feature = "paranoia" } [package.metadata.docs.rs] all-features = true From 75a24537277c4b531698d48886087a0192f41857 Mon Sep 17 00:00:00 2001 From: Shiva Kiran Koninty Date: Fri, 7 Aug 2026 12:16:02 +0530 Subject: [PATCH 4/9] Accept additional include paths in `make_bindings()` --- build.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/build.rs b/build.rs index 4622b6b..d25b2e4 100644 --- a/build.rs +++ b/build.rs @@ -1,15 +1,24 @@ use std::env; use std::error::Error; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; fn main() -> Result<(), Box> { system_deps::Config::new().probe()?; - make_bindings()?; + make_bindings(std::iter::empty::<&Path>())?; Ok(()) } -fn make_bindings() -> Result<(), Box> { +/// Create bindings at OUT_DIR/bindings.rs. +/// Additional include paths can be passed as input. +fn make_bindings( + includes: impl IntoIterator>, +) -> Result<(), Box> { + let mut builder = bindgen::Builder::default(); + for include in includes { + builder = builder.clang_arg(format!("-I{}", include.as_ref().display())); + } + // libcdio uses a homegrown boolean type for versions < 2.1.1. // The homegrown boolean type is not recognized by bindgen. // This would result in different code gen for versions < 2.1.1 and versions >= 2.1.1. @@ -34,7 +43,7 @@ fn make_bindings() -> Result<(), Box> { "#include ", ]; let headers = HEADERS.join("\n"); - let bindings = bindgen::Builder::default() + let bindings = builder .header_contents("wrapper.h", &headers) .allowlist_file(r".*[/\\]cdio[/\\][^/\\]*\.h") .allowlist_file(r".*[/\\]cdio[/\\]paranoia[/\\][^/\\]*\.h") From 35ff3e8a6327e358933a34cefc123b972960c864 Mon Sep 17 00:00:00 2001 From: Shiva Kiran Koninty Date: Fri, 7 Aug 2026 11:47:33 +0530 Subject: [PATCH 5/9] Add vendoring for libcdio --- .gitmodules | 3 + Cargo.toml | 11 +++- build.rs | 145 ++++++++++++++++++++++++++++++++++++++++++++++- vendor/config.h | 68 ++++++++++++++++++++++ vendor/libcdio | 1 + vendor/version.h | 10 ++++ 6 files changed, 234 insertions(+), 4 deletions(-) create mode 100644 .gitmodules create mode 100644 vendor/config.h create mode 160000 vendor/libcdio create mode 100644 vendor/version.h diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..affeb8e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vendor/libcdio"] + path = vendor/libcdio + url = https://github.com/libcdio/libcdio.git diff --git a/Cargo.toml b/Cargo.toml index 47a65fa..1cde87d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,13 @@ authors = ["Joaquim Monteiro "] description = "Native bindings to the libcdio (and libcdio-paranoia) library" repository = "https://github.com/MonterraByte/libcdio-sys" readme = "README.md" -exclude = ["/.github"] +exclude = [ + "/.github", + "vendor/libcdio/*", + "!vendor/libcdio/COPYING", + "!vendor/libcdio/include/**/*.h", + "!vendor/libcdio/lib/**/*.[ch]", +] keywords = ["ffi", "cd", "cdio", "iso9660", "udf"] categories = ["external-ffi-bindings", "hardware-support", "multimedia", "multimedia::audio"] license = "GPL-3.0+" @@ -14,6 +20,7 @@ links = "cdio" [build-dependencies] bindgen = "0.72" +cc = { version = "1.4.0" } system-deps = "7" [features] @@ -22,7 +29,9 @@ iso9660 = [] udf = [] cdda = [] paranoia = ["cdda"] +vendored = [] +# Do not forget vendor/*version.h [package.metadata.system-deps] libcdio = ">= 2.4.0, < 3.0.0" libiso9660 = { version = ">= 2.4.0, < 3.0.0", feature = "iso9660" } diff --git a/build.rs b/build.rs index d25b2e4..b606c48 100644 --- a/build.rs +++ b/build.rs @@ -1,12 +1,88 @@ use std::env; use std::error::Error; +use std::fs; +use std::io; use std::path::{Path, PathBuf}; fn main() -> Result<(), Box> { - system_deps::Config::new().probe()?; - make_bindings(std::iter::empty::<&Path>())?; + let vendoring_allowed = matches!( + env::var("LIBCDIO_NO_VENDOR").as_deref(), + Ok("") | Ok("0") | Err(_) + ); + println!("cargo::rerun-if-env-changed=LIBCDIO_NO_VENDOR"); - Ok(()) + if cfg!(feature = "vendored") && vendoring_allowed { + make_bindings(make_static()?) + } else { + match system_deps::Config::new().probe() { + Ok(deps) => make_bindings(deps.all_include_paths()), + Err(err) if vendoring_allowed => { + println!("cargo::warning=could not find libcdio"); + for line in err.to_string().lines() { + println!("cargo::warning={}", line); + } + println!( + "cargo::warning=LIBCDIO_NO_VENDOR is not set, falling back to a vendored build" + ); + make_bindings(make_static()?) + } + Err(err) => { + println!("cargo::warning=LIBCDIO_NO_VENDOR is set but libcdio could not be found"); + Err(err.into()) + } + } + } +} + +/// Build a static library and return the (public) include paths +fn make_static() -> Result, cc::Error> { + let mut includes = Vec::new(); + let mut build = cc::Build::new(); + build.warnings(false); + build.define("HAVE_CONFIG_H", None); // provided at vendor/config.h + + let vendor = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("vendor/"); + println!("cargo::rerun-if-changed=vendor/"); + + // a location in OUT_DIR to place custom headers + let include = env::var("OUT_DIR") + .map(|out_dir| PathBuf::from(out_dir).join("include/")) + .expect("OUT_DIR should have been set by cargo"); + includes.push(include.clone()); + cp(vendor.join("config.h"), include.join("config.h"))?; + cp(vendor.join("version.h"), include.join("cdio/version.h"))?; + + let target = env::var("TARGET").expect("TARGET should have been set by Cargo"); + if target.contains("windows") { + println!("cargo::rustc-link-lib=winmm"); + } + if target.contains("darwin") { + println!("cargo::rustc-link-lib=framework=CoreFoundation"); + println!("cargo::rustc-link-lib=framework=DiskArbitration"); + println!("cargo::rustc-link-lib=framework=IOKit"); + } + if target.contains("freebsd") { + println!("cargo::rustc-link-lib=cam"); + } + includes.push(vendor.join("libcdio/include/")); + let cdio_src = vendor.join("libcdio/lib/driver/"); + build.include(&cdio_src); // lets the compiler discover private headers + build.files(CDIO_SOURCES.iter().map(|s| cdio_src.join(s))); + if cfg!(feature = "iso9660") { + let src = vendor.join("libcdio/lib/iso9660/"); + build.include(&src); + build.files(ISO9660_SOURCES.iter().map(|s| src.join(s))); + } + if cfg!(feature = "udf") { + let src = vendor.join("libcdio/lib/udf/"); + build.include(&src); + build.files(UDF_SOURCES.iter().map(|s| src.join(s))); + } + + build.includes(&includes); + build.try_compile("cdio")?; + + Ok(includes) } /// Create bindings at OUT_DIR/bindings.rs. @@ -57,3 +133,66 @@ fn make_bindings( Ok(()) } + +/// Copy file at `from` to the given destination if not present, +/// creating any parent directories if needed. +fn cp(from: impl AsRef, to: impl AsRef) -> Result<(), io::Error> { + let to = to.as_ref(); + if to.exists() { + return Ok(()); + } + let parent = to + .parent() + .expect("`to` path should have a parent directory"); + fs::create_dir_all(parent)?; + fs::copy(from, to).map(|_| ()) +} + +const CDIO_SOURCES: &[&str] = &[ + "_cdio_generic.c", + "_cdio_stdio.c", + "_cdio_stream.c", + "abs_path.c", + "aix.c", + "audio.c", + "cd_types.c", + "cdio.c", + "cdtext.c", + "device.c", + "disc.c", + "ds.c", + "FreeBSD/freebsd.c", + "FreeBSD/freebsd_cam.c", + "FreeBSD/freebsd_ioctl.c", + "gnu_linux.c", + "image/bincue.c", + "image/cdrdao.c", + "image_common.c", + "image/nrg.c", + "logging.c", + "memory.c", + "mmc/mmc.c", + "mmc/mmc_hl_cmds.c", + "mmc/mmc_ll_cmds.c", + "mmc/mmc_util.c", + "MSWindows/aspi32.c", + "MSWindows/win32_ioctl.c", + "MSWindows/win32.c", + "netbsd.c", + "osx.c", + "read.c", + "realpath.c", + "sector.c", + "solaris.c", + "track.c", + "utf8.c", + "util.c", +]; +const ISO9660_SOURCES: &[&str] = &["iso9660.c", "iso9660_fs.c", "rock.c", "xa.c"]; +const UDF_SOURCES: &[&str] = &[ + "filemode.c", + "udf.c", + "udf_file.c", + "udf_fs.c", + "udf_time.c", +]; diff --git a/vendor/config.h b/vendor/config.h new file mode 100644 index 0000000..b20b5d4 --- /dev/null +++ b/vendor/config.h @@ -0,0 +1,68 @@ +/* config.h for libcdio */ + +#pragma once + +#define LIBCDIO_CONFIG_H + +/* Standard headers available on all modern platforms */ +#define HAVE_ERRNO_H +#define HAVE_FCNTL_H +#define HAVE_INTTYPES_H +#define HAVE_LIMITS_H +#define HAVE_MEMORY_H +#define HAVE_MEMCPY +#define HAVE_MEMSET +#define HAVE_SNPRINTF +#define HAVE_STDBOOL_H +#define HAVE_STDARG_H +#define HAVE_STDINT_H +#define HAVE_STDIO_H +#define HAVE_STDLIB_H +#define HAVE_STRING_H +#define HAVE_VSNPRINTF +#define HAVE_SYS_STAT_H +#define HAVE_SYS_TYPES_H +#define STDC_HEADERS + +/* Common values */ +#define EMPTY_ARRAY_SIZE +#define ICONV_CONST +#define HAVE_JOLIET +#define HAVE_ROCK + +/* Platform specific */ +#if defined(_WIN32) + #define HAVE_NTDDSCSI_H + #define HAVE_NTDDCDRM_H + #define HAVE_WIN32_CDROM + #define HAVE_WINDOWS_H +#endif +#if defined(__APPLE__) || (__FreeBSD__) || (__linux__) + #define HAVE_DLFCN_H + #define HAVE_GLOB_H + #define HAVE_GMTIME_R + #define HAVE_ICONV + #define HAVE_LOCALTIME_R + #define HAVE_SETENV + #define HAVE_STRINGS_H + #define HAVE_STRTOK_R + #define HAVE_TM_GMTOFF + #define HAVE_TIMEGM + #define HAVE_UNISTD_H + #define HAVE_UNSETENV +#endif +#if defined(__APPLE__) + #define HAVE_COREFOUNDATION_CFBASE_H + #define HAVE_DARWIN_CDROM + #define HAVE_DISKARBITRATION + #define HAVE_IOKIT_IOKITLIB_H +#endif +#if defined(__FreeBSD__) + #define HAVE_FREEBSD_CDROM + #define HAVE_SYS_CDIO_H +#endif +#if defined (__linux__) + #define _FILE_OFFSET_BITS 64 + #define HAVE_LINUX_CDROM + #define HAVE_LINUX_VERSION_H +#endif diff --git a/vendor/libcdio b/vendor/libcdio new file mode 160000 index 0000000..ee2f9e3 --- /dev/null +++ b/vendor/libcdio @@ -0,0 +1 @@ +Subproject commit ee2f9e380e346d7a9c46ad71105353940101992a diff --git a/vendor/version.h b/vendor/version.h new file mode 100644 index 0000000..9efbe9d --- /dev/null +++ b/vendor/version.h @@ -0,0 +1,10 @@ +/* + * `version.h` to be used in place of autoconf-generated `version.h.in` + * for libcdio's Cargo builds + */ + +#define CDIO_VERSION "2.4.0 cargo-build" +extern const char *cdio_version_string; + +#define LIBCDIO_VERSION_NUM 20400 +extern const unsigned int libcdio_version_num; From d0ab48af70aa6a805c5a208c16cadc593ec6bce7 Mon Sep 17 00:00:00 2001 From: Shiva Kiran Koninty Date: Sat, 8 Aug 2026 11:17:59 +0530 Subject: [PATCH 6/9] Use libcdio's custom `unistd.h` for MSVC builds libcdio uses a custom `unistd.h` for MSVC builds. Update the Rust build script accordingly. --- Cargo.toml | 1 + build.rs | 9 ++++++++- vendor/config.h | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1cde87d..7d76042 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ readme = "README.md" exclude = [ "/.github", "vendor/libcdio/*", + "!vendor/libcdio/.vs/unistd.h", "!vendor/libcdio/COPYING", "!vendor/libcdio/include/**/*.h", "!vendor/libcdio/lib/**/*.[ch]", diff --git a/build.rs b/build.rs index b606c48..6fdc4c1 100644 --- a/build.rs +++ b/build.rs @@ -51,8 +51,15 @@ fn make_static() -> Result, cc::Error> { includes.push(include.clone()); cp(vendor.join("config.h"), include.join("config.h"))?; cp(vendor.join("version.h"), include.join("cdio/version.h"))?; - let target = env::var("TARGET").expect("TARGET should have been set by Cargo"); + if target.contains("msvc") { + // libcdio uses a custom unistd.h for its MSVC builds + cp( + vendor.join("libcdio/.vs/unistd.h"), + include.join("unistd.h"), + )?; + } + if target.contains("windows") { println!("cargo::rustc-link-lib=winmm"); } diff --git a/vendor/config.h b/vendor/config.h index b20b5d4..facafc1 100644 --- a/vendor/config.h +++ b/vendor/config.h @@ -29,6 +29,7 @@ #define ICONV_CONST #define HAVE_JOLIET #define HAVE_ROCK +#define HAVE_UNISTD_H /* A custom unistd.h is used for MSVC */ /* Platform specific */ #if defined(_WIN32) @@ -48,7 +49,6 @@ #define HAVE_STRTOK_R #define HAVE_TM_GMTOFF #define HAVE_TIMEGM - #define HAVE_UNISTD_H #define HAVE_UNSETENV #endif #if defined(__APPLE__) From 89a9896cfb63148a4db5d901ed13538d201dea93 Mon Sep 17 00:00:00 2001 From: Shiva Kiran Koninty Date: Sat, 8 Aug 2026 17:20:19 +0530 Subject: [PATCH 7/9] Add vendoring for libcdio-paranoia --- .gitmodules | 3 +++ build.rs | 34 +++++++++++++++++++++++++++++++++- vendor/config.h | 5 ++++- vendor/libcdio-paranoia | 1 + vendor/paranoia_version.h | 7 +++++++ 5 files changed, 48 insertions(+), 2 deletions(-) create mode 160000 vendor/libcdio-paranoia create mode 100644 vendor/paranoia_version.h diff --git a/.gitmodules b/.gitmodules index affeb8e..3f3e492 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "vendor/libcdio"] path = vendor/libcdio url = https://github.com/libcdio/libcdio.git +[submodule "vendor/libcdio-paranoia"] + path = vendor/libcdio-paranoia + url = https://github.com/libcdio/libcdio-paranoia.git diff --git a/build.rs b/build.rs index 6fdc4c1..1e68b6c 100644 --- a/build.rs +++ b/build.rs @@ -35,7 +35,7 @@ fn main() -> Result<(), Box> { } /// Build a static library and return the (public) include paths -fn make_static() -> Result, cc::Error> { +fn make_static() -> Result, Box> { let mut includes = Vec::new(); let mut build = cc::Build::new(); build.warnings(false); @@ -86,6 +86,27 @@ fn make_static() -> Result, cc::Error> { build.files(UDF_SOURCES.iter().map(|s| src.join(s))); } + if cfg!(feature = "cdda") || cfg!(feature = "paranoia") { + if target.contains("msvc") { + return Err("This version of libcdio-paranoia does not support MSVC builds".into()); + } + includes.push(vendor.join("libcdio-paranoia/include/")); + cp( + vendor.join("paranoia_version.h"), + include.join("cdio/paranoia/version.h"), + )?; + } + if cfg!(feature = "cdda") { + let src = vendor.join("libcdio-paranoia/lib/cdda_interface/"); + build.include(&src); + build.files(CDDA_SOURCES.iter().map(|s| src.join(s))); + } + if cfg!(feature = "paranoia") { + let src = vendor.join("libcdio-paranoia/lib/paranoia/"); + build.include(&src); + build.files(PARANOIA_SOURCES.iter().map(|s| src.join(s))); + } + build.includes(&includes); build.try_compile("cdio")?; @@ -203,3 +224,14 @@ const UDF_SOURCES: &[&str] = &[ "udf_fs.c", "udf_time.c", ]; +const CDDA_SOURCES: &[&str] = &[ + "cddap_interface.c", + "common_interface.c", + "drive_exceptions.c", + "interface.c", + "scan_devices.c", + "smallft.c", + "toc.c", + "utils.c", +]; +const PARANOIA_SOURCES: &[&str] = &["gap.c", "isort.c", "overlap.c", "p_block.c", "paranoia.c"]; diff --git a/vendor/config.h b/vendor/config.h index facafc1..14afb72 100644 --- a/vendor/config.h +++ b/vendor/config.h @@ -1,4 +1,4 @@ -/* config.h for libcdio */ +/* config.h for libcdio and libcdio-paranoia */ #pragma once @@ -39,6 +39,9 @@ #define HAVE_WINDOWS_H #endif #if defined(__APPLE__) || (__FreeBSD__) || (__linux__) + #define HAVE_CLOCK_GETTIME + #define HAVE_SYS_TIME_H + #define HAVE_DLFCN_H #define HAVE_GLOB_H #define HAVE_GMTIME_R diff --git a/vendor/libcdio-paranoia b/vendor/libcdio-paranoia new file mode 160000 index 0000000..9086b36 --- /dev/null +++ b/vendor/libcdio-paranoia @@ -0,0 +1 @@ +Subproject commit 9086b36d2b434af3eb7977e17653b41d01da92b2 diff --git a/vendor/paranoia_version.h b/vendor/paranoia_version.h new file mode 100644 index 0000000..e2f8a0e --- /dev/null +++ b/vendor/paranoia_version.h @@ -0,0 +1,7 @@ +/* + * `version.h` to be used in place of autoconf-generated `version.h.in` + * for libcdio-paranoia's Cargo builds + */ + +#define LIBCDIO_PARANOIA_VERSION "10.2+2.0.2 cargo-build" +extern const char *cdio_paranoia_version_string; From 1556156cb5f0e384f0e9185bab2677ab7915b58c Mon Sep 17 00:00:00 2001 From: Shiva Kiran Koninty Date: Fri, 7 Aug 2026 13:25:11 +0530 Subject: [PATCH 8/9] Update README.md on new versioning and vendoring --- README.md | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 99afd29..d9cc2e2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # libcdio-sys - Native bindings to the libcdio and libcdio-paranoia libraries [![crates.io](https://img.shields.io/crates/v/libcdio-sys.svg)](https://crates.io/crates/libcdio-sys) @@ -9,18 +8,40 @@ Native bindings to the libcdio and libcdio-paranoia libraries [libcdio documentation](https://www.gnu.org/software/libcdio/libcdio.html) # Usage +Run `cargo add libcdio-sys` to add the crate. + +libcdio is split into multiple libraries: `libcdio`, `libiso9660` and +`libudf`. Likewise, libcdio-paranoia is split into `libcdio_cdda` and +`libcdio_paranoia`. + +Cargo features are provided to control which libraries are included. -Run `cargo add libcdio-sys`, or add `libcdio-sys = "2"` to the `[dependencies]` section of your Cargo.toml. +## Versioning +The crate's version reflects three things: +For example: `v3.0.0+2.4.0p2.0.2`. +- `v3.0.0`: Crate version +- `+2.4.0`: libcdio's version +- `p2.0.2`: libcdio-paranoia's version (`10.2+2.0.2` in this case) +Everything beyond the `+` is ignored by Cargo during resolution. -libcdio is split into multiple libraries: `libcdio`, `libiso9660` and `libudf`. (Likewise, libcdio-paranoia is split into `libcdio_cdda` and `libcdio_paranoia`.) The `libcdio-sys` crate always links against `libcdio`, and can link against the others depending on which Cargo features are enabled. +## Vendoring +Enable the `vendored` feature to always perform vendored builds. -The available Cargo features are `iso9660`, `udf`, `cdda` and `paranoia`. The first two are enabled by default; the last two require libcdio-paranoia, which is usually installed separately from libcdio. +If disabled, the crate will attempt to use the libraries from the +system before falling back to vendoring if that fails. +To force a non-vendored build, set the `LIBCDIO_NO_VENDOR` environment +variable. -## Prerequisites +Non-vendored builds use the version metadata as a lower bound +when probing the system, allowing any newer non-major version. +Thus, a non-vendored build for `v3.0.0+2.4.0p2.0.2` would probe the +system for libcdio `>= 2.4.0, < 3.0.0` and (if features are enabled) +libcdio-paranoia `>= 10.2+2.0.2, < 10.2+3.0.0`. -You need to have libcdio and its headers installed in order to build this crate. +You need to have libcdio and its headers installed for non-vendored builds. -pkg-config is also required to build this crate normally, though this requirement can be avoided by setting the following environment variables: +pkg-config is also required for this, though this requirement can be +avoided by setting the following environment variables: | Feature | Environment variables | | ---------- | --------------------------------------------------------------------------------------------- | @@ -30,10 +51,12 @@ pkg-config is also required to build this crate normally, though this requiremen | `cdda` | `SYSTEM_DEPS_LIBCDIO_CDDA_NO_PKG_CONFIG=1 SYSTEM_DEPS_LIBCDIO_CDDA_LIB=cdio_cdda` | | `paranoia` | `SYSTEM_DEPS_LIBCDIO_PARANOIA_NO_PKG_CONFIG=1 SYSTEM_DEPS_LIBCDIO_PARANOIA_LIB=cdio_paranoia` | -## Overriding the libcdio library - -To control the libcdio library used when building this crate, set the `PKG_CONFIG_PATH` environment variable to the path of the directory containing pkg-config files for the correct library. -Alternatively, set the the following environment variables, depending on which features you have enabled: +### Overriding the system library +To control the shared library used in a non-vendored build, set the +`PKG_CONFIG_PATH` environment variable to the path of the directory +containing pkg-config files for the correct library. +Alternatively, set the the following environment variables, depending +on which features you have enabled: | Feature | Library path | Include path | | ---------- | -------------------------------------------- | -------------------------------------- | @@ -47,7 +70,6 @@ Variables in the "Library path" column should be set to the path of the director See the [system-deps documentation](https://docs.rs/system-deps/7/system_deps/) for more information. # License - Copyright © 2018, 2019, 2020, 2023, 2025 Joaquim Monteiro This program is free software: you can redistribute it and/or modify From 916aae517559b2a82c77767d92271651b81dfdcb Mon Sep 17 00:00:00 2001 From: Shiva Kiran Koninty Date: Fri, 7 Aug 2026 14:25:37 +0530 Subject: [PATCH 9/9] Update CI for vendoring --- .github/workflows/ci.yml | 54 +++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eafa913..e869f64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,24 +10,54 @@ env: CARGO_TERM_COLOR: always jobs: - build: + vendored-build: + strategy: + matrix: + os: [windows-latest, macos-latest, ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v7 + with: + submodules: true + - name: Build the crate (Unix) + if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest' + run: cargo build --all-features + - name: Build the crate (MSVC) + if: matrix.os == 'windows-latest' + # libcdio-paranoia does not support MSVC + run: cargo build --features iso9660,udf,vendored + + non-vendored-build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Install libcdio + - uses: actions/checkout@v7 + with: + submodules: true + - name: Install build dependencies + run: sudo apt install help2man + - name: Build and install libcdio from source + env: + CFLAGS: -O0 run: | - sudo apt-get update - sudo apt-get install -y libcdio-dev libiso9660-dev libudf-dev libcdio-cdda-dev libcdio-paranoia-dev - - uses: dtolnay/rust-toolchain@stable - - run: cargo build --workspace --all-targets --all-features + cd vendor/libcdio + ./autogen.sh + make + sudo make install + - name: Build and install libcdio-paranoia from source + run: | + cd vendor/libcdio-paranoia + ./autogen.sh + make + sudo make install + - name: Build the crate + run: LIBCDIO_NO_VENDOR=1 cargo build --all-features semver-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Install libcdio - run: | - sudo apt-get update - sudo apt-get install -y libcdio-dev libiso9660-dev libudf-dev libcdio-cdda-dev libcdio-paranoia-dev + - uses: actions/checkout@v7 + with: + submodules: true + # Will use a vendored build - name: Check semver uses: obi1kenobi/cargo-semver-checks-action@v2