Add support for Meson as alternative/parallel build system

https://github.com/mesonbuild/meson
This commit is contained in:
Tim-Philipp Müller 2016-01-27 01:03:52 +00:00
parent e9cab27226
commit a353e50747
9 changed files with 271 additions and 0 deletions

16
config.h.meson Normal file
View file

@ -0,0 +1,16 @@
#mesondefine ENABLE_NLS
#mesondefine GETTEXT_PACKAGE
#mesondefine GST_API_VERSION
#mesondefine GST_LICENSE
#mesondefine GST_PACKAGE_NAME
#mesondefine GST_PACKAGE_ORIGIN
#mesondefine GST_PACKAGE_RELEASE_DATETIME
#mesondefine LOCALEDIR
#mesondefine PACKAGE
#mesondefine PACKAGE_BUGREPORT
#mesondefine PACKAGE_NAME
#mesondefine PACKAGE_STRING
#mesondefine PACKAGE_TARNAME
#mesondefine PACKAGE_URL
#mesondefine PACKAGE_VERSION
#mesondefine VERSION

35
examples/meson.build Normal file
View file

@ -0,0 +1,35 @@
examples = [
'test-appsrc',
'test-auth',
'test-launch',
'test-mp4',
'test-multicast2',
'test-multicast',
'test-netclock',
'test-netclock-client',
'test-ogg',
'test-readme',
'test-record-auth',
'test-record',
'test-sdp',
'test-uri',
'test-video',
'test-video-rtx',
]
foreach example : examples
executable(example, '@0@.c'.format(example),
c_args : rtspserver_args,
include_directories : rtspserver_incs,
dependencies : [glib_dep, gst_dep, gstnet_dep, gst_rtsp_server_dep],
install: false)
endforeach
cgroup_dep = dependency('libcgroup', version : '>= 0.26', required : false)
if cgroup_dep.found()
executable('test-cgroups', 'test-cgroups.c',
c_args : rtspserver_args,
include_directories : rtspserver_incs,
dependencies : [glib_dep, gst_dep, gstnet_dep, gst_rtsp_server_dep, cgroup_dep],
install: false)
endif

2
gst/meson.build Normal file
View file

@ -0,0 +1,2 @@
subdir('rtsp-server')
subdir('rtsp-sink')

View file

@ -0,0 +1,58 @@
rtsp_server_sources = [
'rtsp-address-pool.c',
'rtsp-auth.c',
'rtsp-client.c',
'rtsp-context.c',
'rtsp-media.c',
'rtsp-media-factory.c',
'rtsp-media-factory-uri.c',
'rtsp-mount-points.c',
'rtsp-params.c',
'rtsp-permissions.c',
'rtsp-sdp.c',
'rtsp-server.c',
'rtsp-session.c',
'rtsp-session-media.c',
'rtsp-session-pool.c',
'rtsp-stream.c',
'rtsp-stream-transport.c',
'rtsp-thread-pool.c',
'rtsp-token.c',
]
rtsp_server_headers = [
'rtsp-auth.h',
'rtsp-address-pool.h',
'rtsp-context.h',
'rtsp-params.h',
'rtsp-sdp.h',
'rtsp-thread-pool.h',
'rtsp-media.h',
'rtsp-media-factory.h',
'rtsp-media-factory-uri.h',
'rtsp-mount-points.h',
'rtsp-permissions.h',
'rtsp-stream.h',
'rtsp-stream-transport.h',
'rtsp-session.h',
'rtsp-session-media.h',
'rtsp-session-pool.h',
'rtsp-token.h',
'rtsp-client.h',
'rtsp-server.h',
]
install_headers(rtsp_server_headers, subdir : 'gstreamer-1.0/gst/rtsp-server')
gst_rtsp_server = library('gstrtspserver-@0@'.format(api_version),
rtsp_server_sources,
include_directories : rtspserver_incs,
c_args: rtspserver_args,
version : libversion,
soversion : soversion,
install : true,
dependencies : [gstrtsp_dep, gstrtp_dep, gstsdp_dep, gstnet_dep, gstapp_dep],
)
gst_rtsp_server_dep = declare_dependency(link_with : gst_rtsp_server,
include_directories : rtspserver_incs,
dependencies : [gstrtsp_dep, gstrtp_dep, gstsdp_dep, gstnet_dep, gstapp_dep])

12
gst/rtsp-sink/meson.build Normal file
View file

@ -0,0 +1,12 @@
rtspsink_sources = [
'gstrtspclientsink.c',
'plugin.c',
]
rtspsink = library('gstrtspclientsink',
rtspsink_sources,
c_args : rtspserver_args,
include_directories : rtspserver_incs,
dependencies : [gstrtsp_dep, gstsdp_dep, gst_rtsp_server_dep],
install : true,
install_dir : plugins_install_dir)

58
meson.build Normal file
View file

@ -0,0 +1,58 @@
project('gst-rtsp-server', 'c',
version : '1.9.1.1',
meson_version : '>= 0.33.0',
default_options : ['warning_level=1', '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'
soversion = 0
# maintaining compatibility with the previous libtool versioning
# current = minor * 100 + micro
libversion = '@0@.@1@.0'.format(soversion, gst_version_minor.to_int() * 100 + gst_version_micro.to_int())
plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
cdata = configuration_data()
cdata.set('GETTEXT_PACKAGE', '"gst-rtsp-server-1.0"')
cdata.set('PACKAGE', '"gst-rtsp-server"')
cdata.set('VERSION', '"@0@"'.format(gst_version))
cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
cdata.set('GST_PACKAGE_NAME', '"GStreamer RTSP Server Library"')
cdata.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"')
#cdata.set('GST_API_VERSION', '"@0@"'.format(api_version))
cdata.set('GST_LICENSE', '"LGPL"')
configure_file(input : 'config.h.meson',
output : 'config.h',
configuration : cdata)
rtspserver_args = ['-DHAVE_CONFIG_H']
rtspserver_incs = include_directories('gst/rtsp-server', '.')
glib_dep = dependency('glib-2.0', version : glib_req)
gst_dep = dependency('gstreamer-1.0', version : gst_req)
gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req)
gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req)
gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req)
gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req)
gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req)
gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req)
subdir('gst')
subdir('tests')
subdir('examples')
subdir('pkgconfig')

17
pkgconfig/meson.build Normal file
View file

@ -0,0 +1,17 @@
pkgconf = configuration_data()
pkgconf.set('prefix', get_option('prefix'))
pkgconf.set('exec_prefix', '${prefix}')
pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
pkgconf.set('GST_API_VERSION', api_version)
pkgconf.set('VERSION', gst_version)
pkg_install_dir = '@0@/pkgconfig'.format(get_option('libdir'))
# FIXME: -uninstalled.pc files (if still needed?)
configure_file(input : 'gstreamer-rtsp-server.pc.in',
output : 'gstreamer-rtsp-server-1.0.pc',
configuration : pkgconf,
install_dir : pkg_install_dir,
)

72
tests/check/meson.build Normal file
View file

@ -0,0 +1,72 @@
# FIXME: something is wrong with plugin paths / whitelisting here
test_plugins_modules = [
['gstreamer-1.0', true],
['gstreamer-plugins-base-1.0', true],
['gstreamer-plugins-good-1.0', false],
['gstreamer-plugins-bad-1.0', false],
]
test_plugin_path = ''
foreach m : test_plugins_modules
m_name = m[0]
m_required = m[1]
runcmd = run_command('pkg-config', '--variable=pluginsdir', m_name + ' ' + gst_req)
if runcmd.returncode() == 0
module_plugin_path = runcmd.stdout().strip()
message('Using '+ m_name + ' plugins in ' + module_plugin_path)
if test_plugin_path == ''
test_plugin_path = module_plugin_path
elif module_plugin_path != test_plugin_path
test_plugin_path = test_plugin_path + ':' + module_plugin_path
endif
elif m_required
error('Could not determine ' + m_name + ' plugins directory for unit tests.')
endif
endforeach
test_c_args = [
'-UG_DISABLE_ASSERT',
'-UG_DISABLE_CAST_CHECKS',
'-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_PLUGIN_LOADING_WHITELIST"',
]
test_env = [
'GST_PLUGIN_SYSTEM_PATH_1_0=',
'GST_PLUGIN_PATH_1_0=' + meson.build_root() + '/gst/rtsp-sink:' + test_plugin_path,
'GST_PLUGIN_LOADING_WHITELIST=gstreamer:gst-plugins-base:gst-plugins-good:gst-plugins-bad:gst-rtsp-server',
'CK_DEFAULT_TIMEOUT=120',
]
rtsp_server_tests = [
'gst/addresspool',
'gst/client',
'gst/mountpoints',
'gst/mediafactory',
'gst/media',
'gst/permissions',
'gst/rtspserver',
'gst/rtspclientsink',
'gst/sessionmedia',
'gst/sessionpool',
'gst/stream',
'gst/threadpool',
'gst/token',
]
all_env = ''
foreach e : test_env
all_env = all_env + ' ' + e
endforeach
message('test env:' + all_env)
foreach test_name : rtsp_server_tests
exe = executable(test_name, '@0@.c'.format(test_name),
include_directories : rtspserver_incs,
c_args : rtspserver_args + test_c_args,
dependencies : [gstcheck_dep, gstrtsp_dep, gstrtp_dep, gst_rtsp_server_dep]
)
test(test_name, exe,
env : test_env + [ 'GST_REGISTRY=@0@/@1@.registry'.format(meson.current_build_dir(), test_name) ],
timeout : 120,
)
endforeach

1
tests/meson.build Normal file
View file

@ -0,0 +1 @@
#subdir('check') # FIXME