1// Copyright 2023 The Android Open Source Project 2 3package { 4 default_applicable_licenses: ["Android-Apache-2.0"], 5} 6 7rust_bindgen { 8 name: "libbootimg_bindgen", 9 wrapper_src: "bindgen/bootimg.hpp", 10 crate_name: "bootimg_bindgen", 11 edition: "2021", 12 source_stem: "bindings", 13 bindgen_flags: [ 14 "--ctypes-prefix=core::ffi", 15 "--use-core", 16 "--with-derive-default", 17 "--blocklist-type=__.+|.?int.+", 18 "--blocklist-item=_.+|.?INT.+|PTR.+|ATOMIC.+|.+SOURCE|.+_H|SIG_.+|SIZE_.+|.?CHAR.+", 19 "--with-derive-custom-struct=(vendor_)?(boot_img_hdr|ramdisk_table_entry)_v\\d+=AsBytes,FromBytes,FromZeroes,PartialEq,Copy,Clone,Debug", 20 "--raw-line=use zerocopy::{AsBytes, FromBytes, FromZeroes};", 21 ], 22 header_libs: ["bootimg_headers"], 23 rustlibs: ["libzerocopy"], 24 vendor_available: true, 25 host_supported: true, 26} 27 28rust_defaults { 29 name: "libbootimg_defaults", 30 srcs: ["bootimg.rs"], 31 rustlibs: [ 32 "libzerocopy", 33 "libbootimg_bindgen", 34 ], 35} 36 37rust_library { 38 name: "libbootimg", 39 crate_name: "bootimg", 40 vendor_available: true, 41 host_supported: true, 42 defaults: ["libbootimg_defaults"], 43} 44 45rust_test_host { 46 name: "libbootimg_tests", 47 auto_gen_config: true, 48 defaults: ["libbootimg_defaults"], 49} 50