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 apex_available: [ 97 "//apex_available:platform", 98 "//apex_available:anyapex", 99 ], 100 defaults: [ 101 "libdrm_defaults", 102 "libdrm_sources", 103 ], 104 105 generated_headers: [ 106 "generated_static_table_fourcc_h", 107 ], 108 109 export_include_dirs: ["include/drm", "android"], 110 111 cflags: [ 112 "-Wno-enum-conversion", 113 "-Wno-pointer-arith", 114 "-Wno-sign-compare", 115 "-Wno-tautological-compare", 116 ], 117} 118 119// Rust bindings for libdrm, generated in a way compatible with drm-ffi crate. 120rust_bindgen { 121 name: "libdrm_sys", 122 crate_name: "drm_sys", 123 wrapper_src: "rust/drm_wrapper.h", 124 source_stem: "bindings", 125 bindgen_flags: [ 126 "--ctypes-prefix=core::ffi", 127 "--no-prepend-enum-name", 128 "--with-derive-default", 129 "--with-derive-hash", 130 "--with-derive-eq", 131 "--blocklist-type=drm_handle_t", 132 "--blocklist-type=__BINDGEN_TMP_.*", 133 "--blocklist-type=drm_control_DRM_ADD_COMMAND", 134 "--allowlist-type=_?DRM_.*|drm_.*|hdr_.*", 135 "--allowlist-var=_?DRM_.*|drm_.*", 136 "--constified-enum-module=drm_control_.*", 137 "--constified-enum-module=drm_buf_desc_.*", 138 "--constified-enum-module=drm_map_type", 139 "--constified-enum-module=drm_map_flags", 140 "--constified-enum-module=drm_stat_type", 141 "--constified-enum-module=drm_lock_flags", 142 "--constified-enum-module=drm_dma_flags", 143 "--constified-enum-module=drm_ctx_flags", 144 "--constified-enum-module=drm_drawable_info_type_t", 145 "--constified-enum-module=drm_vblank_seq_type", 146 "--constified-enum-module=drm_mode_subconnector", 147 ], 148 shared_libs: [ 149 "libdrm", 150 "libcutils", 151 "liblog", 152 ], 153 host_supported: true, 154 vendor_available: true, 155 product_available: true, 156 apex_available: [ 157 "//apex_available:anyapex", 158 "//apex_available:platform", 159 ], 160 visibility: [ 161 "//external/rust/android-crates-io/crates/drm-ffi", 162 ], 163} 164