summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2017-04-04 18:25:52 (GMT)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2017-04-04 18:46:48 (GMT)
commit35c4428083ddf80e67af33b959f845c593945dbc (patch)
treec192193920db057990ba419195ffe23a49ba18f9
parentbae1fe254a0f730a82cd14dfd3deab06c753a8c7 (diff)
downloadgstreamer-35c4428083ddf80e67af33b959f845c593945dbc.tar.gz
gstreamer-35c4428083ddf80e67af33b959f845c593945dbc.tar.xz
meson: Add bash completion support
-rw-r--r--data/bash-completion/helpers/meson.build9
-rw-r--r--data/meson.build5
-rw-r--r--libs/gst/helpers/meson.build12
-rw-r--r--meson.build38
4 files changed, 62 insertions, 2 deletions
diff --git a/data/bash-completion/helpers/meson.build b/data/bash-completion/helpers/meson.build
new file mode 100644
index 0000000..0a7ed7b
--- /dev/null
+++ b/data/bash-completion/helpers/meson.build
@@ -0,0 +1,9 @@
+bash_helper_conf = configuration_data()
+bash_helper_conf.set('GST_COMPLETION_HELPER_INSTALLED',
+ '@0@/@1@/gst-completion-helper'.format(prefix, helpers_install_dir))
+bash_helper_conf.set('GST_API_VERSION', apiversion)
+
+configure_file(input : 'gst.in',
+ output : 'gst',
+ install_dir : bash_helpers_dir,
+ configuration : bash_helper_conf)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..c9130e0
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,5 @@
+if (bashcomp_found)
+ subdir('bash-completion/helpers')
+ install_data('bash-completion/completions/gst-launch-1.0', install_dir : bash_completions_dir)
+ install_data('bash-completion/completions/gst-inspect-1.0', install_dir : bash_completions_dir)
+endif
diff --git a/libs/gst/helpers/meson.build b/libs/gst/helpers/meson.build
index be1a18d..fcba589 100644
--- a/libs/gst/helpers/meson.build
+++ b/libs/gst/helpers/meson.build
@@ -10,5 +10,15 @@ gst_plugin_scanner = executable('gst-plugin-scanner',
gst_scanner_dir = meson.current_build_dir()
+if bashcomp_found
+ gst_completion_helper = executable('gst-completion-helper',
+ 'gst-completion-helper.c',
+ c_args : gst_c_args,
+ include_directories : [configinc],
+ dependencies : [gobject_dep, glib_dep, gst_dep],
+ install_dir : helpers_install_dir,
+ install: true,
+ )
+endif
+
# FIXME: gst-ptp-helper
-# FIXME: gst-completion-helper
diff --git a/meson.build b/meson.build
index e7d219b..a756792 100644
--- a/meson.build
+++ b/meson.build
@@ -27,7 +27,7 @@ prefix = get_option('prefix')
libtype = get_option('library_format')
libexecdir = get_option('libexecdir')
-helpers_install_dir = libexecdir + '/gstreamer-1.0/'
+helpers_install_dir = join_paths(libexecdir, 'gstreamer-1.0')
cc = meson.get_compiler('c')
@@ -375,6 +375,41 @@ if not py3.found()
py3 = find_program('python')
endif
+bashcomp_dep = dependency('bash-completion', version : '>= 2.0', required : false)
+
+bashcomp_found = bashcomp_dep.found()
+bash_completions_dir = ''
+bash_helpers_dir = ''
+
+if bashcomp_found
+ # get_pkgconfig_variable() won't let us set the prefix
+ pkgconfig = find_program('pkg-config')
+
+ runcmd = run_command(pkgconfig,
+ '--define-variable=prefix="."',
+ '--variable=completionsdir',
+ 'bash-completion')
+
+ if (runcmd.returncode() == 0)
+ bash_completions_dir = runcmd.stdout().strip()
+ else
+ message('Found bash-completion but the .pc file did not set \'completionsdir\'.')
+ bashcomp_found = false
+ endif
+
+ runcmd = run_command(pkgconfig,
+ '--define-variable=prefix="."',
+ '--variable=helpersdir',
+ 'bash-completion')
+
+ if (runcmd.returncode() == 0)
+ bash_helpers_dir = runcmd.stdout().strip()
+ else
+ message('Found bash-completion, but the .pc file did not set \'helpersdir\'.')
+ bashcomp_found = false
+ endif
+endif
+
subdir('gst')
subdir('libs')
subdir('plugins')
@@ -382,6 +417,7 @@ subdir('tools')
subdir('pkgconfig')
subdir('tests')
subdir('po')
+subdir('data')
if build_machine.system() == 'windows'
message('Disabling gtk-doc while building on Windows')