From 71ff95a54496eda9ef567f1a4a3ed39936ddd129 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Thu, 18 Apr 2019 16:43:55 +0300 Subject: [PATCH] build: separate deps for int and ext libweston users We have two kinds of libweston users: internal and external. Weston, the frontend, counts as an external user, and should not have access to libweston private headers. The shell plugins are external users as well, because we intend people to be able to write them. Renderers, backends, and some plugins are internal users who will need access to private headers. Create two different Meson dependency objects, one for each kind. This makes it less likely to accidentally use a private header. Screen-share is a Weston plugin and therefore counts as an external user, but it needs the backend API to deliver input. Until we are comfortable exposing public API for that purpose, let it use internal headers. Signed-off-by: Pekka Paalanen --- compositor/meson.build | 11 ++++++----- desktop-shell/meson.build | 2 +- fullscreen-shell/meson.build | 2 +- ivi-shell/meson.build | 4 ++-- libweston-desktop/meson.build | 4 ++-- libweston/backend-drm/meson.build | 2 +- libweston/backend-fbdev/meson.build | 2 +- libweston/backend-headless/meson.build | 2 +- libweston/backend-rdp/meson.build | 2 +- libweston/backend-wayland/meson.build | 3 ++- libweston/backend-x11/meson.build | 2 +- libweston/meson.build | 18 +++++++++++++----- libweston/renderer-gl/meson.build | 2 +- pipewire/meson.build | 2 +- remoting/meson.build | 2 +- tests/meson.build | 6 +++--- xwayland/meson.build | 2 +- 17 files changed, 39 insertions(+), 29 deletions(-) diff --git a/compositor/meson.build b/compositor/meson.build index 5a5609a1..fa3e1558 100644 --- a/compositor/meson.build +++ b/compositor/meson.build @@ -12,7 +12,7 @@ srcs_weston = [ ] deps_weston = [ dep_libshared, - dep_libweston, + dep_libweston_public, dep_libinput, dep_libevdev, dep_libdl, @@ -62,7 +62,8 @@ if get_option('screenshare') ] deps_screenshare = [ dep_libshared, - dep_libweston, + dep_libweston_public, + dep_libweston_private_h, # XXX: https://gitlab.freedesktop.org/wayland/weston/issues/292 dep_wayland_client, ] plugin_screenshare = shared_library( @@ -94,7 +95,7 @@ if get_option('color-management-lcms') 'cms-static', srcs_lcms, include_directories: common_inc, - dependencies: [ dep_libweston, dep_lcms2 ], + dependencies: [ dep_libweston_public, dep_lcms2 ], name_prefix: '', install: true, install_dir: dir_module_weston @@ -117,7 +118,7 @@ if get_option('color-management-colord') error('cms-colord requires colord >= 0.1.27 which was not found. Or, you can use \'-Dcolor-management-colord=false\'.') endif - plugin_colord_deps = [ dep_libweston, dep_colord ] + plugin_colord_deps = [ dep_libweston_public, dep_colord ] foreach depname : [ 'glib-2.0', 'gobject-2.0' ] dep = dependency(depname, required: false) @@ -149,7 +150,7 @@ if get_option('systemd') 'systemd-notify', 'systemd-notify.c', include_directories: common_inc, - dependencies: [ dep_libweston, dep_libsystemd ], + dependencies: [ dep_libweston_public, dep_libsystemd ], name_prefix: '', install: true, install_dir: dir_module_weston diff --git a/desktop-shell/meson.build b/desktop-shell/meson.build index 9bc79c26..9d56cc40 100644 --- a/desktop-shell/meson.build +++ b/desktop-shell/meson.build @@ -13,7 +13,7 @@ if get_option('shell-desktop') deps_shell_desktop = [ dep_libshared, dep_lib_desktop, - dep_libweston, + dep_libweston_public, ] plugin_shell_desktop = shared_library( 'desktop-shell', diff --git a/fullscreen-shell/meson.build b/fullscreen-shell/meson.build index 3609f467..bde06db5 100644 --- a/fullscreen-shell/meson.build +++ b/fullscreen-shell/meson.build @@ -8,7 +8,7 @@ if get_option('shell-fullscreen') 'fullscreen-shell', srcs_shell_fullscreen, include_directories: common_inc, - dependencies: dep_libweston, + dependencies: dep_libweston_public, name_prefix: '', install: true, install_dir: dir_module_weston diff --git a/ivi-shell/meson.build b/ivi-shell/meson.build index 91ae4167..6fabe2f3 100644 --- a/ivi-shell/meson.build +++ b/ivi-shell/meson.build @@ -12,7 +12,7 @@ if get_option('shell-ivi') 'ivi-shell', srcs_shell_ivi, include_directories: common_inc, - dependencies: [ dep_lib_desktop, dep_libweston ], + dependencies: [ dep_lib_desktop, dep_libweston_public ], name_prefix: '', install: true, install_dir: dir_module_weston @@ -30,7 +30,7 @@ if get_option('shell-ivi') 'hmi-controller', srcs_ivi_hmi, include_directories: common_inc, - dependencies: [ dep_libweston, dep_libshared ], + dependencies: [ dep_libweston_public, dep_libshared ], name_prefix: '', install: true, install_dir: dir_module_weston diff --git a/libweston-desktop/meson.build b/libweston-desktop/meson.build index ac005605..0a45d941 100644 --- a/libweston-desktop/meson.build +++ b/libweston-desktop/meson.build @@ -18,11 +18,11 @@ lib_desktop = shared_library( include_directories: common_inc, install: true, version: '0.0.@0@'.format(libweston_revision), - dependencies: dep_libweston + dependencies: dep_libweston_public ) dep_lib_desktop = declare_dependency( link_with: lib_desktop, - dependencies: dep_libweston + dependencies: dep_libweston_public ) pkgconfig.generate( diff --git a/libweston/backend-drm/meson.build b/libweston/backend-drm/meson.build index 37c81fee..7e15d8f2 100644 --- a/libweston/backend-drm/meson.build +++ b/libweston/backend-drm/meson.build @@ -32,7 +32,7 @@ srcs_drm = [ ] deps_drm = [ - dep_libweston, + dep_libweston_private, dep_session_helper, dep_libdrm, dep_libinput_backend, diff --git a/libweston/backend-fbdev/meson.build b/libweston/backend-fbdev/meson.build index 62c43cc7..e7b1544c 100644 --- a/libweston/backend-fbdev/meson.build +++ b/libweston/backend-fbdev/meson.build @@ -10,7 +10,7 @@ srcs_fbdev = [ ] deps_fbdev = [ - dep_libweston, + dep_libweston_private, dep_session_helper, dep_libinput_backend, dependency('libudev', version: '>= 136'), diff --git a/libweston/backend-headless/meson.build b/libweston/backend-headless/meson.build index d2661ef1..c603bb0b 100644 --- a/libweston/backend-headless/meson.build +++ b/libweston/backend-headless/meson.build @@ -12,7 +12,7 @@ plugin_headless = shared_library( 'headless-backend', srcs_headless, include_directories: common_inc, - dependencies: dep_libweston, + dependencies: [ dep_libweston_private, dep_libdrm_headers ], name_prefix: '', install: true, install_dir: dir_module_libweston, diff --git a/libweston/backend-rdp/meson.build b/libweston/backend-rdp/meson.build index 7e27de3d..e33fe4cc 100644 --- a/libweston/backend-rdp/meson.build +++ b/libweston/backend-rdp/meson.build @@ -22,7 +22,7 @@ if cc.has_member( endif deps_rdp = [ - dep_libweston, + dep_libweston_private, dep_frdp, ] plugin_rdp = shared_library( diff --git a/libweston/backend-wayland/meson.build b/libweston/backend-wayland/meson.build index bcb3f6a3..7e82513a 100644 --- a/libweston/backend-wayland/meson.build +++ b/libweston/backend-wayland/meson.build @@ -18,7 +18,8 @@ deps_wlwl = [ dependency('wayland-client'), dependency('wayland-cursor'), dep_pixman, - dep_libweston, + dep_libweston_private, + dep_libdrm_headers, dep_lib_cairo_shared, ] diff --git a/libweston/backend-x11/meson.build b/libweston/backend-x11/meson.build index 68126737..adae2cb0 100644 --- a/libweston/backend-x11/meson.build +++ b/libweston/backend-x11/meson.build @@ -16,7 +16,7 @@ if not dep_x11_xcb.found() endif deps_x11 = [ - dep_libweston, + dep_libweston_private, dep_x11_xcb, dep_lib_cairo_shared, dep_pixman, diff --git a/libweston/meson.build b/libweston/meson.build index 19bfbedd..0f715f26 100644 --- a/libweston/meson.build +++ b/libweston/meson.build @@ -82,17 +82,25 @@ lib_weston = shared_library( dependencies: deps_libweston ) -dep_libweston = declare_dependency( +# For external users, like Weston. +dep_libweston_public = declare_dependency( + link_with: lib_weston, + include_directories: public_inc, + dependencies: deps_libweston +) + +# For internal users, like the backends. +dep_libweston_private = declare_dependency( link_with: lib_weston, include_directories: [ include_directories('.'), public_inc ], dependencies: deps_libweston ) -# XXX: We should be able to use dep_libweston.partial_dependency() instead +# XXX: We should be able to use dep_libweston_private.partial_dependency() instead # of this, but a Meson bug makes it not work. It will be fixed with # https://github.com/mesonbuild/meson/pull/5167 # in hopefully Meson 0.51. -dep_libweston_h = declare_dependency( +dep_libweston_private_h = declare_dependency( include_directories: [ include_directories('.'), public_inc ], dependencies: [ dep_pixman.partial_dependency(compile_args: true), @@ -128,7 +136,7 @@ srcs_session_helper = [ 'launcher-util.c', 'launcher-weston-launch.c', ] -deps_session_helper = [ dep_libweston_h ] +deps_session_helper = [ dep_libweston_private_h ] if get_option('backend-drm') deps_session_helper += dep_libdrm @@ -181,7 +189,7 @@ lib_libinput_backend = static_library( 'libinput-seat.c' ], dependencies: [ - dep_libweston, + dep_libweston_private, dep_libinput, dependency('libudev', version: '>= 136') ], diff --git a/libweston/renderer-gl/meson.build b/libweston/renderer-gl/meson.build index cbcbcd81..bd09aa56 100644 --- a/libweston/renderer-gl/meson.build +++ b/libweston/renderer-gl/meson.build @@ -13,7 +13,7 @@ srcs_renderer_gl = [ deps_renderer_gl = [ dep_pixman, - dep_libweston, + dep_libweston_private, dep_libdrm_headers, dep_vertex_clipping ] diff --git a/pipewire/meson.build b/pipewire/meson.build index a63d8f0b..67db61f0 100644 --- a/pipewire/meson.build +++ b/pipewire/meson.build @@ -8,7 +8,7 @@ if get_option('pipewire') depnames = [ 'libpipewire-0.2', 'libspa-0.1' ] - deps_pipewire = [ dep_libweston ] + deps_pipewire = [ dep_libweston_private ] foreach depname : depnames dep = dependency(depname, required: false) if not dep.found() diff --git a/remoting/meson.build b/remoting/meson.build index 14228660..730febb9 100644 --- a/remoting/meson.build +++ b/remoting/meson.build @@ -10,7 +10,7 @@ if get_option('remoting') 'gstreamer-app-1.0', 'gstreamer-video-1.0', 'gobject-2.0', 'glib-2.0' ] - deps_remoting = [ dep_libweston ] + deps_remoting = [ dep_libweston_private ] foreach depname : depnames dep = dependency(depname, required: false) if not dep.found() diff --git a/tests/meson.build b/tests/meson.build index 6f5d8f95..041c3b51 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -2,7 +2,7 @@ plugin_test_shell_desktop = shared_library( 'weston-test-desktop-shell', 'weston-test-desktop-shell.c', include_directories: common_inc, - dependencies: [ dep_lib_desktop, dep_libweston ], + dependencies: [ dep_lib_desktop, dep_libweston_public ], name_prefix: '', install: false ) @@ -45,7 +45,7 @@ exe_plugin_test = shared_library( weston_test_server_protocol_h, weston_test_protocol_c, include_directories: common_inc, - dependencies: [ dep_libweston ], + dependencies: [ dep_libweston_private ], name_prefix: '', install: false, ) @@ -343,7 +343,7 @@ foreach t : tests_weston_plugin endif deps_t = [ - dep_libweston, + dep_libweston_private, ] if t.length() > 2 deps_t += t.get(2) diff --git a/xwayland/meson.build b/xwayland/meson.build index d43a1bf2..896d6314 100644 --- a/xwayland/meson.build +++ b/xwayland/meson.build @@ -19,7 +19,7 @@ dep_names_xwayland = [ 'cairo-xcb', ] -deps_xwayland = [ dep_libweston ] +deps_xwayland = [ dep_libweston_public ] foreach name : dep_names_xwayland d = dependency(name, required: false)