• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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        // XXX: Consider moving these to config.h analogous to autoconf.
46        "-DMAJOR_IN_SYSMACROS=1",
47        "-DHAVE_VISIBILITY=1",
48        "-DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1",
49
50        "-Wall",
51        "-Werror",
52        "-Wno-deprecated-declarations",
53        "-Wno-format",
54        "-Wno-gnu-variable-sized-type-not-at-end",
55        "-Wno-implicit-function-declaration",
56        "-Wno-int-conversion",
57        "-Wno-missing-field-initializers",
58        "-Wno-pointer-arith",
59        "-Wno-unused-parameter",
60        "-Wno-unused-variable",
61    ],
62    export_system_include_dirs: ["."],
63}
64
65cc_library_headers {
66    name: "libdrm_headers",
67    vendor_available: true,
68    host_supported: true,
69    defaults: ["libdrm_defaults"],
70    export_include_dirs: [
71        "include/drm",
72        "android",
73    ],
74    apex_available: [
75        "//apex_available:platform",
76        "com.android.virt",
77    ],
78}
79
80// Library for the device
81cc_library {
82    name: "libdrm",
83    recovery_available: true,
84    host_supported: true,
85    vendor_available: true,
86    product_available: true,
87    apex_available: [
88        "//apex_available:platform",
89        "//apex_available:anyapex",
90    ],
91    defaults: [
92        "libdrm_defaults",
93        "libdrm_sources",
94    ],
95
96    export_include_dirs: [
97        "include/drm",
98        "android",
99    ],
100
101    cflags: [
102        "-Wno-enum-conversion",
103        "-Wno-pointer-arith",
104        "-Wno-sign-compare",
105        "-Wno-tautological-compare",
106    ],
107}
108
109// Rust bindings for libdrm, generated in a way compatible with drm-ffi crate.
110rust_bindgen {
111    name: "libdrm_sys",
112    crate_name: "drm_sys",
113    wrapper_src: "rust/drm_wrapper.h",
114    source_stem: "bindings",
115    bindgen_flags: [
116        "--ctypes-prefix=core::ffi",
117        "--no-prepend-enum-name",
118        "--with-derive-default",
119        "--with-derive-hash",
120        "--with-derive-eq",
121        "--blocklist-type=drm_handle_t",
122        "--blocklist-type=__BINDGEN_TMP_.*",
123        "--blocklist-type=drm_control_DRM_ADD_COMMAND",
124        "--allowlist-type=_?DRM_.*|drm_.*|hdr_.*",
125        "--allowlist-var=_?DRM_.*|drm_.*",
126        "--constified-enum-module=drm_control_.*",
127        "--constified-enum-module=drm_buf_desc_.*",
128        "--constified-enum-module=drm_map_type",
129        "--constified-enum-module=drm_map_flags",
130        "--constified-enum-module=drm_stat_type",
131        "--constified-enum-module=drm_lock_flags",
132        "--constified-enum-module=drm_dma_flags",
133        "--constified-enum-module=drm_ctx_flags",
134        "--constified-enum-module=drm_drawable_info_type_t",
135        "--constified-enum-module=drm_vblank_seq_type",
136        "--constified-enum-module=drm_mode_subconnector",
137    ],
138    shared_libs: [
139        "libdrm",
140        "libcutils",
141        "liblog",
142    ],
143    host_supported: true,
144    vendor_available: true,
145    product_available: true,
146    apex_available: [
147        "//apex_available:anyapex",
148        "//apex_available:platform",
149    ],
150    visibility: [
151        "//external/rust/crates/drm-ffi",
152    ],
153}
154