1 project('gst-plugins-bad', 'c', 'cpp',
3 meson_version : '>= 0.40.1',
4 default_options : [ 'warning_level=1',
5 'buildtype=debugoptimized' ])
7 gst_version = meson.project_version()
8 version_arr = gst_version.split('.')
9 gst_version_major = version_arr[0]
10 gst_version_minor = version_arr[1]
11 gst_version_micro = version_arr[2]
12 if version_arr.length() == 4
13 gst_version_nano = version_arr[3]
18 glib_req = '>= 2.40.0'
19 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
23 # maintaining compatibility with the previous libtool versioning
24 # current = minor * 100 + micro
25 libversion = '@0@.@1@.0'.format(soversion, gst_version_minor.to_int() * 100 + gst_version_micro.to_int())
27 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
29 cc = meson.get_compiler('c')
30 cxx = meson.get_compiler('cpp')
32 if cc.get_id() == 'msvc'
33 # Ignore several spurious warnings for things gstreamer does very commonly
34 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
35 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
36 # NOTE: Only add warnings here if you are sure they're spurious
38 '/wd4018', # implicit signed/unsigned conversion
39 '/wd4146', # unary minus on unsigned (beware INT_MIN)
40 '/wd4244', # lossy type conversion (e.g. double -> int)
41 '/wd4305', # truncating type conversion (e.g. double -> float)
43 add_project_arguments(msvc_args, language : 'c')
44 add_project_arguments(msvc_args, language : 'cpp')
45 # Disable SAFESEH with MSVC for plugins and libs that use external deps that
46 # are built with MinGW
47 noseh_link_args = ['/SAFESEH:NO']
49 if cxx.has_argument('-Wno-non-virtual-dtor')
50 add_project_arguments('-Wno-non-virtual-dtor', language: 'cpp')
57 if cc.has_argument('-fvisibility=hidden')
58 add_project_arguments('-fvisibility=hidden', language: 'c')
60 if cxx.has_argument('-fvisibility=hidden')
61 add_project_arguments('-fvisibility=hidden', language: 'cpp')
64 cdata = configuration_data()
66 ['HAVE_DLFCN_H', 'dlfcn.h'],
67 ['HAVE_FCNTL_H', 'fcntl.h'],
68 ['HAVE_HIGHGUI_H', 'highgui.h'],
69 ['HAVE_INTTYPES_H', 'inttypes.h'],
70 ['HAVE_MEMORY_H', 'memory.h'],
71 ['HAVE_MSACM_H', 'msacm.h'],
72 ['HAVE_NETINET_IN_H', 'netinet/in.h'],
73 ['HAVE_NETINET_IP_H', 'netinet/ip.h'],
74 ['HAVE_NETINET_TCP_H', 'netinet/tcp.h'],
75 ['HAVE_OPENCV2_HIGHGUI_HIGHGUI_C_H', 'opencv2/highgui/highgui_c.h'],
76 ['HAVE_PTHREAD_H', 'pthread.h'],
77 ['HAVE_STDINT_H', 'stdint.h'],
78 ['HAVE_STDLIB_H', 'stdlib.h'],
79 ['HAVE_STRINGS_H', 'strings.h'],
80 ['HAVE_STRING_H', 'string.h'],
81 ['HAVE_SYS_PARAM_H', 'sys/param.h'],
82 ['HAVE_SYS_SOCKET_H', 'sys/socket.h'],
83 ['HAVE_SYS_STAT_H', 'sys/stat.h'],
84 ['HAVE_SYS_TIME_H', 'sys/time.h'],
85 ['HAVE_SYS_TYPES_H', 'sys/types.h'],
86 ['HAVE_SYS_UTSNAME_H', 'sys/utsname.h'],
87 ['HAVE_UNISTD_H', 'unistd.h'],
88 ['HAVE_WINDOWS_H', 'windows.h'],
89 ['HAVE_WINSOCK2_H', 'winsock2.h'],
90 ['HAVE_WS2TCPIP_H', 'ws2tcpip.h'],
93 foreach h : check_headers
94 if cc.has_header(h.get(1))
95 cdata.set(h.get(0), 1)
100 # check token HAVE_ACM
101 # check token HAVE_ANDROID_MEDIA
102 # check token HAVE_APEXSINK
103 # check token HAVE_APPLE_MEDIA
104 # check token HAVE_ASSRENDER
105 # check token HAVE_AVC
106 # check token HAVE_AVFOUNDATION
107 # check token HAVE_BLUEZ
108 # check token HAVE_BZ2
109 # check token HAVE_CFLOCALECOPYCURRENT
110 # check token HAVE_CFPREFERENCESCOPYAPPVALUE
111 # check token HAVE_CHROMAPRINT
112 # check token HAVE_CPU_ALPHA
113 # check token HAVE_CPU_ARM
114 # check token HAVE_CPU_CRIS
115 # check token HAVE_CPU_CRISV32
116 # check token HAVE_CPU_HPPA
117 # check token HAVE_CPU_I386
118 # check token HAVE_CPU_IA64
119 # check token HAVE_CPU_M68K
120 # check token HAVE_CPU_MIPS
121 # check token HAVE_CPU_PPC
122 # check token HAVE_CPU_PPC64
123 # check token HAVE_CPU_S390
124 # check token HAVE_CPU_SPARC
125 # check token HAVE_CPU_X86_64
126 # check token HAVE_CURL
127 # check token HAVE_DAALA
128 # check token HAVE_DASH
129 # check token HAVE_DC1394
130 ['HAVE_DCGETTEXT', 'dcgettext'],
131 # check token HAVE_DECKLINK
132 # check token HAVE_DIRECT3D
133 # check token HAVE_DIRECTDRAW
134 # check token HAVE_DIRECTFB
135 # check token HAVE_DIRECTSOUND
136 # check token HAVE_DOWHILE_MACROS
137 # check token HAVE_DTS
138 # check token HAVE_DVB
139 # check token HAVE_EXPERIMENTAL
140 # check token HAVE_EXTERNAL
141 # check token HAVE_FAAC
142 # check token HAVE_FAAD
143 # check token HAVE_FBDEV
144 # check token HAVE_FLITE
145 # check token HAVE_FLUIDSYNTH
146 ['HAVE_GETPAGESIZE', 'getpagesize'],
147 # check token HAVE_GETTEXT
148 # check token HAVE_GL
149 # check token HAVE_GLCHAR
150 # check token HAVE_GLEGLIMAGEOES
151 # check token HAVE_GLINTPTR
152 # check token HAVE_GLSIZEIPTR
153 # check token HAVE_GME
154 ['HAVE_GMTIME_R', 'gmtime_r'],
155 # check token HAVE_GRAPHENE
156 # check token HAVE_GSETTINGS
157 # check token HAVE_GSM
158 # check token HAVE_GUDEV
159 # check token HAVE_HLS
160 # check token HAVE_ICONV
161 # check token HAVE_IOS
162 # check token HAVE_JPEG
163 # check token HAVE_KATE
164 # check token HAVE_LADSPA
165 # check token HAVE_LIBGCRYPT
166 # check token HAVE_LIBGME_ACCURACY
167 # check token HAVE_LIBMMS
168 # check token HAVE_LIBNSL
169 # check token HAVE_LIBSOCKET
170 # check token HAVE_LIBUSB
171 # check token HAVE_LIBVISUAL
172 # check token HAVE_LINSYS
173 # check token HAVE_LRDF
174 # check token HAVE_LV2
175 # check token HAVE_MIMIC
176 ['HAVE_MMAP', 'mmap'],
177 # check token HAVE_MODPLUG
178 # check token HAVE_MPEG2ENC
179 # check token HAVE_MPG123
180 # check token HAVE_MPLEX
181 # check token HAVE_MUSEPACK
182 # check token HAVE_MYTHTV
183 # check token HAVE_NAS
184 # check token HAVE_NEON
185 # check token HAVE_NETTLE
186 # check token HAVE_OFA
187 # check token HAVE_OPENAL
188 # check token HAVE_OPENCV
189 # check token HAVE_OPENEXR
190 # check token HAVE_OPENJPEG
191 # check token HAVE_OPENJPEG_1
192 # check token HAVE_OPENNI2
193 # check token HAVE_OPENSLES
194 # check token HAVE_OPUS
195 # check token HAVE_ORC
196 # check token HAVE_OSX
197 # check token HAVE_OSX_VIDEO
198 ['HAVE_PIPE2', 'pipe2'],
199 # check token HAVE_PNG
200 # check token HAVE_PVR
201 # check token HAVE_QUICKTIME
202 # check token HAVE_RDTSC
203 # check token HAVE_RESINDVD
204 # check token HAVE_RSVG
205 # check token HAVE_RSVG_2_36_2
206 # check token HAVE_RTMP
207 # check token HAVE_SBC
208 # check token HAVE_SCHRO
209 # check token HAVE_SDL
210 # check token HAVE_SHM
211 # check token HAVE_SMOOTHSTREAMING
212 # check token HAVE_SNDFILE
213 # check token HAVE_SNDIO
214 # check token HAVE_SOUNDTOUCH
215 # check token HAVE_SOUNDTOUCH_1_4
216 # check token HAVE_SPANDSP
217 # check token HAVE_SPC
218 # check token HAVE_SRTP
219 # check token HAVE_SSH2
220 # check token HAVE_TELETEXTDEC
221 # check token HAVE_TIGER
222 # check token HAVE_TIMIDITY
223 # check token HAVE_UVCH264
224 # check token HAVE_VALGRIND
225 # check token HAVE_VCD
226 # check token HAVE_VDPAU
227 # check token HAVE_VIDEOTOOLBOX
228 # check token HAVE_VIDEOTOOLBOX_10_9_6
229 # check token HAVE_VOAACENC
230 # check token HAVE_VOAMRWBENC
231 # check token HAVE_WASAPI
232 # check token HAVE_WAYLAND
233 # check token HAVE_WEBP
234 # check token HAVE_WILDMIDI
235 # check token HAVE_WIN32
236 # check token HAVE_WININET
237 # check token HAVE_WINKS
238 # check token HAVE_WINSCREENCAP
239 # check token HAVE_XVID
240 # check token HAVE_ZBAR
243 foreach f : check_functions
244 if cc.has_function(f.get(1))
245 cdata.set(f.get(0), 1)
249 cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
250 cdata.set('SIZEOF_INT', cc.sizeof('int'))
251 cdata.set('SIZEOF_LONG', cc.sizeof('long'))
252 cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
253 cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
255 cdata.set_quoted('VERSION', gst_version)
256 cdata.set_quoted('PACKAGE', 'gst-plugins-bad')
257 cdata.set_quoted('PACKAGE_VERSION', gst_version)
258 cdata.set_quoted('PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer')
259 cdata.set_quoted('PACKAGE_NAME', 'GStreamer Bad Plug-ins')
260 cdata.set_quoted('GETTEXT_PACKAGE', 'gst-plugins-bad-1.0')
261 cdata.set_quoted('GST_API_VERSION', api_version)
262 cdata.set_quoted('GST_LICENSE', 'LGPL')
263 cdata.set_quoted('LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
265 # GStreamer package name and origin url
266 gst_package_name = get_option('with-package-name')
267 if gst_package_name == ''
268 if gst_version_nano == 0
269 gst_package_name = 'GStreamer Bad Plug-ins source release'
270 elif gst_version_nano == 1
271 gst_package_name = 'GStreamer Bad Plug-ins git'
273 gst_package_name = 'GStreamer Bad Plug-ins prerelease'
276 cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
277 cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('with-package-origin'))
279 # FIXME: This should be exposed as a configuration option
280 host_system = host_machine.system()
281 if host_system == 'linux'
282 cdata.set_quoted('DEFAULT_VIDEOSRC', 'v4l2src')
283 elif host_system == 'osx'
284 cdata.set_quoted('DEFAULT_VIDEOSRC', 'avfvideosrc')
286 cdata.set_quoted('DEFAULT_VIDEOSRC', 'videotestsrc')
290 gst_dep = dependency('gstreamer-1.0', version : gst_req,
291 fallback : ['gstreamer', 'gst_dep'])
292 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
293 fallback : ['gstreamer', 'gst_base_dep'])
294 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
295 fallback : ['gstreamer', 'gst_net_dep'])
296 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
297 fallback : ['gstreamer', 'gst_controller_dep'])
299 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
300 fallback : ['gst-plugins-base', 'pbutils_dep'])
301 gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req,
302 fallback : ['gst-plugins-base', 'allocators_dep'])
303 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
304 fallback : ['gst-plugins-base', 'app_dep'])
305 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
306 fallback : ['gst-plugins-base', 'audio_dep'])
307 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
308 fallback : ['gst-plugins-base', 'fft_dep'])
309 gstriff_dep = dependency('gstreamer-riff-1.0', version : gst_req,
310 fallback : ['gst-plugins-base', 'riff_dep'])
311 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
312 fallback : ['gst-plugins-base', 'rtp_dep'])
313 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
314 fallback : ['gst-plugins-base', 'rtsp_dep'])
315 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
316 fallback : ['gst-plugins-base', 'sdp_dep'])
317 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
318 fallback : ['gst-plugins-base', 'tag_dep'])
319 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
320 fallback : ['gst-plugins-base', 'video_dep'])
321 if host_machine.system() != 'windows'
322 gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
323 fallback : ['gstreamer', 'gst_check_dep'])
326 libm = cc.find_library('m', required : false)
327 glib_dep = dependency('glib-2.0', version : glib_req,
328 fallback: ['glib', 'libglib_dep'])
329 gmodule_dep = dependency('gmodule-2.0',
330 fallback: ['glib', 'libgmodule_dep'])
331 gio_dep = dependency('gio-2.0',
332 fallback: ['glib', 'libgio_dep'])
333 x11_dep = dependency('x11', required : false)
335 # Used by dtls and hls
336 openssl_dep = dependency('openssl', version : '>= 1.0.1', required : false)
338 # Used by mpeg2enc and mplex
339 # mjpegtools upstream breaks API constantly and doesn't export the version in
340 # a header anywhere. The configure file has a lot of logic to support old
341 # versions, but it all seems untested and broken. Require 2.0.0. Can be changed
342 # if someone complains.
343 mjpegtools_dep = dependency('mjpegtools', version : '>=2.0.0', required : false)
345 if mjpegtools_dep.found()
346 mjpegtools_api = '20000'
350 cdata.set('HAVE_X11', 1)
353 mathlib = cc.find_library('m', required : false)
355 if host_machine.system() == 'windows'
356 winsock2 = [cc.find_library('ws2_32')]
363 if get_option('use_orc') != 'no'
364 need_orc = get_option('use_orc') == 'yes'
365 # Used by various libraries/elements that use Orc code
366 orc_dep = dependency('orc-0.4', required : need_orc)
367 orcc = find_program('orcc', required : need_orc)
368 if orc_dep.found() and orcc.found()
370 orcc_args = [orcc, '--include', 'glib.h']
371 cdata.set('HAVE_ORC', 1)
373 message('Orc Compiler not found, will use backup C code')
374 cdata.set('DISABLE_ORC', 1)
377 cdata.set('DISABLE_ORC', 1)
380 if gst_dep.type_name() == 'internal'
381 gst_proj = subproject('gstreamer')
383 if gst_proj.get_variable('disable_gst_debug')
384 message('GStreamer debug system is disabled')
385 add_project_arguments('-Wno-unused', language: 'c')
387 message('GStreamer debug system is enabled')
390 # We can't check that in the case of subprojects as we won't
391 # be able to build against an internal dependency (which is not built yet)
392 if not cc.compiles('''
393 #include <gst/gstconfig.h>
394 #ifdef GST_DISABLE_GST_DEBUG
395 #error "debugging disabled, make compiler fail"
396 #endif''' , dependencies: gst_dep)
397 message('GStreamer debug system is disabled')
398 add_global_arguments('-Wno-unused', language: 'c')
400 message('GStreamer debug system is enabled')
404 configure_file(output : 'config.h', configuration : cdata)
406 gst_plugins_bad_args = ['-DHAVE_CONFIG_H']
407 configinc = include_directories('.')
408 libsinc = include_directories('gst-libs')
410 # Used by the *_mkenum.py helper scripts
411 glib_mkenums = find_program('glib-mkenums')
413 python3 = import('python3').find_python()
415 gir = find_program('g-ir-scanner', required : false)
416 gnome = import('gnome')
417 build_gir = gir.found() and not meson.is_cross_build() and not get_option('disable_introspection')
418 gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
419 'g_setenv("GST_REGISTRY_1.0", "@0@", TRUE);'.format(meson.current_build_dir() + '/gir_empty_registry.reg') + \
420 'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
421 'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
422 'gst_init(NULL,NULL);' ]
431 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')