xref: /aosp_15_r20/external/wayland-protocols/Android.bp (revision 6c119a463dd5c45dd05bbe67429293292dde15ee)
1// Copyright (C) 2017 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    default_applicable_licenses: ["Android-Apache-2.0"],
17}
18
19license {
20    name: "external_wayland-protocols-MIT-license",
21    license_kinds: [
22        "SPDX-license-identifier-MIT",
23    ],
24    license_text: ["MIT_LICENSE.txt"],
25}
26
27license {
28    name: "external_wayland-protocols-ISC-license",
29    license_kinds: [
30        "SPDX-license-identifier-ISC",
31    ],
32    license_text: ["ISC_LICENSE.txt"],
33}
34
35license {
36    name: "external_wayland-protocols-BSD-license",
37    license_kinds: [
38        "SPDX-license-identifier-BSD",
39    ],
40    license_text: ["BSD_LICENSE.txt"],
41}
42
43// Build and use the "wayland_protocol_codegen" extension. This is just a bit
44// of glue code to invoke the wayland-scanner code generation tool provided by
45// the core Wayland code (external/wayland) from the Android build system.
46bootstrap_go_package {
47    name: "soong-wayland-protocol-codegen",
48    // licenses: ["Android-Apache-2.0"],
49    pkgPath: "android/soong/external/wayland-protocol",
50    deps: [
51        "blueprint",
52        "blueprint-proptools",
53        "soong-android",
54        "soong-genrule",
55    ],
56    srcs: [
57        "locations.go",
58        "wayland_protocol_codegen.go",
59    ],
60    testSrcs: ["wayland_protocol_codegen_test.go"],
61    pluginFor: ["soong_build"],
62}
63
64// All the MIT licensed freedesktop.org defined extension protocols.
65filegroup {
66    name: "freedesktop.org-MIT-wayland_extension_protocols",
67    licenses: ["external_wayland-protocols-MIT-license"],
68    srcs: [
69        "./freedesktop.org/stable/presentation-time/presentation-time.xml",
70        "./freedesktop.org/stable/viewporter/viewporter.xml",
71        "./freedesktop.org/stable/xdg-shell/xdg-shell.xml",
72        "./freedesktop.org/staging/drm-lease/drm-lease-v1.xml",
73        "./freedesktop.org/staging/xdg-activation/xdg-activation-v1.xml",
74        "./freedesktop.org/unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml",
75        "./freedesktop.org/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml",
76        "./freedesktop.org/unstable/input-method/input-method-unstable-v1.xml",
77        "./freedesktop.org/unstable/input-timestamps/input-timestamps-unstable-v1.xml",
78        "./freedesktop.org/unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml",
79        "./freedesktop.org/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml",
80        "./freedesktop.org/unstable/linux-explicit-synchronization/linux-explicit-synchronization-unstable-v1.xml",
81        "./freedesktop.org/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml",
82        "./freedesktop.org/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml",
83        "./freedesktop.org/unstable/primary-selection/primary-selection-unstable-v1.xml",
84        "./freedesktop.org/unstable/relative-pointer/relative-pointer-unstable-v1.xml",
85        "./freedesktop.org/unstable/tablet/tablet-unstable-v1.xml",
86        "./freedesktop.org/unstable/tablet/tablet-unstable-v2.xml",
87        "./freedesktop.org/unstable/text-input/text-input-unstable-v1.xml",
88        "./freedesktop.org/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml",
89        "./freedesktop.org/unstable/xdg-foreign/xdg-foreign-unstable-v1.xml",
90        "./freedesktop.org/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml",
91        "./freedesktop.org/unstable/xdg-output/xdg-output-unstable-v1.xml",
92        // Note: Conflicts with freedesktop.org/stable/xdg-shell/xdg-shell.xml
93        // "./freedesktop.org/unstable/xdg-shell/xdg-shell-unstable-v5.xml",
94        "./freedesktop.org/unstable/xdg-shell/xdg-shell-unstable-v6.xml",
95        "./freedesktop.org/unstable/xwayland-keyboard-grab/xwayland-keyboard-grab-unstable-v1.xml",
96    ],
97}
98
99// All the ISC licensed freedesktop.org defined extension protocols.
100filegroup {
101    name: "freedesktop.org-ISC-wayland_extension_protocols",
102    licenses: ["external_wayland-protocols-ISC-license"],
103    srcs: [
104        "./freedesktop.org/unstable/text-input/text-input-unstable-v3.xml",
105    ],
106}
107
108// All the BSD licensed freedesktop.org defined extension protocols.
109filegroup {
110    name: "freedesktop.org-BSD-wayland_extension_protocols",
111    licenses: ["external_wayland-protocols-BSD-license"],
112    srcs: [
113    ],
114}
115
116// All the BSD licensed chromium.org defined extension protocols.
117filegroup {
118    name: "chromium.org-wayland_extension_protocols",
119    licenses: ["external_wayland-protocols-BSD-license"],
120    srcs: [
121        "./chromium.org/components/exo/wayland/protocol/aura-output-management.xml",
122        "./chromium.org/components/exo/wayland/protocol/aura-shell.xml",
123        "./chromium.org/components/exo/wayland/protocol/chrome-color-management.xml",
124        "./chromium.org/components/exo/wayland/protocol/overlay-prioritizer.xml",
125        "./chromium.org/components/exo/wayland/protocol/surface-augmenter.xml",
126        "./chromium.org/third_party/wayland-protocols/unstable/alpha-compositing/alpha-compositing-unstable-v1.xml",
127        "./chromium.org/third_party/wayland-protocols/unstable/cursor-shapes/cursor-shapes-unstable-v1.xml",
128        "./chromium.org/third_party/wayland-protocols/unstable/extended-drag/extended-drag-unstable-v1.xml",
129        "./chromium.org/third_party/wayland-protocols/unstable/gaming-input/gaming-input-unstable-v2.xml",
130        "./chromium.org/third_party/wayland-protocols/unstable/keyboard/keyboard-configuration-unstable-v1.xml",
131        "./chromium.org/third_party/wayland-protocols/unstable/keyboard/keyboard-extension-unstable-v1.xml",
132        "./chromium.org/third_party/wayland-protocols/unstable/notification-shell/notification-shell-unstable-v1.xml",
133        "./chromium.org/third_party/wayland-protocols/unstable/remote-shell/remote-shell-unstable-v1.xml",
134        "./chromium.org/third_party/wayland-protocols/unstable/remote-shell/remote-shell-unstable-v2.xml",
135        "./chromium.org/third_party/wayland-protocols/unstable/secure-output/secure-output-unstable-v1.xml",
136        "./chromium.org/third_party/wayland-protocols/unstable/stylus-tools/stylus-tools-unstable-v1.xml",
137        "./chromium.org/third_party/wayland-protocols/unstable/stylus/stylus-unstable-v2.xml",
138        "./chromium.org/third_party/wayland-protocols/unstable/text-input/text-input-extension-unstable-v1.xml",
139        "./chromium.org/third_party/wayland-protocols/unstable/touchpad-haptics/touchpad-haptics-unstable-v1.xml",
140        "./chromium.org/third_party/wayland-protocols/unstable/ui-controls/ui-controls-unstable-v1.xml",
141        "./chromium.org/third_party/wayland-protocols/unstable/vsync-feedback/vsync-feedback-unstable-v1.xml",
142    ],
143}
144
145filegroup {
146    name: "chromium.org-MIT-wayland_extension_protocols",
147    licenses: ["external_wayland-protocols-MIT-license"],
148    srcs: [
149        "./chromium.org/third_party/wayland-protocols/unstable/content-type/content-type-v1.xml",
150        "./chromium.org/third_party/wayland-protocols/unstable/gtk-primary-selection/gtk-primary-selection.xml",
151    ],
152}
153
154// Allows for easy reference to all the extension protocols.
155filegroup {
156    name: "wayland_extension_protocols",
157    srcs: [
158        ":freedesktop.org-BSD-wayland_extension_protocols",
159        ":freedesktop.org-MIT-wayland_extension_protocols",
160        ":freedesktop.org-ISC-wayland_extension_protocols",
161        ":chromium.org-wayland_extension_protocols",
162        ":chromium.org-MIT-wayland_extension_protocols",
163    ],
164}
165
166// Common settings for processing these protocols
167wayland_protocol_codegen_defaults {
168    name: "wayland_extension_protocol_defaults",
169
170    // All the protocol files to generate code for.
171    srcs: [":wayland_extension_protocols"],
172
173    // Use "wayland_scanner" out of external/wayland.
174    tools: ["wayland_scanner"],
175}
176
177// Generate protocol source files used by both client and server
178wayland_protocol_codegen {
179    name: "wayland_extension_protocol_sources",
180    defaults: ["wayland_extension_protocol_defaults"],
181
182    // Specifies the command to run to generate each output file for each input file.
183    cmd: "$(location wayland_scanner) private-code < $(in) > $(out)",
184
185    // There is a 1:1 correspondence between each generated output file and each source file.
186    // The output filename should use the base filename of the protocol file (no extension), and
187    // add a ".c" suffix. For example, "freedesktop.org/stable/xdg-shell/xdg-shell.xml" generates
188    // "xdg-shell.c".
189    output: "$(in).c",
190}
191
192// Generate protocol header files used by the client
193wayland_protocol_codegen {
194    name: "wayland_extension_client_protocol_headers",
195    defaults: ["wayland_extension_protocol_defaults"],
196
197    // Specifies the command to run to generate each output file for each input file.
198    cmd: "$(location wayland_scanner) client-header < $(in) > $(out)",
199
200    // There is a 1:1 correspondence between each generated output file and each source file.
201    // The output filename should use the base filename of the protocol file (no extension), and
202    // add a "-client-protocol.h" suffix. For example,
203    // "freedesktop.org/stable/xdg-shell/xdg-shell.xml" generates "xdg-shell-client-protocol.h".
204    output: "$(in)-client-protocol.h",
205}
206
207// Generate protocol header files used by the server
208wayland_protocol_codegen {
209    name: "wayland_extension_server_protocol_headers",
210    defaults: ["wayland_extension_protocol_defaults"],
211
212    // Specifies the command to run to generate each output file for each input file.
213    cmd: "$(location wayland_scanner) server-header < $(in) > $(out)",
214
215    // There is a 1:1 correspondence between each generated output file and each source file.
216    // The output filename should use the base filename of the protocol file (no extension), and
217    // add a "-server-protocol.h" suffix. For example,
218    // "freedesktop.org/stable/xdg-shell/xdg-shell.xml" generates "xdg-shell-server-protocol.h".
219    output: "$(in)-server-protocol.h",
220}
221
222// Generate a library with the protocol files, configured to export the client
223// header files
224cc_library_static {
225    name: "libwayland_extension_client_protocols",
226    vendor_available: true,
227    cflags: [
228        "-Wall",
229        "-Wextra",
230        "-Werror",
231        "-g",
232        "-fvisibility=hidden",
233    ],
234    static_libs: ["libwayland_client_static"],
235    generated_sources: ["wayland_extension_protocol_sources"],
236    generated_headers: ["wayland_extension_client_protocol_headers"],
237    export_generated_headers: ["wayland_extension_client_protocol_headers"],
238}
239
240// Generate a library with the protocol files, configured to export the server
241// header files
242cc_library_static {
243    name: "libwayland_extension_server_protocols",
244    vendor_available: true,
245    host_supported: true,
246    cflags: [
247        "-Wall",
248        "-Wextra",
249        "-Werror",
250        "-g",
251        "-fvisibility=hidden",
252    ],
253    static_libs: ["libwayland_server"],
254    generated_sources: ["wayland_extension_protocol_sources"],
255    generated_headers: ["wayland_extension_server_protocol_headers"],
256    export_generated_headers: ["wayland_extension_server_protocol_headers"],
257}
258