1// 2// Copyright © 2011-2012 Intel Corporation 3// 4// Permission is hereby granted, free of charge, to any person obtaining a 5// copy of this software and associated documentation files (the "Software"), 6// to deal in the Software without restriction, including without limitation 7// the rights to use, copy, modify, merge, publish, distribute, sublicense, 8// and/or sell copies of the Software, and to permit persons to whom the 9// Software is furnished to do so, subject to the following conditions: 10// 11// The above copyright notice and this permission notice (including the next 12// paragraph) shall be included in all copies or substantial portions of the 13// Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22// 23 24package { 25 default_applicable_licenses: ["external_libdrm_license"], 26} 27 28license { 29 name: "external_libdrm_license", 30 visibility: [":__subpackages__"], 31 license_kinds: [ 32 "SPDX-license-identifier-BSD", 33 "SPDX-license-identifier-MIT", 34 "legacy_unencumbered", 35 ], 36 license_text: ["LICENSE"], 37} 38 39subdirs = ["*"] 40build = ["Android.sources.bp"] 41 42cc_defaults { 43 name: "libdrm_defaults", 44 cflags: [ 45 "-D_GNU_SOURCE", 46 47 // XXX: Consider moving these to config.h analogous to autoconf. 48 "-DMAJOR_IN_SYSMACROS=1", 49 "-DHAVE_VISIBILITY=1", 50 "-DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1", 51 52 "-Wall", 53 "-Werror", 54 "-Wno-deprecated-declarations", 55 "-Wno-format", 56 "-Wno-gnu-variable-sized-type-not-at-end", 57 "-Wno-int-conversion", 58 "-Wno-missing-field-initializers", 59 "-Wno-pointer-arith", 60 "-Wno-unused-parameter", 61 "-Wno-unused-variable", 62 ], 63 export_system_include_dirs: ["."], 64} 65 66cc_library_headers { 67 name: "libdrm_headers", 68 vendor_available: true, 69 host_supported: true, 70 defaults: ["libdrm_defaults"], 71 export_include_dirs: [ 72 "include/drm", 73 "android", 74 ], 75 apex_available: [ 76 "//apex_available:platform", 77 "com.android.virt", 78 ], 79} 80 81genrule { 82 name: "generated_static_table_fourcc_h", 83 out: ["generated_static_table_fourcc.h"], 84 srcs: ["include/drm/drm_fourcc.h"], 85 tool_files: ["gen_table_fourcc.py"], 86 cmd: "python3 $(location gen_table_fourcc.py) $(in) $(out)", 87} 88 89// Library for the device 90cc_library { 91 name: "libdrm", 92 recovery_available: true, 93 host_supported: true, 94 vendor_available: true, 95 product_available: true, 96 min_sdk_version: "34", 97 apex_available: [ 98 "//apex_available:platform", 99 "//apex_available:anyapex", 100 ], 101 defaults: [ 102 "libdrm_defaults", 103 "libdrm_sources", 104 ], 105 106 generated_headers: [ 107 "generated_static_table_fourcc_h", 108 ], 109 110 export_include_dirs: [ 111 "include/drm", 112 "android", 113 ], 114 115 cflags: [ 116 "-Wno-enum-conversion", 117 "-Wno-pointer-arith", 118 "-Wno-sign-compare", 119 "-Wno-tautological-compare", 120 ], 121} 122 123// Rust bindings for libdrm, generated in a way compatible with drm-ffi crate. 124rust_bindgen { 125 name: "libdrm_sys", 126 crate_name: "drm_sys", 127 wrapper_src: "rust/drm_wrapper.h", 128 source_stem: "bindings", 129 bindgen_flags: [ 130 "--ctypes-prefix=core::ffi", 131 "--no-prepend-enum-name", 132 "--with-derive-default", 133 "--with-derive-hash", 134 "--with-derive-eq", 135 "--blocklist-type=drm_handle_t", 136 "--blocklist-type=__BINDGEN_TMP_.*", 137 "--blocklist-type=drm_control_DRM_ADD_COMMAND", 138 "--allowlist-type=_?DRM_.*|drm_.*|hdr_.*", 139 "--allowlist-var=_?DRM_.*|drm_.*", 140 "--constified-enum-module=drm_control_.*", 141 "--constified-enum-module=drm_buf_desc_.*", 142 "--constified-enum-module=drm_map_type", 143 "--constified-enum-module=drm_map_flags", 144 "--constified-enum-module=drm_stat_type", 145 "--constified-enum-module=drm_lock_flags", 146 "--constified-enum-module=drm_dma_flags", 147 "--constified-enum-module=drm_ctx_flags", 148 "--constified-enum-module=drm_drawable_info_type_t", 149 "--constified-enum-module=drm_vblank_seq_type", 150 "--constified-enum-module=drm_mode_subconnector", 151 ], 152 shared_libs: [ 153 "libdrm", 154 "libcutils", 155 "liblog", 156 ], 157 host_supported: true, 158 vendor_available: true, 159 product_available: true, 160 apex_available: [ 161 "//apex_available:anyapex", 162 "//apex_available:platform", 163 ], 164 visibility: [ 165 "//external/rust/android-crates-io/crates/drm-ffi", 166 ], 167} 168