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_freedesktop.org-MIT-license", 21 license_kinds: [ 22 "SPDX-license-identifier-MIT", 23 ], 24 license_text: ["freedesktop.org/COPYING"], 25} 26 27license { 28 name: "external_wayland-protocols_freedesktop.org-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_chromium.org-license", 37 license_kinds: [ 38 "SPDX-license-identifier-MIT", 39 ], 40 license_text: ["chromium.org/LICENSE"], 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_freedesktop.org-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/unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml", 73 "./freedesktop.org/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml", 74 "./freedesktop.org/unstable/input-method/input-method-unstable-v1.xml", 75 "./freedesktop.org/unstable/input-timestamps/input-timestamps-unstable-v1.xml", 76 "./freedesktop.org/unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml", 77 "./freedesktop.org/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml", 78 "./freedesktop.org/unstable/linux-explicit-synchronization/linux-explicit-synchronization-unstable-v1.xml", 79 "./freedesktop.org/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml", 80 "./freedesktop.org/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml", 81 "./freedesktop.org/unstable/primary-selection/primary-selection-unstable-v1.xml", 82 "./freedesktop.org/unstable/relative-pointer/relative-pointer-unstable-v1.xml", 83 "./freedesktop.org/unstable/tablet/tablet-unstable-v1.xml", 84 "./freedesktop.org/unstable/tablet/tablet-unstable-v2.xml", 85 "./freedesktop.org/unstable/text-input/text-input-unstable-v1.xml", 86 "./freedesktop.org/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml", 87 "./freedesktop.org/unstable/xdg-foreign/xdg-foreign-unstable-v1.xml", 88 "./freedesktop.org/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml", 89 "./freedesktop.org/unstable/xdg-output/xdg-output-unstable-v1.xml", 90 // Note: Conflicts with freedesktop.org/stable/xdg-shell/xdg-shell.xml 91 // "./freedesktop.org/unstable/xdg-shell/xdg-shell-unstable-v5.xml", 92 "./freedesktop.org/unstable/xdg-shell/xdg-shell-unstable-v6.xml", 93 "./freedesktop.org/unstable/xwayland-keyboard-grab/xwayland-keyboard-grab-unstable-v1.xml", 94 ], 95} 96 97// All the ISC licensed freedesktop.org defined extension protocols. 98filegroup { 99 name: "freedesktop.org-ISC-wayland_extension_protocols", 100 licenses: ["external_wayland-protocols_freedesktop.org-ISC-license"], 101 srcs: [ 102 "./freedesktop.org/unstable/text-input/text-input-unstable-v3.xml", 103 ], 104} 105 106// All the chromium.org defined extension protocols. 107filegroup { 108 name: "chromium.org-wayland_extension_protocols", 109 licenses: ["external_wayland-protocols_chromium.org-license"], 110 srcs: [ 111 "chromium.org/**/*.xml", 112 ], 113} 114 115// Allows for easy reference to all the extension protocols. 116filegroup { 117 name: "wayland_extension_protocols", 118 srcs: [ 119 ":freedesktop.org-MIT-wayland_extension_protocols", 120 ":freedesktop.org-ISC-wayland_extension_protocols", 121 ":chromium.org-wayland_extension_protocols", 122 ], 123} 124 125// Common settings for processing these protocols 126wayland_protocol_codegen_defaults { 127 name: "wayland_extension_protocol_defaults", 128 129 // All the protocol files to generate code for. 130 srcs: [":wayland_extension_protocols"], 131 132 // Use "wayland_scanner" out of external/wayland. 133 tools: ["wayland_scanner"], 134} 135 136// Generate protocol source files used by both client and server 137wayland_protocol_codegen { 138 name: "wayland_extension_protocol_sources", 139 defaults: ["wayland_extension_protocol_defaults"], 140 141 // Specifies the command to run to generate each output file for each input file. 142 cmd: "$(location wayland_scanner) private-code < $(in) > $(out)", 143 144 // There is a 1:1 correspondence between each generated output file and each source file. 145 // The output filename should use the base filename of the protocol file (no extension), and 146 // add a ".c" suffix. For example, "freedesktop.org/stable/xdg-shell/xdg-shell.xml" generates 147 // "xdg-shell.c". 148 output: "$(in).c", 149} 150 151// Generate protocol header files used by the client 152wayland_protocol_codegen { 153 name: "wayland_extension_client_protocol_headers", 154 defaults: ["wayland_extension_protocol_defaults"], 155 156 // Specifies the command to run to generate each output file for each input file. 157 cmd: "$(location wayland_scanner) client-header < $(in) > $(out)", 158 159 // There is a 1:1 correspondence between each generated output file and each source file. 160 // The output filename should use the base filename of the protocol file (no extension), and 161 // add a "-client-protocol.h" suffix. For example, 162 // "freedesktop.org/stable/xdg-shell/xdg-shell.xml" generates "xdg-shell-client-protocol.h". 163 output: "$(in)-client-protocol.h", 164} 165 166// Generate protocol header files used by the server 167wayland_protocol_codegen { 168 name: "wayland_extension_server_protocol_headers", 169 defaults: ["wayland_extension_protocol_defaults"], 170 171 // Specifies the command to run to generate each output file for each input file. 172 cmd: "$(location wayland_scanner) server-header < $(in) > $(out)", 173 174 // There is a 1:1 correspondence between each generated output file and each source file. 175 // The output filename should use the base filename of the protocol file (no extension), and 176 // add a "-server-protocol.h" suffix. For example, 177 // "freedesktop.org/stable/xdg-shell/xdg-shell.xml" generates "xdg-shell-server-protocol.h". 178 output: "$(in)-server-protocol.h", 179} 180 181// Generate a library with the protocol files, configured to export the client 182// header files 183cc_library_static { 184 name: "libwayland_extension_client_protocols", 185 vendor_available: true, 186 cflags: [ 187 "-Wall", 188 "-Wextra", 189 "-Werror", 190 "-g", 191 "-fvisibility=hidden", 192 ], 193 static_libs: ["libwayland_client_static"], 194 generated_sources: ["wayland_extension_protocol_sources"], 195 generated_headers: ["wayland_extension_client_protocol_headers"], 196 export_generated_headers: ["wayland_extension_client_protocol_headers"], 197} 198 199// Generate a library with the protocol files, configured to export the server 200// header files 201cc_library_static { 202 name: "libwayland_extension_server_protocols", 203 vendor_available: true, 204 host_supported: true, 205 cflags: [ 206 "-Wall", 207 "-Wextra", 208 "-Werror", 209 "-g", 210 "-fvisibility=hidden", 211 ], 212 static_libs: ["libwayland_server"], 213 generated_sources: ["wayland_extension_protocol_sources"], 214 generated_headers: ["wayland_extension_server_protocol_headers"], 215 export_generated_headers: ["wayland_extension_server_protocol_headers"], 216} 217