Remove glib and gobject dependencies everywhere
[platform/upstream/gstreamer.git] / subprojects / gstreamer / libs / gst / helpers / meson.build
1 exe = executable('gst-plugin-scanner',
2   'gst-plugin-scanner.c',
3   c_args : gst_c_args,
4   include_directories : [configinc],
5   dependencies : [gst_dep, mathlib, gmodule_dep,],
6   install_dir : helpers_install_dir,
7   install: true,
8 )
9
10 meson.add_devenv({'GST_PLUGIN_SCANNER': exe.full_path()})
11
12 # Used in test env setup to make tests find plugin scanner in build tree
13 gst_scanner_dir = meson.current_build_dir()
14
15 if bashcomp_found
16   executable('gst-completion-helper',
17     'gst-completion-helper.c',
18     c_args : gst_c_args,
19     include_directories : [configinc],
20     dependencies : [gst_dep],
21     install_dir : helpers_install_dir,
22     install: true,
23   )
24 endif
25
26 # Check PTP support
27 have_ptp = false
28 if host_system == 'android'
29   message('PTP not supported on Android because of permissions.')
30 elif host_system == 'windows'
31   message('PTP not supported on Windows, not ported yet.')
32 elif host_system == 'ios'
33   message('PTP not supported on iOS because of permissions.')
34 elif ['linux', 'darwin', 'netbsd', 'freebsd', 'openbsd', 'kfreebsd', 'dragonfly', 'sunos', 'gnu', 'gnu/kfreebsd'].contains(host_system)
35   message('PTP supported on ' + host_system + '.')
36   have_ptp = true
37 else
38   message('PTP not supported on ' + host_system + ', not ported yet.')
39 endif
40
41 if have_ptp
42   cdata.set('HAVE_PTP', 1, description : 'PTP support available')
43
44   if cc.compiles('''#include <sys/ioctl.h>
45                     #include <net/if.h>
46                     int some_func (void) {
47                       struct ifreq ifr;
48                       struct ifconf ifc;
49                       ioctl(0, SIOCGIFCONF, &ifc);
50                       ioctl(0, SIOCGIFFLAGS, &ifr);
51                       ioctl(0, SIOCGIFHWADDR, &ifr);
52                       return ifr.ifr_hwaddr.sa_data[0];
53                     }''',
54                  name : 'SIOCGIFCONF, SIOCGIFFLAGS and SIOCGIFHWADDR available')
55     cdata.set('HAVE_SIOCGIFCONF_SIOCGIFFLAGS_SIOCGIFHWADDR', 1,
56       description : 'SIOCGIFCONF, SIOCGIFFLAGS and SIOCGIFHWADDR is available')
57   endif
58
59   if cc.compiles('''#include <ifaddrs.h>
60                     #include <net/if.h>
61                     #include <net/if_dl.h>
62                     int some_func (void) {
63                       struct ifaddrs *ifaddr;
64                       getifaddrs(&ifaddr);
65                       return (ifaddr->ifa_flags & IFF_LOOPBACK) && ifaddr->ifa_addr->sa_family != AF_LINK;
66                     }''', name : 'getifaddrs() and AF_LINK available')
67     cdata.set('HAVE_GETIFADDRS_AF_LINK', 1,
68       description : 'getifaddrs() and AF_LINK is available')
69   endif
70
71   setcap_prog = find_program('setcap', '/usr/sbin/setcap', '/sbin/setcap', required : false)
72   cap_dep = dependency('libcap', required: false)
73
74   # user/group to change to in gst-ptp-helper
75   ptp_helper_setuid_user = get_option('ptp-helper-setuid-user')
76   if ptp_helper_setuid_user != ''
77     cdata.set_quoted('HAVE_PTP_HELPER_SETUID_USER', ptp_helper_setuid_user,
78       description : 'PTP helper setuid user')
79   endif
80   ptp_helper_setuid_group = get_option('ptp-helper-setuid-group')
81   if ptp_helper_setuid_group != ''
82     cdata.set_quoted('HAVE_PTP_HELPER_SETUID_GROUP', ptp_helper_setuid_group,
83       description : 'PTP helper setuid group')
84   endif
85
86   # how to install gst-ptp-helper
87   with_ptp_helper_permissions = get_option('ptp-helper-permissions')
88   if with_ptp_helper_permissions == 'auto'
89     if setcap_prog.found() and cap_dep.found()
90       with_ptp_helper_permissions = 'capabilities'
91     else
92       with_ptp_helper_permissions = 'setuid-root'
93     endif
94   endif
95   message('How to install gst-ptp-helper: ' + with_ptp_helper_permissions)
96
97   if with_ptp_helper_permissions == 'none'
98     # nothing to do
99   elif with_ptp_helper_permissions == 'setuid-root'
100     cdata.set('HAVE_PTP_HELPER_SETUID', 1,
101         description : 'Use setuid-root for permissions in PTP helper')
102   elif with_ptp_helper_permissions == 'capabilities'
103     if not setcap_prog.found()
104       error('capabilities-based ptp-helper-permissions requested, but could not find setcap tool.')
105     elif not cap_dep.found()
106       error('capabilities-based ptp-helper-permissions requested, but could not find libcap.')
107     endif
108     cdata.set('HAVE_PTP_HELPER_CAPABILITIES', 1,
109         description : 'Use capabilities for permissions in PTP helper')
110   else
111     error('Unexpected ptp helper permissions value: ' + with_ptp_helper_permissions)
112   endif
113
114   exe = executable('gst-ptp-helper', 'gst-ptp-helper.c',
115     c_args : gst_c_args,
116     include_directories : [configinc, libsinc],
117     dependencies : [gst_dep, gio_dep, mathlib, cap_dep],
118     install_dir : helpers_install_dir,
119     install : true)
120
121   meson.add_install_script('ptp_helper_post_install.sh',
122       helpers_install_dir, with_ptp_helper_permissions,
123       setcap_prog.found() ? setcap_prog.full_path() : '')
124   meson.add_devenv({'GST_PTP_HELPER': exe.full_path()})
125 endif
126
127 install_data(['gst_gdb.py', 'glib_gobject_helper.py'],
128   install_dir : join_paths(get_option('datadir'), 'gstreamer-@0@'.format(apiversion), 'gdb'),
129   install_tag : 'devel')
130
131 gdbconf = configuration_data()
132 gdbconf.set('GST_API_VERSION', apiversion)
133 gdbconf.set('DATADIR', '@0@/@1@'.format(get_option('prefix'), get_option('datadir')))
134
135 if host_system != 'windows'
136   # XXX: We add a leading './' because prefix is an absolute path and we
137   # need it to be a relative path so that join_paths appends it to the end.
138   gdb_install_dir = join_paths(get_option('datadir'), 'gdb', 'auto-load', './' + get_option('prefix'), get_option('libdir'))
139 else
140   # FIXME: Cannot install on Windows because the path will contain a drive
141   # letter and colons are not allowed in paths.
142   gdb_install_dir = disabler()
143 endif
144 configure_file(input : 'libgstreamer-gdb.py.in',
145   output : 'libgstreamer-@0@.so.@1@-gdb.py'.format(apiversion, libversion),
146   install_dir : gdb_install_dir,
147   install_tag : 'devel',
148   configuration : gdbconf)