Back to development
[platform/upstream/gstreamer.git] / subprojects / gst-rtsp-server / meson.build
1 project('gst-rtsp-server', 'c',
2   version : '1.22.7.1',
3   meson_version : '>= 0.62',
4   default_options : ['warning_level=1', 'buildtype=debugoptimized'])
5
6 gst_version = meson.project_version()
7 version_arr = gst_version.split('.')
8 gst_version_major = version_arr[0].to_int()
9 gst_version_minor = version_arr[1].to_int()
10 gst_version_micro = version_arr[2].to_int()
11  if version_arr.length() == 4
12   gst_version_nano = version_arr[3].to_int()
13 else
14   gst_version_nano = 0
15 endif
16 gst_version_is_stable = gst_version_minor.is_even()
17 gst_version_is_dev = gst_version_minor.is_odd() and gst_version_micro < 90
18
19 glib_req = '>= 2.62.0'
20
21 if gst_version_is_stable
22   gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
23 else
24   gst_req = '>= ' + gst_version
25 endif
26
27 api_version = '1.0'
28 soversion = 0
29 # maintaining compatibility with the previous libtool versioning
30 # current = minor * 100 + micro
31 curversion = gst_version_minor * 100 + gst_version_micro
32 libversion = '@0@.@1@.0'.format(soversion, curversion)
33 osxversion = curversion + 1
34
35 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
36
37 cc = meson.get_compiler('c')
38
39 cdata = configuration_data()
40
41 if cc.has_link_argument('-Wl,-Bsymbolic-functions')
42   add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
43 endif
44
45 # glib doesn't support unloading, which means that unloading and reloading
46 # any library that registers static types will fail
47 if cc.has_link_argument('-Wl,-z,nodelete')
48   add_project_link_arguments('-Wl,-z,nodelete', language: 'c')
49 endif
50
51 # Symbol visibility
52 if cc.has_argument('-fvisibility=hidden')
53   add_project_arguments('-fvisibility=hidden', language: 'c')
54 endif
55
56 # Disable strict aliasing
57 if cc.has_argument('-fno-strict-aliasing')
58   add_project_arguments('-fno-strict-aliasing', language: 'c')
59 endif
60
61 # Define G_DISABLE_DEPRECATED for development versions
62 if gst_version_is_dev
63   message('Disabling deprecated GLib API')
64   add_project_arguments('-DG_DISABLE_DEPRECATED', language: 'c')
65 endif
66
67 cast_checks = get_option('gobject-cast-checks')
68 if cast_checks.disabled() or (cast_checks.auto() and not gst_version_is_dev)
69   message('Disabling GLib cast checks')
70   add_project_arguments('-DG_DISABLE_CAST_CHECKS', language: 'c')
71 endif
72
73 glib_asserts = get_option('glib-asserts')
74 if glib_asserts.disabled() or (glib_asserts.auto() and not gst_version_is_dev)
75   message('Disabling GLib asserts')
76   add_project_arguments('-DG_DISABLE_ASSERT', language: 'c')
77 endif
78
79 glib_checks = get_option('glib-checks')
80 if glib_checks.disabled() or (glib_checks.auto() and not gst_version_is_dev)
81   message('Disabling GLib checks')
82   add_project_arguments('-DG_DISABLE_CHECKS', language: 'c')
83 endif
84
85 cdata.set_quoted('GETTEXT_PACKAGE', 'gst-rtsp-server-1.0')
86 cdata.set_quoted('PACKAGE', 'gst-rtsp-server')
87 cdata.set_quoted('VERSION', gst_version)
88 cdata.set_quoted('PACKAGE_VERSION', gst_version)
89 cdata.set_quoted('GST_API_VERSION', api_version)
90 cdata.set_quoted('GST_LICENSE', 'LGPL')
91
92 # FIXME: ENABLE_NLS (currently also missing from autotools build)
93 # cdata.set('ENABLE_NLS', true)
94 # cdata.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
95
96 # GStreamer package name and origin url
97 gst_package_name = get_option('package-name')
98 if gst_package_name == ''
99   if gst_version_nano == 0
100     gst_package_name = 'GStreamer RTSP Server Library source release'
101   elif gst_version_nano == 1
102     gst_package_name = 'GStreamer RTSP Server Library git'
103   else
104     gst_package_name = 'GStreamer RTSP Server Library prerelease'
105   endif
106 endif
107 cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
108 cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin'))
109
110 rtspserver_args = ['-DHAVE_CONFIG_H']
111
112 warning_flags = [
113   '-Wmissing-declarations',
114   '-Wmissing-prototypes',
115   '-Wredundant-decls',
116   '-Wundef',
117   '-Wwrite-strings',
118   '-Wformat',
119   '-Wformat-nonliteral',
120   '-Wformat-security',
121   '-Wold-style-definition',
122   '-Waggregate-return',
123   '-Winit-self',
124   '-Wmissing-include-dirs',
125   '-Waddress',
126   '-Wno-multichar',
127   '-Wvla',
128   '-Wpointer-arith',
129 ]
130
131 foreach extra_arg : warning_flags
132   if cc.has_argument (extra_arg)
133     add_project_arguments([extra_arg], language: 'c')
134   endif
135 endforeach
136
137 rtspserver_incs = include_directories('gst/rtsp-server', '.')
138
139 gst_dep = dependency('gstreamer-1.0', version : gst_req,
140   fallback : ['gstreamer', 'gst_dep'])
141 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
142   fallback : ['gst-plugins-base', 'rtsp_dep'])
143 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
144   fallback : ['gst-plugins-base', 'rtp_dep'])
145 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
146   fallback : ['gst-plugins-base', 'sdp_dep'])
147 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
148   fallback : ['gst-plugins-base', 'app_dep'])
149 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
150   fallback : ['gstreamer', 'gst_net_dep'])
151 if host_machine.system() != 'windows'
152   gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
153     required : get_option('tests'),
154     fallback : ['gstreamer', 'gst_check_dep'])
155 endif
156
157 # Disable compiler warnings for unused variables and args if gst debug system is disabled
158 if gst_dep.type_name() == 'internal'
159   gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
160 else
161   # We can't check that in the case of subprojects as we won't
162   # be able to build against an internal dependency (which is not built yet)
163   gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
164 endif
165
166 if gst_debug_disabled
167   message('GStreamer debug system is disabled')
168   add_project_arguments(cc.get_supported_arguments(['-Wno-unused']), language: 'c')
169 else
170   message('GStreamer debug system is enabled')
171 endif
172
173 gir = find_program('g-ir-scanner', required : get_option('introspection'))
174 gnome = import('gnome')
175 build_gir = gir.found() and (not meson.is_cross_build() or get_option('introspection').enabled())
176 gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
177     'g_setenv("GST_REGISTRY_1.0", "@0@", TRUE);'.format(meson.current_build_dir() + '/gir_empty_registry.reg') + \
178     'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
179     'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
180     'gst_init(NULL,NULL);', '--quiet']
181
182 pkgconfig = import('pkgconfig')
183 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
184 if get_option('default_library') == 'shared'
185   # If we don't build static plugins there is no need to generate pc files
186   plugins_pkgconfig_install_dir = disabler()
187 endif
188
189 plugins = []
190 pkgconfig_subdirs = ['gstreamer-1.0']
191 static_build = get_option('default_library') == 'static'
192 gst_libraries = []
193
194 subdir('gst')
195 if not get_option('tests').disabled()
196   subdir('tests')
197 endif
198 if not get_option('examples').disabled()
199   subdir('examples')
200 endif
201 subdir('docs')
202
203 # Set release date
204 if gst_version_nano == 0
205   extract_release_date = find_program('scripts/extract-release-date-from-doap-file.py')
206   run_result = run_command(extract_release_date, gst_version, files('gst-rtsp-server.doap'), check: true)
207   release_date = run_result.stdout().strip()
208   cdata.set_quoted('GST_PACKAGE_RELEASE_DATETIME', release_date)
209   message('Package release date: ' + release_date)
210 endif
211
212 configure_file(output: 'config.h', configuration: cdata)
213
214 meson.add_dist_script('scripts/gen-changelog.py', meson.project_name(), '1.20.0', meson.project_version())
215
216 plugin_names = []
217 gst_plugins = []
218 foreach plugin: plugins
219   pkgconfig.generate(plugin, install_dir: plugins_pkgconfig_install_dir)
220   dep = declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})
221   meson.override_dependency(plugin.name(), dep)
222   gst_plugins += [dep]
223   if plugin.name().startswith('gst')
224     plugin_names += [plugin.name().substring(3)]
225   else
226     plugin_names += [plugin.name()]
227   endif
228 endforeach
229
230 summary({
231     'Plugins': plugin_names,
232 }, list_sep: ', ')