blob: d5e1acd38e308f0b17fee009c881481873472f18 [file] [log] [blame]
Garfield Tan64bee922017-10-11 14:19:38 -07001// 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
Bob Badourb1990862021-02-12 15:32:10 -080015package {
16 default_applicable_licenses: ["external_wayland_license"],
17}
18
19// Added automatically by a large-scale-change that took the approach of
20// 'apply every license found to every target'. While this makes sure we respect
21// every license restriction, it may not be entirely correct.
22//
23// e.g. GPL in an MIT project might only apply to the contrib/ directory.
24//
25// Please consider splitting the single license below into multiple licenses,
26// taking care not to lose any license_kind information, and overriding the
27// default license using the 'licenses: [...]' property on targets as needed.
28//
29// For unused files, consider creating a 'fileGroup' with "//visibility:private"
30// to attach the license to, and including a comment whether the files may be
31// used in the current project.
32// See: http://go/android-license-faq
33license {
34 name: "external_wayland_license",
35 visibility: [":__subpackages__"],
36 license_kinds: [
37 "SPDX-license-identifier-Apache-2.0",
38 "SPDX-license-identifier-MIT",
39 "legacy_unencumbered",
40 ],
41 license_text: [
42 "COPYING",
43 ],
44}
45
Garfield Tan64bee922017-10-11 14:19:38 -070046cc_defaults {
47 name: "wayland_defaults",
48
49 cflags: [
50 "-Wall",
51 "-Wextra",
Garfield Tan64bee922017-10-11 14:19:38 -070052 "-g",
53 "-Wstrict-prototypes",
54 "-Wmissing-prototypes",
55 "-fvisibility=hidden",
Yi Kong8daa00e2018-01-11 02:13:30 -080056 "-Wno-cast-qual",
Garfield Tan64bee922017-10-11 14:19:38 -070057 "-Wno-pointer-arith",
Yi Kong8daa00e2018-01-11 02:13:30 -080058 "-Wno-unused-parameter",
Lloyd Piqueb53eb392021-02-09 11:16:44 -080059 "-Wno-unused-variable",
Garfield Tan64bee922017-10-11 14:19:38 -070060 ],
61}
62
Lloyd Piquea107f042017-12-04 19:10:39 -080063filegroup {
64 name: "wayland_core_protocol",
65 srcs: [
66 "protocol/wayland.xml",
67 ],
68}
69
Garfield Tan64bee922017-10-11 14:19:38 -070070// Build wayland_scanner, used to generate code
71cc_binary_host {
72 name: "wayland_scanner",
73 defaults: ["wayland_defaults"],
Lloyd Piquefe6a8ac2020-03-05 14:16:54 -080074 srcs: [
75 "src/scanner.c",
76 "src/wayland-util.c",
77 ],
Garfield Tan64bee922017-10-11 14:19:38 -070078 static_libs: ["libexpat"],
Garfield Tan64bee922017-10-11 14:19:38 -070079}
80
Alistair Delvaa96d7222020-07-31 14:58:28 -070081// Generate protocol source files used by both client and server (static)
Garfield Tan64bee922017-10-11 14:19:38 -070082genrule {
Alistair Delvaa96d7222020-07-31 14:58:28 -070083 name: "wayland_core_protocol_sources_static",
Lloyd Pique049d87c2021-01-26 19:07:58 -080084 cmd: "$(location wayland_scanner) -s private-code < $(in) > $(out)",
Lloyd Piquea107f042017-12-04 19:10:39 -080085 srcs: [":wayland_core_protocol"],
Garfield Tan64bee922017-10-11 14:19:38 -070086 out: ["wayland-protocol.c"],
87 tools: ["wayland_scanner"],
88}
89
Alistair Delvaa96d7222020-07-31 14:58:28 -070090// Generate protocol source files used by both client and server (shared)
91genrule {
92 name: "wayland_core_protocol_sources_shared",
Lloyd Pique049d87c2021-01-26 19:07:58 -080093 cmd: "$(location wayland_scanner) -s public-code < $(in) > $(out)",
Alistair Delvaa96d7222020-07-31 14:58:28 -070094 srcs: [":wayland_core_protocol"],
95 out: ["wayland-protocol.c"],
96 tools: ["wayland_scanner"],
97}
98
Lloyd Piquea107f042017-12-04 19:10:39 -080099// Generate protocol header files used by the client
Garfield Tan64bee922017-10-11 14:19:38 -0700100genrule {
Lloyd Piquea107f042017-12-04 19:10:39 -0800101 name: "wayland_core_client_protocol_headers",
Lloyd Pique049d87c2021-01-26 19:07:58 -0800102 cmd: "$(location wayland_scanner) -s client-header < $(in) > $(out)",
Lloyd Piquea107f042017-12-04 19:10:39 -0800103 srcs: [":wayland_core_protocol"],
Garfield Tan64bee922017-10-11 14:19:38 -0700104 out: ["wayland-client-protocol.h"],
105 tools: ["wayland_scanner"],
106}
107
Sharif Elcott1bdd52b2018-07-25 11:51:45 +0900108// Generate protocol header files used by the server
109genrule {
110 name: "wayland_core_server_protocol_headers",
Lloyd Pique049d87c2021-01-26 19:07:58 -0800111 cmd: "$(location wayland_scanner) -s server-header < $(in) > $(out)",
Sharif Elcott1bdd52b2018-07-25 11:51:45 +0900112 srcs: [":wayland_core_protocol"],
113 out: ["wayland-server-protocol.h"],
114 tools: ["wayland_scanner"],
115}
116
Garfield Tan64bee922017-10-11 14:19:38 -0700117// Build wayland_client
Alistair Delvaa96d7222020-07-31 14:58:28 -0700118cc_defaults {
119 name: "libwayland_client_defaults",
Garfield Tan64bee922017-10-11 14:19:38 -0700120 defaults: ["wayland_defaults"],
121 srcs: [
Lloyd Piquefe6a8ac2020-03-05 14:16:54 -0800122 "src/connection.c",
123 "src/wayland-client.c",
124 "src/wayland-os.c",
125 "src/wayland-util.c",
Garfield Tan64bee922017-10-11 14:19:38 -0700126 ],
Garfield Tan64bee922017-10-11 14:19:38 -0700127 static_libs: ["libffi"],
128 local_include_dirs: ["src"],
Lloyd Piquea107f042017-12-04 19:10:39 -0800129 generated_headers: [
Lloyd Piquefe6a8ac2020-03-05 14:16:54 -0800130 "wayland_core_client_protocol_headers",
Lloyd Piquea107f042017-12-04 19:10:39 -0800131 ],
Garfield Tan64bee922017-10-11 14:19:38 -0700132 export_include_dirs: ["src"],
Lloyd Piquea107f042017-12-04 19:10:39 -0800133 export_generated_headers: [
Lloyd Piquefe6a8ac2020-03-05 14:16:54 -0800134 "wayland_core_client_protocol_headers",
Lloyd Piquea107f042017-12-04 19:10:39 -0800135 ],
Garfield Tan64bee922017-10-11 14:19:38 -0700136}
Alistair Delvaa96d7222020-07-31 14:58:28 -0700137cc_library_static {
138 name: "libwayland_client_static",
139 vendor_available: true,
140 defaults: ["libwayland_client_defaults"],
141 generated_sources: ["wayland_core_protocol_sources_static"],
Jiyong Park657f5032020-12-07 15:10:27 +0900142 apex_available: [
143 "//apex_available:platform",
144 "com.android.virt",
145 ],
Alistair Delvaa96d7222020-07-31 14:58:28 -0700146}
147cc_library_host_shared {
148 name: "libwayland_client",
149 defaults: ["libwayland_client_defaults"],
150 generated_sources: ["wayland_core_protocol_sources_shared"],
151 target: {
152 linux_glibc_x86: {
153 // libffi broken on x86, see b/162610242
154 enabled: false,
155 },
156 },
157}
Sharif Elcott1bdd52b2018-07-25 11:51:45 +0900158
159// Build wayland_server
160cc_library_static {
161 name: "libwayland_server",
162 vendor_available: true,
Jason Macnake5b8a152019-11-20 14:47:09 -0800163 host_supported: true,
Sharif Elcott1bdd52b2018-07-25 11:51:45 +0900164 defaults: ["wayland_defaults"],
165 srcs: [
166 "src/connection.c",
167 "src/wayland-os.c",
168 "src/wayland-util.c",
169 "src/wayland-server.c",
170 "src/wayland-shm.c",
171 "src/event-loop.c",
172 ],
Alistair Delvaa96d7222020-07-31 14:58:28 -0700173 generated_sources: ["wayland_core_protocol_sources_static"],
Sharif Elcott1bdd52b2018-07-25 11:51:45 +0900174 static_libs: ["libffi"],
175 local_include_dirs: ["src"],
176 generated_headers: [
Sharif Elcott1bdd52b2018-07-25 11:51:45 +0900177 "wayland_core_server_protocol_headers",
178 ],
179 export_include_dirs: ["src"],
180 export_generated_headers: [
Sharif Elcott1bdd52b2018-07-25 11:51:45 +0900181 "wayland_core_server_protocol_headers",
182 ],
183}