From 6cddb1a16d819fd72b151e7c6e68d4fa655ff159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Wed, 8 Sep 2021 20:44:12 +0200 Subject: [PATCH] meson: Cleanup build files Remove some twice declared variables and keep code style --- bin/meson.build | 8 ++--- data/meson.build | 9 +++-- lib/gst/clapper/meson.build | 42 +++++++++++------------ lib/meson.build | 68 +++++++++++++++++-------------------- meson.build | 23 +++++++------ meson_options.txt | 16 ++++----- 6 files changed, 81 insertions(+), 85 deletions(-) diff --git a/bin/meson.build b/bin/meson.build index 4e1bc8fa..be5635c6 100644 --- a/bin/meson.build +++ b/bin/meson.build @@ -9,21 +9,21 @@ foreach id_postfix : clapper_apps bin_conf.set('PACKAGE_VERSION', meson.project_version()) bin_conf.set('ID_POSTFIX', id_postfix) bin_conf.set('prefix', get_option('prefix')) - bin_conf.set('libdir', join_paths(get_option('prefix'), get_option('libdir'))) - bin_conf.set('datadir', join_paths(get_option('prefix'), get_option('datadir'))) + bin_conf.set('libdir', libdir) + bin_conf.set('datadir', datadir) configure_file( input: 'com.github.rafostar.Clapper.in', output: 'com.github.rafostar.Clapper' + app_postfix, configuration: bin_conf, install: true, - install_dir: get_option('bindir'), + install_dir: bindir, install_mode: 'rwxr-xr-x' ) endforeach clapper_symlink_cmd = 'ln -fs @0@ $DESTDIR@1@'.format( 'com.github.rafostar.Clapper', - join_paths(get_option('prefix'), get_option('bindir'), 'clapper') + join_paths(bindir, 'clapper') ) meson.add_install_script('sh', '-c', clapper_symlink_cmd) diff --git a/data/meson.build b/data/meson.build index 66874a6f..8ad2370c 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,4 +1,3 @@ -sharedir = join_paths(get_option('prefix'), 'share') iconsdir = join_paths(sharedir, 'icons', 'hicolor') appstream_util = find_program('appstream-util', required: false) @@ -16,16 +15,16 @@ install_data('com.github.rafostar.Clapper-symbolic.svg', install_dir: join_paths(iconsdir, 'symbolic', 'apps') ) install_data('com.github.rafostar.Clapper.gschema.xml', - install_dir: join_paths(sharedir, 'glib-2.0', 'schemas') + install_dir: join_paths(datadir, 'glib-2.0', 'schemas') ) install_data('com.github.rafostar.Clapper.xml', - install_dir: join_paths(sharedir, 'mime', 'packages') + install_dir: join_paths(datadir, 'mime', 'packages') ) install_data('com.github.rafostar.Clapper.desktop', - install_dir: join_paths(sharedir, 'applications') + install_dir: join_paths(datadir, 'applications') ) install_data('com.github.rafostar.Clapper.metainfo.xml', - install_dir: join_paths(sharedir, 'metainfo') + install_dir: join_paths(datadir, 'metainfo') ) gnome.compile_resources('com.github.rafostar.Clapper.data', 'com.github.rafostar.Clapper.data.gresource.xml', diff --git a/lib/gst/clapper/meson.build b/lib/gst/clapper/meson.build index b54d0e99..f0573bff 100644 --- a/lib/gst/clapper/meson.build +++ b/lib/gst/clapper/meson.build @@ -37,14 +37,14 @@ gstclapper_defines = [ gtk_deps = [gstgl_dep, gstglproto_dep] have_gtk_gl_windowing = false -gtk4_dep = dependency('gtk4', required : true) +gtk4_dep = dependency('gtk4', required: true) if not gtk4_dep.version().version_compare('>=4.0.0') error('GTK4 version on this system is too old') endif if gst_gl_have_window_x11 and (gst_gl_have_platform_egl or gst_gl_have_platform_glx) - gtk_x11_dep = dependency('gtk4-x11', required : false) + gtk_x11_dep = dependency('gtk4-x11', required: false) if gtk_x11_dep.found() gtk_deps += gtk_x11_dep if gst_gl_have_platform_glx @@ -55,7 +55,7 @@ if gst_gl_have_window_x11 and (gst_gl_have_platform_egl or gst_gl_have_platform_ endif if gst_gl_have_window_wayland and gst_gl_have_platform_egl - gtk_wayland_dep = dependency('gtk4-wayland', required : false) + gtk_wayland_dep = dependency('gtk4-wayland', required: false) if gtk_wayland_dep.found() gtk_deps += [gtk_wayland_dep, gstglwayland_dep] have_gtk_gl_windowing = true @@ -78,29 +78,29 @@ gstclapper_mpris_gdbus = gnome.gdbus_codegen('gstclapper-mpris-gdbus', gstclapper = library('gstclapper-' + api_version, gstclapper_sources + gstclapper_mpris_gdbus, - c_args : gstclapper_defines, - link_args : noseh_link_args, - include_directories : [configinc, libsinc], - version : libversion, - install : true, - install_dir : clapper_libdir, - dependencies : [gtk4_dep, glib_dep, gio_dep, + c_args: gstclapper_defines, + link_args: noseh_link_args, + include_directories: [configinc, libsinc], + version: libversion, + install: true, + install_dir: pkglibdir, + dependencies: [gtk4_dep, glib_dep, gio_dep, gstbase_dep, gstvideo_dep, gstaudio_dep, gsttag_dep, gstpbutils_dep, libm] + gtk_deps, ) clapper_gir = gnome.generate_gir(gstclapper, - sources : gstclapper_sources + gstclapper_headers, - namespace : 'GstClapper', - nsversion : api_version, - identifier_prefix : 'Gst', - symbol_prefix : 'gst', - export_packages : 'gstreamer-clapper-1.0', - includes : ['Gst-1.0', 'GstPbutils-1.0', 'GstBase-1.0', 'GstVideo-1.0', + sources: gstclapper_sources + gstclapper_headers, + namespace: 'GstClapper', + nsversion: api_version, + identifier_prefix: 'Gst', + symbol_prefix: 'gst', + export_packages: 'gstreamer-clapper-1.0', + includes: ['Gst-1.0', 'GstPbutils-1.0', 'GstBase-1.0', 'GstVideo-1.0', 'GstAudio-1.0', 'GstTag-1.0'], - install : true, - install_dir_typelib : join_paths(clapper_libdir, 'girepository-1.0'), - extra_args : gir_init_section + ['-DGST_USE_UNSTABLE_API'], - dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep, + install: true, + install_dir_typelib: join_paths(pkglibdir, 'girepository-1.0'), + extra_args: gir_init_section + ['-DGST_USE_UNSTABLE_API'], + dependencies: [gstbase_dep, gstvideo_dep, gstaudio_dep, gsttag_dep, gstpbutils_dep] ) diff --git a/lib/meson.build b/lib/meson.build index 8cc1f9fe..e5c52bfb 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -7,10 +7,6 @@ libversion = meson.project_version() cc = meson.get_compiler('c') cxx = meson.get_compiler('cpp') -clapper_libdir = join_paths( - get_option('prefix'), get_option('libdir'), meson.project_name() -) - cdata = configuration_data() if cc.get_id() == 'msvc' @@ -40,7 +36,7 @@ else endif if cc.has_link_argument('-Wl,-Bsymbolic-functions') - add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c') + add_project_link_arguments('-Wl,-Bsymbolic-functions', language: 'c') endif # Symbol visibility @@ -142,7 +138,7 @@ cdata.set_quoted('PACKAGE_BUGREPORT', 'https://github.com/Rafostar/clapper/issue cdata.set_quoted('PACKAGE_NAME', 'GStreamer Clapper Libs') cdata.set_quoted('GST_API_VERSION', api_version) cdata.set_quoted('GST_LICENSE', 'LGPL') -cdata.set_quoted('LIBDIR', clapper_libdir) +cdata.set_quoted('LIBDIR', pkglibdir) cdata.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))) warning_flags = [ @@ -192,25 +188,25 @@ cdata.set_quoted('GST_PACKAGE_NAME', 'GStreamer Plugins Clapper') cdata.set_quoted('GST_PACKAGE_ORIGIN', 'https://github.com/Rafostar/clapper') # Mandatory GST deps -gst_dep = dependency('gstreamer-1.0', version : gst_req, - fallback : ['gstreamer', 'gst_dep']) -gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req, - fallback : ['gstreamer', 'gst_base_dep']) -gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req, - fallback : ['gst-plugins-base', 'pbutils_dep']) -gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req, - fallback : ['gst-plugins-base', 'audio_dep']) -gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req, - fallback : ['gst-plugins-base', 'tag_dep']) -gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req, - fallback : ['gst-plugins-base', 'video_dep']) +gst_dep = dependency('gstreamer-1.0', version: gst_req, + fallback: ['gstreamer', 'gst_dep']) +gstbase_dep = dependency('gstreamer-base-1.0', version: gst_req, + fallback: ['gstreamer', 'gst_base_dep']) +gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version: gst_req, + fallback: ['gst-plugins-base', 'pbutils_dep']) +gstaudio_dep = dependency('gstreamer-audio-1.0', version: gst_req, + fallback: ['gst-plugins-base', 'audio_dep']) +gsttag_dep = dependency('gstreamer-tag-1.0', version: gst_req, + fallback: ['gst-plugins-base', 'tag_dep']) +gstvideo_dep = dependency('gstreamer-video-1.0', version: gst_req, + fallback: ['gst-plugins-base', 'video_dep']) # GStreamer OpenGL -gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req, - fallback : ['gst-plugins-base', 'gstgl_dep'], required: true) -gstglx11_dep = dependency('', required : false) -gstglwayland_dep = dependency('', required : false) -gstglegl_dep = dependency('', required : false) +gstgl_dep = dependency('gstreamer-gl-1.0', version: gst_req, + fallback: ['gst-plugins-base', 'gstgl_dep'], required: true) +gstglx11_dep = dependency('', required: false) +gstglwayland_dep = dependency('', required: false) +gstglegl_dep = dependency('', required: false) gst_gl_apis = gstgl_dep.get_pkgconfig_variable('gl_apis') gst_gl_winsys = gstgl_dep.get_pkgconfig_variable('gl_winsys') @@ -232,23 +228,23 @@ foreach api : ['gl', 'gles2'] set_variable('gst_gl_have_api_@0@'.format(api), gst_gl_apis.contains(api)) endforeach -gstglproto_dep = dependency('gstreamer-gl-prototypes-1.0', version : gst_req, - fallback : ['gst-plugins-base', 'gstglproto_dep'], required: true) +gstglproto_dep = dependency('gstreamer-gl-prototypes-1.0', version: gst_req, + fallback: ['gst-plugins-base', 'gstglproto_dep'], required: true) if gst_gl_have_window_x11 - gstglx11_dep = dependency('gstreamer-gl-x11-1.0', version : gst_req, - fallback : ['gst-plugins-base', 'gstglx11_dep'], required: true) + gstglx11_dep = dependency('gstreamer-gl-x11-1.0', version: gst_req, + fallback: ['gst-plugins-base', 'gstglx11_dep'], required: true) endif if gst_gl_have_window_wayland - gstglwayland_dep = dependency('gstreamer-gl-wayland-1.0', version : gst_req, - fallback : ['gst-plugins-base', 'gstglwayland_dep'], required: true) + gstglwayland_dep = dependency('gstreamer-gl-wayland-1.0', version: gst_req, + fallback: ['gst-plugins-base', 'gstglwayland_dep'], required: true) endif if gst_gl_have_platform_egl - gstglegl_dep = dependency('gstreamer-gl-egl-1.0', version : gst_req, - fallback : ['gst-plugins-base', 'gstglegl_dep'], required: true) + gstglegl_dep = dependency('gstreamer-gl-egl-1.0', version: gst_req, + fallback: ['gst-plugins-base', 'gstglegl_dep'], required: true) endif -libm = cc.find_library('m', required : false) -glib_dep = dependency('glib-2.0', version : glib_req, fallback: ['glib', 'libglib_dep']) +libm = cc.find_library('m', required: false) +glib_dep = dependency('glib-2.0', version: glib_req, fallback: ['glib', 'libglib_dep']) gmodule_dep = dependency('gmodule-2.0', fallback: ['glib', 'libgmodule_dep']) gio_dep = dependency('gio-2.0', fallback: ['glib', 'libgio_dep']) @@ -259,9 +255,7 @@ cdata.set_quoted('GST_PACKAGE_RELEASE_DATETIME', 'Unknown') configinc = include_directories('.') libsinc = include_directories('gst') -gnome = import('gnome') -gir = find_program('g-ir-scanner', required : true) - +gir = find_program('g-ir-scanner', required: true) if not gir.found() error('Clapper requires GI bindings to be compiled') endif @@ -273,4 +267,4 @@ gir_init_section = ['--add-init-section=extern void gst_init(gint*,gchar**);' + 'gst_init(NULL,NULL);', '--quiet' ] subdir('gst') -configure_file(output : 'config.h', configuration : cdata) +configure_file(output: 'config.h', configuration: cdata) diff --git a/meson.build b/meson.build index 3cb10da6..b055e07c 100644 --- a/meson.build +++ b/meson.build @@ -11,13 +11,13 @@ project('com.github.rafostar.Clapper', 'c', 'cpp', gnome = import('gnome') i18n = import('i18n') python = import('python') -python_bin = python.find_installation('python3') -pkgdatadir = join_paths(get_option('datadir'), meson.project_name()) +bindir = join_paths(get_option('prefix'), get_option('bindir')) +libdir = join_paths(get_option('prefix'), get_option('libdir')) +datadir = join_paths(get_option('prefix'), get_option('datadir')) -if not python_bin.found() - error('No valid python3 binary found') -endif +pkglibdir = join_paths(libdir, meson.project_name()) +pkgdatadir = join_paths(datadir, meson.project_name()) if get_option('clapper-lib') subdir('lib') @@ -28,11 +28,14 @@ if get_option('clapper-player') subdir('data') subdir('po') - installdir = join_paths(get_option('prefix'), 'share', meson.project_name()) - install_subdir('src', install_dir : installdir) - install_subdir('extras', install_dir : installdir) - install_subdir('css', install_dir : installdir) - install_subdir('ui', install_dir : installdir) + install_subdir('src', install_dir: pkgdatadir) + install_subdir('extras', install_dir: pkgdatadir) + install_subdir('css', install_dir: pkgdatadir) + install_subdir('ui', install_dir: pkgdatadir) + python_bin = python.find_installation('python3') + if not python_bin.found() + error('No valid python3 binary found') + endif meson.add_install_script('build-aux/meson/postinstall.py') endif diff --git a/meson_options.txt b/meson_options.txt index 2bfc6599..edb98935 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,20 +1,20 @@ option('clapper-player', - type : 'boolean', - value : true, + type: 'boolean', + value: true, description: 'Build Clapper player' ) option('clapper-lib', - type : 'boolean', - value : true, + type: 'boolean', + value: true, description: 'Build Clapper libs (including API)' ) option('devel-checks', - type : 'boolean', - value : false, + type: 'boolean', + value: false, description: 'GStreamer GLib checks and asserts such as API guards (disable for stable releases)' ) option('deprecated-glib-api', - type : 'boolean', - value : true, + type: 'boolean', + value: true, description: 'Allow using of deprecated GLib API' )