15a5110d2SManos Pitsidianakis // Copyright 2024, Linaro Limited 25a5110d2SManos Pitsidianakis // Author(s): Manos Pitsidianakis <manos.pitsidianakis@linaro.org> 35a5110d2SManos Pitsidianakis // SPDX-License-Identifier: GPL-2.0-or-later 45a5110d2SManos Pitsidianakis 55a5110d2SManos Pitsidianakis use std::path::Path; 65a5110d2SManos Pitsidianakis 7*f3518400SJunjie Mao use version_check as rustc; 8*f3518400SJunjie Mao main()95a5110d2SManos Pitsidianakisfn main() { 105a5110d2SManos Pitsidianakis if !Path::new("src/bindings.rs").exists() { 115a5110d2SManos Pitsidianakis panic!( 125a5110d2SManos Pitsidianakis "No generated C bindings found! Either build them manually with bindgen or with meson \ 135a5110d2SManos Pitsidianakis (`ninja bindings.rs`) and copy them to src/bindings.rs, or build through meson." 145a5110d2SManos Pitsidianakis ); 155a5110d2SManos Pitsidianakis } 16*f3518400SJunjie Mao 17*f3518400SJunjie Mao // Check for available rustc features 18*f3518400SJunjie Mao if rustc::is_min_version("1.77.0").unwrap_or(false) { 19*f3518400SJunjie Mao println!("cargo:rustc-cfg=has_offset_of"); 20*f3518400SJunjie Mao } 21*f3518400SJunjie Mao 22*f3518400SJunjie Mao println!("cargo:rerun-if-changed=build.rs"); 235a5110d2SManos Pitsidianakis } 24