From af8a5a8918ef42336194fb1077b008a736de7af9 Mon Sep 17 00:00:00 2001
From: Simon Ser <contact@emersion.fr>
Date: Fri, 25 Nov 2022 10:51:20 +0100
Subject: [PATCH] build: drop intermediate libraries for protocols

---
 protocols/meson.build | 27 ++-------------------------
 sway/meson.build      |  3 +--
 swaybar/meson.build   |  4 ++--
 swaynag/meson.build   |  2 +-
 4 files changed, 6 insertions(+), 30 deletions(-)

diff --git a/protocols/meson.build b/protocols/meson.build
index 0473b01fb..e6fdec7db 100644
--- a/protocols/meson.build
+++ b/protocols/meson.build
@@ -20,7 +20,6 @@ protocols = [
 ]
 
 wl_protos_src = []
-wl_protos_headers = []
 
 foreach xml : protocols
 	wl_protos_src += custom_target(
@@ -29,38 +28,16 @@ foreach xml : protocols
 		output: '@BASENAME@-protocol.c',
 		command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
 	)
-	wl_protos_headers += custom_target(
+	wl_protos_src += custom_target(
 		xml.underscorify() + '_server_h',
 		input: xml,
 		output: '@BASENAME@-protocol.h',
 		command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'],
 	)
-	wl_protos_headers += custom_target(
+	wl_protos_src += custom_target(
 		xml.underscorify() + '_client_h',
 		input: xml,
 		output: '@BASENAME@-client-protocol.h',
 		command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
 	)
 endforeach
-
-lib_client_protos = static_library(
-	'client_protos',
-	wl_protos_src + wl_protos_headers,
-	dependencies: wayland_client.partial_dependency(compile_args: true),
-)
-
-client_protos = declare_dependency(
-	link_with: lib_client_protos,
-	sources: wl_protos_headers,
-)
-
-lib_server_protos = static_library(
-	'server_protos',
-	wl_protos_src + wl_protos_headers,
-	dependencies: wayland_server.partial_dependency(compile_args: true),
-)
-
-server_protos = declare_dependency(
-	link_with: lib_server_protos,
-	sources: wl_protos_headers,
-)
diff --git a/sway/meson.build b/sway/meson.build
index 4d7dccfa8..bb6bf88c2 100644
--- a/sway/meson.build
+++ b/sway/meson.build
@@ -222,7 +222,6 @@ sway_deps = [
 	pcre2,
 	glesv2,
 	pixman,
-	server_protos,
 	threads,
 	wayland_server,
 	wlroots,
@@ -237,7 +236,7 @@ endif
 
 executable(
 	'sway',
-	sway_sources,
+	sway_sources + wl_protos_src,
 	include_directories: [sway_inc],
 	dependencies: sway_deps,
 	link_with: [lib_sway_common],
diff --git a/swaybar/meson.build b/swaybar/meson.build
index 9feb3cd2d..e5f1811eb 100644
--- a/swaybar/meson.build
+++ b/swaybar/meson.build
@@ -8,7 +8,6 @@ tray_files = have_tray ? [
 
 swaybar_deps = [
 	cairo,
-	client_protos,
 	gdk_pixbuf,
 	jsonc,
 	math,
@@ -32,7 +31,8 @@ executable(
 		'main.c',
 		'render.c',
 		'status_line.c',
-		tray_files
+		tray_files,
+		wl_protos_src,
 	],
 	include_directories: [sway_inc],
 	dependencies: swaybar_deps,
diff --git a/swaynag/meson.build b/swaynag/meson.build
index 71f2fc2d0..f238bbb51 100644
--- a/swaynag/meson.build
+++ b/swaynag/meson.build
@@ -5,11 +5,11 @@ executable(
 		'render.c',
 		'swaynag.c',
 		'types.c',
+		wl_protos_src,
 	],
 	include_directories: [sway_inc],
 	dependencies: [
 		cairo,
-		client_protos,
 		pango,
 		pangocairo,
 		wayland_client,