Skip to content

Commit a93af20

Browse files
meson: Improve devenv support (#2666)
* meson: Improve devenv support `meson devenv -C build` allows entering a build folder with all environment variables prepared for easy execution without system-wide installation, automatically fixes things like the LD_LIBRARY_PATH. Wayfire's plugin and backend loader systems rely on their own path discovery and configuration that devenv is unaware of, and so wayfire cannot launch out of the box in a devenv. Adjust meson build files to augment WAYFIRE_PLUGIN_PATH and WAYFIRE_PLUGIN_XML_PATH so that plugins and XML files work by default. Add the WAYFIRE_DEFAULT_CONFIG_BACKEND environment variable to allow the devenv to provide a default for that as well, as it does not live together with the plugins. With this, running wayfire straight from the repository is as simple as: meson setup build ninja -C build meson devenv -C build ./src/wayfire
1 parent 7091f03 commit a93af20

File tree

4 files changed

+37
-15
lines changed

4 files changed

+37
-15
lines changed

metadata/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,7 @@ install_data('wsets.xml', install_dir: conf_data.get('PLUGIN_XML_DIR'))
4343
install_data('wayfire-shell.xml', install_dir: conf_data.get('PLUGIN_XML_DIR'))
4444
install_data('xdg-activation.xml', install_dir: conf_data.get('PLUGIN_XML_DIR'))
4545
install_data('session-lock.xml', install_dir: conf_data.get('PLUGIN_XML_DIR'))
46+
47+
devenv = environment()
48+
devenv.append('WAYFIRE_PLUGIN_XML_PATH', meson.current_source_dir())
49+
meson.add_devenv(devenv)

plugins/meson.build

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,27 @@ endif
5252
wobbly_inc = include_directories('wobbly/')
5353
subdir('common')
5454

55-
subdir('ipc')
56-
subdir('protocols')
57-
subdir('vswitch')
58-
subdir('wobbly')
59-
subdir('grid')
60-
subdir('decor')
61-
subdir('animate')
62-
subdir('cube')
63-
subdir('window-rules')
64-
subdir('blur')
65-
subdir('tile')
66-
subdir('wm-actions')
67-
subdir('scale')
68-
subdir('single_plugins')
69-
subdir('ipc-rules')
55+
plugins = [
56+
'ipc',
57+
'protocols',
58+
'vswitch',
59+
'wobbly',
60+
'grid',
61+
'decor',
62+
'animate',
63+
'cube',
64+
'window-rules',
65+
'blur',
66+
'tile',
67+
'wm-actions',
68+
'scale',
69+
'single_plugins',
70+
'ipc-rules',
71+
]
72+
73+
devenv = environment()
74+
foreach plugin : plugins
75+
devenv.append('WAYFIRE_PLUGIN_PATH', meson.current_build_dir() + '/' + plugin)
76+
subdir(plugin)
77+
endforeach
78+
meson.add_devenv(devenv)

src/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ int main(int argc, char *argv[])
286286
std::vector<std::string> extended_debug_categories;
287287
bool allow_root = false;
288288

289+
if (char *default_config_backend = getenv("WAYFIRE_DEFAULT_CONFIG_BACKEND"))
290+
{
291+
config_backend = default_config_backend;
292+
}
293+
289294
int c, i;
290295
while ((c = getopt_long(argc, argv, "c:B:d::DhRlrv", opts, &i)) != -1)
291296
{

src/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,7 @@ pkgconfig.generate(
166166
'icondir=${prefix}/share/wayfire/icons',
167167
'pkgdatadir='+pkgdatadir]
168168
)
169+
170+
devenv = environment()
171+
devenv.set('WAYFIRE_DEFAULT_CONFIG_BACKEND', meson.current_build_dir() + '/libdefault-config-backend.so')
172+
meson.add_devenv(devenv)

0 commit comments

Comments
 (0)