Add support for Meson as alternative/parallel build system

https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
This commit is contained in:
Nirbheek Chauhan 2016-08-12 21:25:34 +05:30 committed by Tim-Philipp Müller
parent 5ae5b2d3c7
commit c8260a1545
21 changed files with 669 additions and 0 deletions

4
.gitignore vendored
View file

@ -50,3 +50,7 @@ Build
/test-driver
*.log
*.trs
# Meson
/build
/subprojects

294
config.h.meson Normal file
View file

@ -0,0 +1,294 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
#mesondefine AC_APPLE_UNIVERSAL_BUILD
/* Default audio sink */
#mesondefine DEFAULT_AUDIOSINK
/* Default audio source */
#mesondefine DEFAULT_AUDIOSRC
/* Default video sink */
#mesondefine DEFAULT_VIDEOSINK
/* Default video source */
#mesondefine DEFAULT_VIDEOSRC
/* Default visualizer */
#mesondefine DEFAULT_VISUALIZER
/* Disable Orc */
#mesondefine DISABLE_ORC
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#mesondefine ENABLE_NLS
/* gettext package name */
#mesondefine GETTEXT_PACKAGE
/* The GIO library directory. */
#mesondefine GIO_LIBDIR
/* The GIO modules directory. */
#mesondefine GIO_MODULE_DIR
/* GStreamer API Version */
#mesondefine GST_API_VERSION
/* macro to use to show function name */
#mesondefine GST_FUNCTION
/* Defined if gcov is enabled to force a rebuild due to config.h changing */
#mesondefine GST_GCOV_ENABLED
/* Default errorlevel to use */
#mesondefine GST_LEVEL_DEFAULT
/* GStreamer license */
#mesondefine GST_LICENSE
/* package name in plugins */
#mesondefine GST_PACKAGE_NAME
/* package origin */
#mesondefine GST_PACKAGE_ORIGIN
/* GStreamer package release date/time for plugins as YYYY-MM-DD */
#mesondefine GST_PACKAGE_RELEASE_DATETIME
/* Define if static plugins should be built */
#mesondefine GST_PLUGIN_BUILD_STATIC
/* Define to enable a52dec (used by a52dec). */
#mesondefine HAVE_A52DEC
/* Define to enable amrnb library (used by amrnb). */
#mesondefine HAVE_AMRNB
/* Define to enable amrwb library (used by amrwbdec). */
#mesondefine HAVE_AMRWB
/* Define to enable cdio library (used by cdio). */
#mesondefine HAVE_CDIO
/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
CoreFoundation framework. */
#mesondefine HAVE_CFLOCALECOPYCURRENT
/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
the CoreFoundation framework. */
#mesondefine HAVE_CFPREFERENCESCOPYAPPVALUE
/* Define if the target CPU is an Alpha */
#mesondefine HAVE_CPU_ALPHA
/* Define if the target CPU is an ARM */
#mesondefine HAVE_CPU_ARM
/* Define if the target CPU is a CRIS */
#mesondefine HAVE_CPU_CRIS
/* Define if the target CPU is a CRISv32 */
#mesondefine HAVE_CPU_CRISV32
/* Define if the target CPU is a HPPA */
#mesondefine HAVE_CPU_HPPA
/* Define if the target CPU is an x86 */
#mesondefine HAVE_CPU_I386
/* Define if the target CPU is a IA64 */
#mesondefine HAVE_CPU_IA64
/* Define if the target CPU is a M68K */
#mesondefine HAVE_CPU_M68K
/* Define if the target CPU is a MIPS */
#mesondefine HAVE_CPU_MIPS
/* Define if the target CPU is a PowerPC */
#mesondefine HAVE_CPU_PPC
/* Define if the target CPU is a 64 bit PowerPC */
#mesondefine HAVE_CPU_PPC64
/* Define if the target CPU is a S390 */
#mesondefine HAVE_CPU_S390
/* Define if the target CPU is a SPARC */
#mesondefine HAVE_CPU_SPARC
/* Define if the target CPU is a x86_64 */
#mesondefine HAVE_CPU_X86_64
/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
#mesondefine HAVE_DCGETTEXT
/* Define to 1 if you have the <dlfcn.h> header file. */
#mesondefine HAVE_DLFCN_H
/* define for working do while(0) macros */
#mesondefine HAVE_DOWHILE_MACROS
/* Define to enable dvdread library (used by dvdreadsrc). */
#mesondefine HAVE_DVDREAD
/* Define to enable building of experimental plug-ins. */
#mesondefine HAVE_EXPERIMENTAL
/* Define to enable building of plug-ins with external deps. */
#mesondefine HAVE_EXTERNAL
/* defined if the compiler implements __func__ */
#mesondefine HAVE_FUNC
/* defined if the compiler implements __FUNCTION__ */
#mesondefine HAVE_FUNCTION
/* Define if the GNU gettext() function is already present or preinstalled. */
#mesondefine HAVE_GETTEXT
/* Define if you have the iconv() function and it works. */
#mesondefine HAVE_ICONV
/* Define to 1 if you have the <inttypes.h> header file. */
#mesondefine HAVE_INTTYPES_H
/* Define to enable lame mp3 encoder library (used by lame). */
#mesondefine HAVE_LAME
/* Define to enable mad mp3 decoder (used by mad). */
#mesondefine HAVE_MAD
/* Define to 1 if you have the <malloc.h> header file. */
#mesondefine HAVE_MALLOC_H
/* Define to 1 if you have the <memory.h> header file. */
#mesondefine HAVE_MEMORY_H
/* Define to enable mpeg2dec (used by mpeg2dec). */
#mesondefine HAVE_MPEG2DEC
/* Defined for newer opencore-amrnb */
#mesondefine HAVE_OPENCORE_AMRNB_0_1_3_OR_LATER
/* Defined for newer opencore-amrwb */
#mesondefine HAVE_OPENCORE_AMRWB_0_1_3_OR_LATER
/* Use Orc */
#mesondefine HAVE_ORC
/* defined if the compiler implements __PRETTY_FUNCTION__ */
#mesondefine HAVE_PRETTY_FUNCTION
/* Define if RDTSC is available */
#mesondefine HAVE_RDTSC
/* Define to enable libsidplay (used by sid). */
#mesondefine HAVE_SIDPLAY
/* Define to 1 if you have the <stdint.h> header file. */
#mesondefine HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#mesondefine HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#mesondefine HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#mesondefine HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#mesondefine HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#mesondefine HAVE_SYS_TYPES_H
/* Define to enable twolame (used by twolame). */
#mesondefine HAVE_TWOLAME
/* Define to 1 if you have the <unistd.h> header file. */
#mesondefine HAVE_UNISTD_H
/* Define if valgrind should be used */
#mesondefine HAVE_VALGRIND
/* Define to 1 if you have the <winsock2.h> header file. */
#mesondefine HAVE_WINSOCK2_H
/* Define to enable x264 plug-in (used by x264). */
#mesondefine HAVE_X264
/* the host CPU */
#mesondefine HOST_CPU
/* gettext locale dir */
#mesondefine LOCALEDIR
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#mesondefine LT_OBJDIR
/* Name of package */
#mesondefine PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#mesondefine PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#mesondefine PACKAGE_NAME
/* Define to the full name and version of this package. */
#mesondefine PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#mesondefine PACKAGE_TARNAME
/* Define to the home page for this package. */
#mesondefine PACKAGE_URL
/* Define to the version of this package. */
#mesondefine PACKAGE_VERSION
/* directory where plugins are located */
#mesondefine PLUGINDIR
/* The size of `char', as computed by sizeof. */
#mesondefine SIZEOF_CHAR
/* The size of `int', as computed by sizeof. */
#mesondefine SIZEOF_INT
/* The size of `long', as computed by sizeof. */
#mesondefine SIZEOF_LONG
/* The size of `short', as computed by sizeof. */
#mesondefine SIZEOF_SHORT
/* The size of `void*', as computed by sizeof. */
#mesondefine SIZEOF_VOIDP
/* Define to 1 if you have the ANSI C header files. */
#mesondefine STDC_HEADERS
/* the target CPU */
#mesondefine TARGET_CPU
/* Version number of package */
#mesondefine VERSION
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif

12
ext/a52dec/meson.build Normal file
View file

@ -0,0 +1,12 @@
a52_dep = cc.find_library('a52', required : false)
if a52_dep.found() and cc.has_header_symbol('a52dec/a52.h', 'a52_init', prefix : '#include <stdint.h>')
a52dec = library('gsta52dec',
'gsta52dec.c',
c_args : ugly_args,
include_directories : [configinc],
dependencies : [gstaudio_dep, orc_dep, a52_dep],
install : true,
install_dir : plugins_install_dir,
)
endif

12
ext/amrnb/meson.build Normal file
View file

@ -0,0 +1,12 @@
amrnb_dep = dependency('opencore-amrnb', version : '>= 0.1.3', required : false)
if amrnb_dep.found()
amrnb = library('gstamrnb',
['amrnb.c', 'amrnbdec.c', 'amrnbenc.c'],
c_args : ugly_args,
include_directories : [configinc],
dependencies : [gstaudio_dep, amrnb_dep],
install : true,
install_dir : plugins_install_dir,
)
endif

12
ext/amrwbdec/meson.build Normal file
View file

@ -0,0 +1,12 @@
amrwb_dep = dependency('opencore-amrwb', version : '>= 0.1.3', required : false)
if amrwb_dep.found()
amrwbdec = library('gstamrwbdec',
['amrwb.c', 'amrwbdec.c'],
c_args : ugly_args,
include_directories : [configinc],
dependencies : [gstaudio_dep, amrwb_dep],
install : true,
install_dir : plugins_install_dir,
)
endif

12
ext/cdio/meson.build Normal file
View file

@ -0,0 +1,12 @@
cdio_dep = dependency('libcdio', version : '>= 0.76', required : false)
if cdio_dep.found()
cdio = library('gstcdio',
['gstcdio.c', 'gstcdiocddasrc.c'],
c_args : ugly_args,
include_directories : [configinc, libsinc],
dependencies : [gstaudio_dep, gsttag_dep, cdio_dep],
install : true,
install_dir : plugins_install_dir,
)
endif

13
ext/dvdread/meson.build Normal file
View file

@ -0,0 +1,13 @@
gmodule_dep = dependency('gmodule-2.0', required : false)
dvdread_dep = dependency('dvdread', version : '>= 0.5.0', required : false)
if gmodule_dep.found() and dvdread_dep.found()
dvdread = library('gstdvdread',
['dvdreadsrc.c'],
c_args : ugly_args,
include_directories : [configinc, libsinc],
dependencies : [gstbase_dep, gmodule_dep, dvdread_dep],
install : true,
install_dir : plugins_install_dir,
)
endif

19
ext/lame/meson.build Normal file
View file

@ -0,0 +1,19 @@
lame_dep = cc.find_library('mp3lame', required : false)
if lame_dep.found() and cc.has_header_symbol('lame/lame.h', 'lame_init')
lame_extra_c_args = []
if cc.has_header_symbol('lame/lame.h', 'lame_set_VBR_quality')
lame_extra_c_args += ['-DHAVE_LAME_SET_VBR_QUALITY']
endif
if cc.has_header_symbol('lame/lame.h', 'MEDIUM')
lame_extra_c_args += ['-DGSTLAME_PRESET']
endif
lame = library('gstlame',
['gstlamemp3enc.c', 'plugin.c'],
c_args : ugly_args + lame_extra_c_args,
include_directories : [configinc, libsinc],
dependencies : [gstaudio_dep, lame_dep],
install : true,
install_dir : plugins_install_dir,
)
endif

15
ext/mad/meson.build Normal file
View file

@ -0,0 +1,15 @@
mad_dep = dependency('mad', version : '>= 0.15', required : false)
if not mad_dep.found() and cc.has_header_symbol('mad.h', 'mad_decoder_finish')
mad_dep = cc.find_library('mad', required : false)
endif
if mad_dep.found()
mad = library('gstmad',
['gstmad.c'],
c_args : ugly_args,
include_directories : [configinc],
dependencies : [gstaudio_dep, mad_dep],
install : true,
install_dir : plugins_install_dir,
)
endif

12
ext/meson.build Normal file
View file

@ -0,0 +1,12 @@
subdir('a52dec')
subdir('amrnb')
subdir('amrwbdec')
subdir('cdio')
subdir('dvdread')
subdir('lame')
subdir('mad')
subdir('mpeg2dec')
subdir('mpg123')
#subdir('sidplay') # FIXME
subdir('twolame')
subdir('x264')

12
ext/mpeg2dec/meson.build Normal file
View file

@ -0,0 +1,12 @@
mpeg2_dep = dependency('libmpeg2', version : '>= 0.4.0', required : false)
if mpeg2_dep.found()
mpeg2dec = library('gstmpeg2dec',
['gstmpeg2dec.c'],
c_args : ugly_args,
include_directories : [configinc],
dependencies : [gstvideo_dep, mpeg2_dep],
install : true,
install_dir : plugins_install_dir,
)
endif

16
ext/mpg123/meson.build Normal file
View file

@ -0,0 +1,16 @@
mpg123_sources = [
'gstmpg123audiodec.c',
]
mpg123_dep = dependency('libmpg123', version : '>= 1.3', required : false)
if mpg123_dep.found()
gstmpg123 = library('gstmpg123',
mpg123_sources,
c_args : ugly_args,
include_directories : [configinc],
dependencies : [gstaudio_dep, mpg123_dep],
install : true,
install_dir : plugins_install_dir,
)
endif

12
ext/twolame/meson.build Normal file
View file

@ -0,0 +1,12 @@
twolame_dep = dependency('twolame', version : '>= 0.3.10', required : false)
if twolame_dep.found()
twolame = library('gsttwolame',
['gsttwolamemp2enc.c'],
c_args : ugly_args,
include_directories : [configinc, libsinc],
dependencies : [gstaudio_dep, twolame_dep],
install : true,
install_dir : plugins_install_dir,
)
endif

16
ext/x264/meson.build Normal file
View file

@ -0,0 +1,16 @@
x264_sources = [
'gstx264enc.c',
]
x264_dep = dependency('x264', required : false)
if x264_dep.found()
gstx264 = library('gstx264',
x264_sources,
c_args : ugly_args,
include_directories : [configinc],
dependencies : [gstbase_dep, gstvideo_dep, gstpbutils_dep, x264_dep],
install : true,
install_dir : plugins_install_dir,
)
endif

17
gst/asfdemux/meson.build Normal file
View file

@ -0,0 +1,17 @@
asf_sources = [
'gstasfdemux.c',
'gstasf.c',
'asfheaders.c',
'asfpacket.c',
'gstrtpasfdepay.c',
'gstrtspwms.c',
]
gstasf = library('gstasf',
asf_sources,
c_args : ugly_args,
include_directories : [configinc, libsinc],
dependencies : [gstbase_dep, gstrtp_dep, gstvideo_dep, gstaudio_dep, gsttag_dep, gstriff_dep, gstrtsp_dep],
install : true,
install_dir : plugins_install_dir,
)

View file

@ -0,0 +1,12 @@
dvdpl_sources = [
'gstdvdlpcmdec.c'
]
gstdvdlpcmdec = library('gstdvdlpcmdec',
dvdpl_sources,
c_args : ugly_args,
include_directories : [configinc],
dependencies : [gstbase_dep, gstaudio_dep],
install : true,
install_dir : plugins_install_dir,
)

13
gst/dvdsub/meson.build Normal file
View file

@ -0,0 +1,13 @@
dvdsub_sources = [
'gstdvdsubdec.c',
'gstdvdsubparse.c',
]
gstdvdsub = library('gstdvdsub',
dvdsub_sources,
c_args : ugly_args,
include_directories : [configinc],
dependencies : [gstbase_dep, gstvideo_dep],
install : true,
install_dir : plugins_install_dir,
)

5
gst/meson.build Normal file
View file

@ -0,0 +1,5 @@
subdir('asfdemux')
subdir('dvdlpcmdec')
subdir('dvdsub')
subdir('realmedia')
subdir('xingmux')

23
gst/realmedia/meson.build Normal file
View file

@ -0,0 +1,23 @@
real_sources = [
'rademux.c',
'rmdemux.c',
'rmutils.c',
'rdtdepay.c',
'rdtmanager.c',
'rtspreal.c',
'realhash.c',
'asmrules.c',
'rdtjitterbuffer.c',
'gstrdtbuffer.c',
'pnmsrc.c',
'realmedia.c'
]
gstrmdemux = library('gstrmdemux',
real_sources,
c_args : ugly_args,
include_directories : [configinc, libsinc],
dependencies : [gstbase_dep, gstrtsp_dep, gstsdp_dep, gstpbutils_dep],
install : true,
install_dir : plugins_install_dir,
)

13
gst/xingmux/meson.build Normal file
View file

@ -0,0 +1,13 @@
xing_sources = [
'plugin.c',
'gstxingmux.c',
]
gstxingmux = library('gstxingmux',
xing_sources,
c_args : ugly_args,
include_directories : [configinc],
dependencies : [gstbase_dep],
install : true,
install_dir : plugins_install_dir,
)

125
meson.build Normal file
View file

@ -0,0 +1,125 @@
project('gst-plugins-ugly', 'c',
version : '1.9.1.1',
meson_version : '>= 0.32.0',
default_options : [ 'warning_level=1',
'c_std=gnu99',
'buildtype=debugoptimized' ])
gst_version = meson.project_version()
version_arr = gst_version.split('.')
gst_version_major = version_arr[0]
gst_version_minor = version_arr[1]
gst_version_micro = version_arr[2]
if version_arr.length() == 4
gst_version_nano = version_arr[3]
else
gst_version_nano = 0
endif
glib_req = '>= 2.40.0'
gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
api_version = '1.0'
plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
cc = meson.get_compiler('c')
cdata = configuration_data()
check_headers = [
['HAVE_DLFCN_H', 'dlfcn.h'],
['HAVE_INTTYPES_H', 'inttypes.h'],
['HAVE_MALLOC_H', 'malloc.h'],
['HAVE_MEMORY_H', 'memory.h'],
['HAVE_STDINT_H', 'stdint.h'],
['HAVE_STDLIB_H', 'stdlib.h'],
['HAVE_STRINGS_H', 'strings.h'],
['HAVE_STRING_H', 'string.h'],
['HAVE_SYS_STAT_H', 'sys/stat.h'],
['HAVE_SYS_TYPES_H', 'sys/types.h'],
['HAVE_UNISTD_H', 'unistd.h'],
['HAVE_WINSOCK2_H', 'winsock2.h'],
]
foreach h : check_headers
if cc.has_header(h.get(1))
cdata.set(h.get(0), 1)
endif
endforeach
check_functions = [
# check token HAVE_CPU_ALPHA
# check token HAVE_CPU_ARM
# check token HAVE_CPU_CRIS
# check token HAVE_CPU_CRISV32
# check token HAVE_CPU_HPPA
# check token HAVE_CPU_I386
# check token HAVE_CPU_IA64
# check token HAVE_CPU_M68K
# check token HAVE_CPU_MIPS
# check token HAVE_CPU_PPC
# check token HAVE_CPU_PPC64
# check token HAVE_CPU_S390
# check token HAVE_CPU_SPARC
# check token HAVE_CPU_X86_64
['HAVE_DCGETTEXT', 'dcgettext'],
# check token HAVE_EXPERIMENTAL
# check token HAVE_EXTERNAL
# check token HAVE_GETTEXT
# check token HAVE_VALGRIND
]
foreach f : check_functions
if cc.has_function(f.get(1))
cdata.set(f.get(0), 1)
endif
endforeach
cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
cdata.set('SIZEOF_INT', cc.sizeof('int'))
cdata.set('SIZEOF_LONG', cc.sizeof('long'))
cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
cdata.set('VERSION', '"@0@"'.format(gst_version))
cdata.set('PACKAGE', '"gst-plugins-ugly"')
cdata.set('GETTEXT_PACKAGE', '"gst-plugins-ugly-1.0"')
cdata.set('GST_PACKAGE_NAME', '"GStreamer Ugly Plug-ins"')
cdata.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"')
cdata.set('GST_LICENSE', '"LGPL"')
# Mandatory GST deps
gst_dep = dependency('gstreamer-1.0', version : gst_req)
gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req)
gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req)
gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req)
gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req)
gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req)
gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req)
gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req)
gstriff_dep = dependency('gstreamer-riff-1.0', version : gst_req)
gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req)
gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req)
gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req)
gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req)
gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req)
gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req)
orc_dep = dependency('orc-0.4', version : '>= 0.4.16', required : false)
if orc_dep.found()
cdata.set('HAVE_ORC', 1) # used by a52dec for cpu detection
else
cdata.set('DISABLE_ORC', 1)
endif
configure_file(input : 'config.h.meson',
output : 'config.h',
configuration : cdata)
ugly_args = ['-DHAVE_CONFIG_H']
configinc = include_directories('.')
libsinc = include_directories('gst-libs')
subdir('gst')
subdir('ext')
# TODO
#subdir('tests')