1 project('gst-plugins-ugly', 'c',
3 meson_version : '>= 0.47',
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].to_int()
10 gst_version_minor = version_arr[1].to_int()
11 gst_version_micro = version_arr[2].to_int()
12 if version_arr.length() == 4
13 gst_version_nano = version_arr[3].to_int()
18 have_cxx = add_languages('cpp', required : false)
20 glib_req = '>= 2.40.0'
21 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
25 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
27 cc = meson.get_compiler('c')
29 if cc.get_id() == 'msvc'
30 # Ignore several spurious warnings for things gstreamer does very commonly
31 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
32 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
33 # NOTE: Only add warnings here if you are sure they're spurious
34 add_project_arguments(
35 '/wd4018', # implicit signed/unsigned conversion
36 '/wd4146', # unary minus on unsigned (beware INT_MIN)
37 '/wd4244', # lossy type conversion (e.g. double -> int)
38 '/wd4305', # truncating type conversion (e.g. double -> float)
40 # Disable SAFESEH with MSVC for plugins and libs that use external deps that
41 # are built with MinGW
42 noseh_link_args = ['/SAFESEH:NO']
47 if cc.has_link_argument('-Wl,-Bsymbolic-functions')
48 add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
52 if cc.has_argument('-fvisibility=hidden')
53 add_project_arguments('-fvisibility=hidden', language: 'c')
56 # Disable strict aliasing
57 if cc.has_argument('-fno-strict-aliasing')
58 add_project_arguments('-fno-strict-aliasing', language: 'c')
61 cdata = configuration_data()
63 ['HAVE_DLFCN_H', 'dlfcn.h'],
64 ['HAVE_INTTYPES_H', 'inttypes.h'],
65 ['HAVE_MALLOC_H', 'malloc.h'],
66 ['HAVE_MEMORY_H', 'memory.h'],
67 ['HAVE_STDINT_H', 'stdint.h'],
68 ['HAVE_STDLIB_H', 'stdlib.h'],
69 ['HAVE_STRINGS_H', 'strings.h'],
70 ['HAVE_STRING_H', 'string.h'],
71 ['HAVE_SYS_STAT_H', 'sys/stat.h'],
72 ['HAVE_SYS_TYPES_H', 'sys/types.h'],
73 ['HAVE_UNISTD_H', 'unistd.h'],
74 ['HAVE_WINSOCK2_H', 'winsock2.h'],
77 foreach h : check_headers
78 if cc.has_header(h.get(1))
79 cdata.set(h.get(0), 1)
84 # check token HAVE_CPU_ALPHA
85 # check token HAVE_CPU_ARM
86 # check token HAVE_CPU_CRIS
87 # check token HAVE_CPU_CRISV32
88 # check token HAVE_CPU_HPPA
89 # check token HAVE_CPU_I386
90 # check token HAVE_CPU_IA64
91 # check token HAVE_CPU_M68K
92 # check token HAVE_CPU_MIPS
93 # check token HAVE_CPU_PPC
94 # check token HAVE_CPU_PPC64
95 # check token HAVE_CPU_S390
96 # check token HAVE_CPU_SPARC
97 # check token HAVE_CPU_X86_64
98 ['HAVE_DCGETTEXT', 'dcgettext'],
99 # check token HAVE_EXPERIMENTAL
100 # check token HAVE_EXTERNAL
101 # check token HAVE_GETTEXT
102 # check token HAVE_VALGRIND
105 foreach f : check_functions
106 if cc.has_function(f.get(1))
107 cdata.set(f.get(0), 1)
111 cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
112 cdata.set('SIZEOF_INT', cc.sizeof('int'))
113 cdata.set('SIZEOF_LONG', cc.sizeof('long'))
114 cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
115 cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
117 cdata.set_quoted('VERSION', gst_version)
118 cdata.set_quoted('PACKAGE', 'gst-plugins-ugly')
119 cdata.set_quoted('GST_LICENSE', 'LGPL')
120 cdata.set_quoted('GETTEXT_PACKAGE', 'gst-plugins-ugly-1.0')
121 cdata.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
123 # GStreamer package name and origin url
124 gst_package_name = get_option('package-name')
125 if gst_package_name == ''
126 if gst_version_nano == 0
127 gst_package_name = 'GStreamer Ugly Plug-ins source release'
128 elif gst_version_nano == 1
129 gst_package_name = 'GStreamer Ugly Plug-ins git'
131 gst_package_name = 'GStreamer Ugly Plug-ins prerelease'
134 cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
135 cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin'))
138 gst_dep = dependency('gstreamer-1.0', version : gst_req,
139 fallback : ['gstreamer', 'gst_dep'])
140 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
141 fallback : ['gst-plugins-base', 'app_dep'])
142 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
143 fallback : ['gst-plugins-base', 'video_dep'])
144 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
145 fallback : ['gst-plugins-base', 'pbutils_dep'])
146 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
147 fallback : ['gst-plugins-base', 'tag_dep'])
148 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
149 fallback : ['gst-plugins-base', 'fft_dep'])
150 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
151 fallback : ['gst-plugins-base', 'audio_dep'])
152 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
153 fallback : ['gstreamer', 'gst_base_dep'])
154 gstriff_dep = dependency('gstreamer-riff-1.0', version : gst_req,
155 fallback : ['gst-plugins-base', 'riff_dep'])
156 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
157 fallback : ['gst-plugins-base', 'rtp_dep'])
158 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
159 fallback : ['gstreamer', 'gst_net_dep'])
160 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
161 fallback : ['gst-plugins-base', 'sdp_dep'])
162 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
163 fallback : ['gst-plugins-base', 'rtsp_dep'])
164 if host_machine.system() != 'windows'
165 gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
166 fallback : ['gstreamer', 'gst_check_dep'])
168 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
169 fallback : ['gstreamer', 'gst_controller_dep'])
171 orc_dep = dependency('orc-0.4', version : '>= 0.4.16', required : false)
173 cdata.set('HAVE_ORC', 1) # used by a52dec for cpu detection
175 cdata.set('DISABLE_ORC', 1)
178 ugly_args = ['-DHAVE_CONFIG_H']
179 configinc = include_directories('.')
180 libsinc = include_directories('gst-libs')
182 if gst_dep.type_name() == 'internal'
183 gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
185 # We can't check that in the case of subprojects as we won't
186 # be able to build against an internal dependency (which is not built yet)
187 gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
190 if gst_debug_disabled and cc.has_argument('-Wno-unused')
191 add_project_arguments('-Wno-unused', language: 'c')
195 '-Wmissing-declarations',
199 '-Wformat-nonliteral',
202 '-Wmissing-include-dirs',
207 '-Waggregate-return',
211 '-Wmissing-prototypes',
212 '-Wold-style-definition',
213 '-Wdeclaration-after-statement',
218 cxx = meson.get_compiler('cpp')
221 foreach extra_arg : warning_flags
222 if cc.has_argument (extra_arg)
223 add_project_arguments([extra_arg], language: 'c')
225 if have_cxx and cxx.has_argument (extra_arg)
226 add_project_arguments([extra_arg], language: 'cpp')
230 foreach extra_arg : warning_c_flags
231 if cc.has_argument (extra_arg)
232 add_project_arguments([extra_arg], language: 'c')
236 presetdir = join_paths(get_option('datadir'), 'gstreamer-' + api_version, 'presets')
238 pkgconfig = import('pkgconfig')
239 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
240 if get_option('default_library') == 'shared'
241 # If we don't build static plugins there is no need to generate pc files
242 plugins_pkgconfig_install_dir = disabler()
249 # xgettext is optional (on Windows for instance)
250 if find_program('xgettext', required : get_option('nls')).found()
251 cdata.set('ENABLE_NLS', 1)
255 configure_file(output : 'config.h', configuration : cdata)
257 python3 = import('python3').find_python()
258 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')