mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
meson: check for libcap via pkg-config
It's possible that setcap is installed, but the libcap headers/libs aren't (e.g. during cross compilation, when you have the program installed for the host, but need the headers of the target). Also removes the need to manually check for the libcap headers.
This commit is contained in:
parent
f57e79a073
commit
cc9c3c3175
1 changed files with 7 additions and 13 deletions
|
@ -64,16 +64,8 @@ if have_ptp
|
||||||
description : 'getifaddrs() and AF_LINK is available')
|
description : 'getifaddrs() and AF_LINK is available')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
gst_ptp_have_cap = false
|
setcap_prog = find_program('setcap', '/usr/sbin/setcap', '/sbin/setcap', required : false)
|
||||||
cap_dep = []
|
cap_dep = dependency('libcap', required: false)
|
||||||
if cc.has_header('sys/capability.h')
|
|
||||||
cap_dep = cc.find_library('cap', required : false)
|
|
||||||
if cap_dep.found() and cc.has_function('cap_init', dependencies : cap_dep)
|
|
||||||
gst_ptp_have_cap = true
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
setcap = find_program('setcap', '/usr/sbin/setcap', '/sbin/setcap', required : false)
|
|
||||||
|
|
||||||
# user/group to change to in gst-ptp-helper
|
# user/group to change to in gst-ptp-helper
|
||||||
ptp_helper_setuid_user = get_option('ptp-helper-setuid-user')
|
ptp_helper_setuid_user = get_option('ptp-helper-setuid-user')
|
||||||
|
@ -90,7 +82,7 @@ if have_ptp
|
||||||
# how to install gst-ptp-helper
|
# how to install gst-ptp-helper
|
||||||
with_ptp_helper_permissions = get_option('ptp-helper-permissions')
|
with_ptp_helper_permissions = get_option('ptp-helper-permissions')
|
||||||
if with_ptp_helper_permissions == 'auto'
|
if with_ptp_helper_permissions == 'auto'
|
||||||
if gst_ptp_have_cap and setcap.found()
|
if setcap_prog.found() and cap_dep.found()
|
||||||
with_ptp_helper_permissions = 'capabilities'
|
with_ptp_helper_permissions = 'capabilities'
|
||||||
else
|
else
|
||||||
with_ptp_helper_permissions = 'setuid-root'
|
with_ptp_helper_permissions = 'setuid-root'
|
||||||
|
@ -104,8 +96,10 @@ if have_ptp
|
||||||
cdata.set('HAVE_PTP_HELPER_SETUID', 1,
|
cdata.set('HAVE_PTP_HELPER_SETUID', 1,
|
||||||
description : 'Use setuid-root for permissions in PTP helper')
|
description : 'Use setuid-root for permissions in PTP helper')
|
||||||
elif with_ptp_helper_permissions == 'capabilities'
|
elif with_ptp_helper_permissions == 'capabilities'
|
||||||
if not setcap.found()
|
if not setcap_prog.found()
|
||||||
error('capabilities-based ptp-helper-permissions requested, but could not find setcap tool.')
|
error('capabilities-based ptp-helper-permissions requested, but could not find setcap tool.')
|
||||||
|
elif not cap_dep.found()
|
||||||
|
error('capabilities-based ptp-helper-permissions requested, but could not find libcap.')
|
||||||
endif
|
endif
|
||||||
cdata.set('HAVE_PTP_HELPER_CAPABILITIES', 1,
|
cdata.set('HAVE_PTP_HELPER_CAPABILITIES', 1,
|
||||||
description : 'Use capabilities for permissions in PTP helper')
|
description : 'Use capabilities for permissions in PTP helper')
|
||||||
|
@ -122,7 +116,7 @@ if have_ptp
|
||||||
|
|
||||||
meson.add_install_script('ptp_helper_post_install.sh',
|
meson.add_install_script('ptp_helper_post_install.sh',
|
||||||
helpers_install_dir, with_ptp_helper_permissions,
|
helpers_install_dir, with_ptp_helper_permissions,
|
||||||
setcap.found() ? setcap.path() : '')
|
setcap_prog.found() ? setcap_prog.path() : '')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
install_data(['gst_gdb.py', 'glib_gobject_helper.py'],
|
install_data(['gst_gdb.py', 'glib_gobject_helper.py'],
|
||||||
|
|
Loading…
Reference in a new issue