build: separate deps for int and ext libweston users
authorPekka Paalanen <pekka.paalanen@collabora.com>
Thu, 18 Apr 2019 13:43:55 +0000 (16:43 +0300)
committerPekka Paalanen <pekka.paalanen@collabora.com>
Thu, 24 Oct 2019 10:29:33 +0000 (13:29 +0300)
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 <pekka.paalanen@collabora.com>
17 files changed:
compositor/meson.build
desktop-shell/meson.build
fullscreen-shell/meson.build
ivi-shell/meson.build
libweston-desktop/meson.build
libweston/backend-drm/meson.build
libweston/backend-fbdev/meson.build
libweston/backend-headless/meson.build
libweston/backend-rdp/meson.build
libweston/backend-wayland/meson.build
libweston/backend-x11/meson.build
libweston/meson.build
libweston/renderer-gl/meson.build
pipewire/meson.build
remoting/meson.build
tests/meson.build
xwayland/meson.build

index 5a5609a1922a2dab72ea53f3710f2daa7ae5091b..fa3e15585537c620b46319c007def2b9bee6fc7d 100644 (file)
@@ -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
index 9bc79c2651f2bf7a05af173e31560342454ab696..9d56cc40729ec592bd68ef6a486f0adf7686d894 100644 (file)
@@ -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',
index 3609f467a8241a19cb9dd5eae32762f2d8bf2e2d..bde06db5ccb83f114b5bb59fd7f472ce43d81fc3 100644 (file)
@@ -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
index 91ae4167bb932a774fdc7d193df3dbee3b43fb74..6fabe2f3ae743df53c317664f784c6121dc20bd1 100644 (file)
@@ -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
index ac00560573cd9136bb3e284339a9e687636ab0d8..0a45d941ad389be4934e288c3cbde3b10246b24a 100644 (file)
@@ -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(
index 37c81feeb1130fadf592111f8bcff5ee613c6afb..7e15d8f22877740eb31fee701e560581c687fa5f 100644 (file)
@@ -32,7 +32,7 @@ srcs_drm = [
 ]
 
 deps_drm = [
-       dep_libweston,
+       dep_libweston_private,
        dep_session_helper,
        dep_libdrm,
        dep_libinput_backend,
index 62c43cc7069053427662d86c52a2ec63e2012096..e7b1544cda0d51399ce59ea675029114abdc844c 100644 (file)
@@ -10,7 +10,7 @@ srcs_fbdev = [
 ]
 
 deps_fbdev = [
-       dep_libweston,
+       dep_libweston_private,
        dep_session_helper,
        dep_libinput_backend,
        dependency('libudev', version: '>= 136'),
index d2661ef15aef7a2762e0555727b2c5f7fb5db7f2..c603bb0bb84cf79e5e76b72acb991300b0c8af86 100644 (file)
@@ -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,
index 7e27de3d150533bbd6f45ad48c777ca1b89752e9..e33fe4cc0430963284a6afe960bbeceb2ec602a4 100644 (file)
@@ -22,7 +22,7 @@ if cc.has_member(
 endif
 
 deps_rdp = [
-       dep_libweston,
+       dep_libweston_private,
        dep_frdp,
 ]
 plugin_rdp = shared_library(
index bcb3f6a3ec82cb95a5de904bf6bf7b593e67a854..7e82513a3134dee8b06be42b42bf0e6fa6730c17 100644 (file)
@@ -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,
 ]
 
index 681267376f74d11fc747b3743a54b581951e8b6e..adae2cb08b35c364f9e51865f8e97752df396b29 100644 (file)
@@ -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,
index 19bfbedd41f3d82f7e1bcc69fb4e128089e2b1c2..0f715f26ff871fde5bc49ff731e7bf47de4a2d3d 100644 (file)
@@ -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')
        ],
index cbcbcd81c4270bba1960a4ddf598b4c24b398d01..bd09aa56487d8e2e9c62e4cb1bb0a652953a3338 100644 (file)
@@ -13,7 +13,7 @@ srcs_renderer_gl = [
 
 deps_renderer_gl = [
        dep_pixman,
-       dep_libweston,
+       dep_libweston_private,
        dep_libdrm_headers,
        dep_vertex_clipping
 ]
index a63d8f0bfd5259edf0f9bfab7701d113f6b16cb0..67db61f0777325695864db2bc6cf94145ed5564d 100644 (file)
@@ -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()
index 1422866012ab05119feb076c98e90dc0f88654c0..730febb935b9bb8621b169ddecddbfc1bb4de490 100644 (file)
@@ -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()
index 6f5d8f95a3d5d616e2ac67d14037fe502b738f38..041c3b510fafbf5e0f5dfee0cc39c55a25d60c9e 100644 (file)
@@ -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)
index d43a1bf2f54435950145b5888482ad37beee27fc..896d6314b7451818e9140f2c3c7da7b08080cd15 100644 (file)
@@ -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)