# HG changeset patch
# Node ID fad71687a62f
# Parent  14c93dd6e1d1
diff --git a/finch/plugins/meson.build b/finch/plugins/meson.build
--- a/finch/plugins/meson.build
+++ b/finch/plugins/meson.build
@@ -31,3 +31,4 @@ grouping = library('grouping', 'grouping
     name_prefix : '',
     install : true, install_dir : FINCH_PLUGINDIR)
 
+devenv.append('FINCH_PLUGIN_PATH', meson.current_build_dir())
diff --git a/libpurple/plugins/keyrings/kwallet/meson.build b/libpurple/plugins/keyrings/kwallet/meson.build
--- a/libpurple/plugins/keyrings/kwallet/meson.build
+++ b/libpurple/plugins/keyrings/kwallet/meson.build
@@ -14,5 +14,6 @@ if kwallet.found()
 	    dependencies : [kwallet, qt5_dep, libpurple_dep],
 	    name_prefix : '',
 	    install : true, install_dir : PURPLE_PLUGINDIR)
+
+	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
 endif
-
diff --git a/libpurple/plugins/keyrings/meson.build b/libpurple/plugins/keyrings/meson.build
--- a/libpurple/plugins/keyrings/meson.build
+++ b/libpurple/plugins/keyrings/meson.build
@@ -22,3 +22,6 @@ if IS_WIN32
 	    install : true, install_dir : PURPLE_PLUGINDIR)
 endif
 
+if nettle.found() or secretservice.found() or IS_WIN32
+	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
+endif
diff --git a/libpurple/plugins/meson.build b/libpurple/plugins/meson.build
--- a/libpurple/plugins/meson.build
+++ b/libpurple/plugins/meson.build
@@ -40,3 +40,5 @@ purple_toast = library('purple-toast', '
 	dependencies : [libpurple_dep],
 	name_prefix: '',
 	install : true, install_dir : PURPLE_PLUGINDIR)
+
+devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
diff --git a/libpurple/plugins/notification-sound/meson.build b/libpurple/plugins/notification-sound/meson.build
--- a/libpurple/plugins/notification-sound/meson.build
+++ b/libpurple/plugins/notification-sound/meson.build
@@ -5,5 +5,6 @@ if target_machine.system() != 'windows'
 		dependencies : [libpurple_dep, glib, CANBERRA],
 		name_prefix : '',
 		install : true, install_dir : PURPLE_PLUGINDIR)
+
+	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
 endif
-
diff --git a/libpurple/protocols/bonjour/meson.build b/libpurple/protocols/bonjour/meson.build
--- a/libpurple/protocols/bonjour/meson.build
+++ b/libpurple/protocols/bonjour/meson.build
@@ -30,4 +30,6 @@ if DYNAMIC_BONJOUR
 	    link_args : bonjour_link_args,
 	    dependencies : [libxml, avahi, libpurple_dep, glib, nice, ws2_32],
 	    install : true, install_dir : PURPLE_PLUGINDIR)
+
+	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
 endif
diff --git a/libpurple/protocols/facebook/meson.build b/libpurple/protocols/facebook/meson.build
--- a/libpurple/protocols/facebook/meson.build
+++ b/libpurple/protocols/facebook/meson.build
@@ -28,4 +28,6 @@ if DYNAMIC_FACEBOOK
 	facebook_dep = declare_dependency(
 	    link_with : facebook_prpl,
 	    dependencies : [json, libpurple_dep, glib])
+
+	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
 endif
diff --git a/libpurple/protocols/gg/meson.build b/libpurple/protocols/gg/meson.build
--- a/libpurple/protocols/gg/meson.build
+++ b/libpurple/protocols/gg/meson.build
@@ -53,4 +53,6 @@ if DYNAMIC_GG
 	gg_prpl = shared_library('gg', GG_SOURCES,
 	    dependencies : [libgadu, json, libpurple_dep, libsoup, glib],
 	    install : true, install_dir : PURPLE_PLUGINDIR)
+
+	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
 endif
diff --git a/libpurple/protocols/irc/meson.build b/libpurple/protocols/irc/meson.build
--- a/libpurple/protocols/irc/meson.build
+++ b/libpurple/protocols/irc/meson.build
@@ -17,4 +17,6 @@ if DYNAMIC_IRC
 	irc_prpl = shared_library('irc', IRC_SOURCES,
 	    dependencies : [sasl, libpurple_dep, glib, gio, ws2_32],
 	    install : true, install_dir : PURPLE_PLUGINDIR)
+
+	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
 endif
diff --git a/libpurple/protocols/jabber/meson.build b/libpurple/protocols/jabber/meson.build
--- a/libpurple/protocols/jabber/meson.build
+++ b/libpurple/protocols/jabber/meson.build
@@ -96,5 +96,7 @@ if DYNAMIC_JABBER
 	    dependencies : [gstreamer, idn, libxml, sasl, libpurple_dep, libsoup, glib, gio, math, nice, ws2_32],
 	    install : true, install_dir : PURPLE_PLUGINDIR)
 
+	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
+
 	subdir('tests')
 endif
diff --git a/libpurple/protocols/novell/meson.build b/libpurple/protocols/novell/meson.build
--- a/libpurple/protocols/novell/meson.build
+++ b/libpurple/protocols/novell/meson.build
@@ -27,4 +27,6 @@ if DYNAMIC_NOVELL
 	novell_prpl = shared_library('novell', NOVELL_SOURCES,
 	    dependencies : [libpurple_dep, glib, ws2_32],
 	    install : true, install_dir : PURPLE_PLUGINDIR)
+
+	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
 endif
diff --git a/libpurple/protocols/null/meson.build b/libpurple/protocols/null/meson.build
--- a/libpurple/protocols/null/meson.build
+++ b/libpurple/protocols/null/meson.build
@@ -8,4 +8,6 @@ if DYNAMIC_NULL
 	null_prpl = shared_library('null', NULL_SOURCES,
 	    dependencies : [libpurple_dep, glib],
 	    install : false, install_dir : PURPLE_PLUGINDIR)
+
+	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
 endif
diff --git a/libpurple/protocols/sametime/meson.build b/libpurple/protocols/sametime/meson.build
--- a/libpurple/protocols/sametime/meson.build
+++ b/libpurple/protocols/sametime/meson.build
@@ -11,5 +11,7 @@ if DYNAMIC_SAMETIME
 	    dependencies : [meanwhile, gmime, libpurple_dep, glib],
 	    install : true, install_dir : PURPLE_PLUGINDIR)
 
+	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
+
 	subdir('tests')
 endif
diff --git a/libpurple/protocols/silc/meson.build b/libpurple/protocols/silc/meson.build
--- a/libpurple/protocols/silc/meson.build
+++ b/libpurple/protocols/silc/meson.build
@@ -16,4 +16,6 @@ if DYNAMIC_SILC
 	silc_prpl = shared_library('silcpurple', SILC_SOURCES,
 	    dependencies : [silc, libpurple_dep, glib],
 	    install : true, install_dir : PURPLE_PLUGINDIR)
+
+	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
 endif
diff --git a/libpurple/protocols/zephyr/meson.build b/libpurple/protocols/zephyr/meson.build
--- a/libpurple/protocols/zephyr/meson.build
+++ b/libpurple/protocols/zephyr/meson.build
@@ -74,4 +74,6 @@ if DYNAMIC_ZEPHYR
 	    c_args : '-Dlint',
 	    dependencies : [extdep, libpurple_dep, glib],
 	    install : true, install_dir : PURPLE_PLUGINDIR)
+
+	devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
 endif
diff --git a/meson.build b/meson.build
--- a/meson.build
+++ b/meson.build
@@ -75,6 +75,9 @@ package_revision = vcs_tag(
     output : 'package_revision.h',
     fallback : meson.project_version())
 
+# For running `meson devenv`.
+devenv = environment()
+
 # For man pages.
 man_conf.set('VERSION', meson.project_version())
 man_conf.set('prefix', get_option('prefix'))
@@ -666,6 +669,16 @@ subdir('po')
 configure_file(output : 'config.h',
     configuration : conf)
 
+if meson.version().version_compare('>=0.58.0')
+	config_home = get_option('devenv-config-dir')
+	if config_home == ''
+		config_home = meson.build_root() / 'config'
+	endif
+	devenv.set('XDG_CONFIG_HOME', config_home)
+
+	meson.add_devenv(devenv)
+endif
+
 summary({
     'prefix': get_option('prefix'),
     'bindir': get_option('bindir'),
diff --git a/meson_options.txt b/meson_options.txt
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,6 +1,9 @@
 ##############################################################################
 # General Options
 
+option('devenv-config-dir', type : 'string',
+       description : 'config directory for running a devenv (defaults to a subdirectory of buildroot)')
+
 option('doc', type : 'boolean', value : false,
        description : 'build documentation with gtk-doc')
 
diff --git a/pidgin/data/meson.build b/pidgin/data/meson.build
--- a/pidgin/data/meson.build
+++ b/pidgin/data/meson.build
@@ -1,3 +1,5 @@
 if INSTALL_PIXMAPS
 	subdir('icons')
 endif
+
+devenv.prepend('XDG_DATA_DIRS', meson.current_source_dir())
diff --git a/pidgin/plugins/disco/meson.build b/pidgin/plugins/disco/meson.build
--- a/pidgin/plugins/disco/meson.build
+++ b/pidgin/plugins/disco/meson.build
@@ -16,3 +16,4 @@ xmppdisco = library('xmppdisco', xmppdis
     name_prefix : '',
     install : true, install_dir : PIDGIN_PLUGINDIR)
 
+devenv.append('PIDGIN_PLUGIN_PATH', meson.current_build_dir())
diff --git a/pidgin/plugins/gestures/meson.build b/pidgin/plugins/gestures/meson.build
--- a/pidgin/plugins/gestures/meson.build
+++ b/pidgin/plugins/gestures/meson.build
@@ -11,3 +11,4 @@ gestures = library('gestures', gestures_
     name_prefix : '',
     install : true, install_dir : PIDGIN_PLUGINDIR)
 
+devenv.append('PIDGIN_PLUGIN_PATH', meson.current_build_dir())
diff --git a/pidgin/plugins/meson.build b/pidgin/plugins/meson.build
--- a/pidgin/plugins/meson.build
+++ b/pidgin/plugins/meson.build
@@ -43,3 +43,4 @@ if enable_unity
 	    install : true, install_dir : PIDGIN_PLUGINDIR)
 endif
 
+devenv.append('PIDGIN_PLUGIN_PATH', meson.current_build_dir())
diff --git a/pidgin/plugins/xmppconsole/meson.build b/pidgin/plugins/xmppconsole/meson.build
--- a/pidgin/plugins/xmppconsole/meson.build
+++ b/pidgin/plugins/xmppconsole/meson.build
@@ -8,3 +8,4 @@ library('xmppconsole',
     name_prefix : '',
     install : true, install_dir : PIDGIN_PLUGINDIR)
 
+devenv.append('PIDGIN_PLUGIN_PATH', meson.current_build_dir())
