Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UNRELEASED]

## 7.0.7

- Fix breakage for systems with libcec7 installed: revert to static prebuilt v6 libcec for now.

## 7.0.6

- Support for `aarch64-unknown-linux-gnu`
Expand Down
10 changes: 6 additions & 4 deletions build/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,10 @@ fn libcec_installed_pkg_config() -> Result<CecVersion, ()> {
println!("\n\n==============================================================\nUsing pkg-config to find out if libcec is installed\n==============================================================");
for abi in CEC_MAJOR_VERSIONS {
println!("\n\npkg-config with libcec major {}", abi.major());
let major = format!("{}.0.0", abi.major()); // inclusive
let next_major = format!("{}.0.0", abi.major() + 1); // exclusive
let pkg_config_result = pkg_config::Config::new()
.atleast_version(&abi.major().to_string())
.range_version(major.as_str()..next_major.as_str())
.probe("libcec");
if pkg_config_result.is_ok() {
println!("pkg_config(>={}) -> found", abi.major());
Expand Down Expand Up @@ -481,11 +483,11 @@ fn find_using_smoke_test() -> bool {

fn determine_mode() -> BuildMode {
let vendored_explicitly_via_env =
env::var("LIBCEC_VENDORED").map_or(false, |s| s != "0" && !s.is_empty());
env::var("LIBCEC_VENDORED").is_ok_and(|s| s != "0" && !s.is_empty());
let vendored_forbidden_explicitly_via_env =
env::var("LIBCEC_NO_VENDOR").map_or(false, |s| s != "0" && !s.is_empty());
env::var("LIBCEC_NO_VENDOR").is_ok_and(|s| s != "0" && !s.is_empty());
let static_explicitly_via_env =
env::var("LIBCEC_STATIC").map_or(false, |s| s != "0" && !s.is_empty());
env::var("LIBCEC_STATIC").is_ok_and(|s| s != "0" && !s.is_empty());

if (cfg!(feature = "vendored") || vendored_explicitly_via_env)
&& !vendored_forbidden_explicitly_via_env
Expand Down
14 changes: 14 additions & 0 deletions cec_bindgen/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,19 @@ fn fetch_libcec_source<P: AsRef<Path>>(path: P, major_version: &str) -> Result<(
Ok(())
}

fn preprocess_headers<P: AsRef<Path>>(path: P){
let cectypes_path = path.as_ref().join("include").join("cectypes.h");
let mut cectypes_content =
std::fs::read_to_string(&cectypes_path).expect("Failed to read cectypes.h");

// replace weird comments so they don't end up with the bindgen result and result in clippy issues
cectypes_content = cectypes_content.replace("@/*!< ", "/* ");
cectypes_content = cectypes_content.replace("//!< ", "// ");


std::fs::write(cectypes_path, cectypes_content).expect("Failed to create cectypes.h");
}

fn main() -> Result<()> {
color_eyre::install()?;
let args: Args = Args::parse();
Expand Down Expand Up @@ -129,6 +142,7 @@ fn main() -> Result<()> {

// Only the headers are used, so fetch the release version since it's smaller.
fetch_libcec_source(&lib_path, &args.major_version).context("failed to fetch libcec source")?;
preprocess_headers(&lib_path);
run_bindgen(&src_path, &lib_path, &out_path).context("failed to run bindgen")?;
dbg!(&out_path);

Expand Down
5 changes: 0 additions & 5 deletions src/lib_abi6_x86_64-unknown-linux-gnu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,10 @@ pub const CEC_IMX_VIRTUAL_COM: &[u8; 5] = b"i.MX\0";
pub const CEC_MIN_LIB_VERSION: u32 = 4;
pub const CEC_FEATURE_CONFIGURABLE_COMBO_KEY: u32 = 1;
pub const LIBCEC_OSD_NAME_SIZE: u32 = 15;
#[doc = "!< CEC_ABORT_REASON_UNRECOGNIZED_OPCODE"]
pub const cec_abort_reason_UNRECOGNIZED_OPCODE: cec_abort_reason = 0;
#[doc = "!< CEC_ABORT_REASON_NOT_IN_CORRECT_MODE_TO_RESPOND"]
pub const cec_abort_reason_NOT_IN_CORRECT_MODE_TO_RESPOND: cec_abort_reason = 1;
#[doc = "!< CEC_ABORT_REASON_CANNOT_PROVIDE_SOURCE"]
pub const cec_abort_reason_CANNOT_PROVIDE_SOURCE: cec_abort_reason = 2;
#[doc = "!< CEC_ABORT_REASON_INVALID_OPERAND"]
pub const cec_abort_reason_INVALID_OPERAND: cec_abort_reason = 3;
#[doc = "!< CEC_ABORT_REASON_REFUSED"]
pub const cec_abort_reason_REFUSED: cec_abort_reason = 4;
pub const cec_analogue_broadcast_type_CABLE: cec_analogue_broadcast_type = 0;
pub const cec_analogue_broadcast_type_SATELLITE: cec_analogue_broadcast_type = 1;
Expand Down
Loading