build: Drop checks and workarounds for older Meson versions

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2022-05-05 19:24:30 +01:00
parent 1bdce46399
commit 25ab87d8e5
8 changed files with 24 additions and 75 deletions

View File

@ -17,8 +17,7 @@ variables:
MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v5"
MESON_TEST_TIMEOUT_MULTIPLIER: 2
G_MESSAGES_DEBUG: all
MESON_COMMON_OPTIONS_NO_WARNING: "--buildtype debug --wrap-mode=nodownload"
MESON_COMMON_OPTIONS: "${MESON_COMMON_OPTIONS_NO_WARNING} --fatal-meson-warnings"
MESON_COMMON_OPTIONS: "--buildtype debug --wrap-mode=nodownload --fatal-meson-warnings"
.only-default:
only:
@ -72,10 +71,7 @@ fedora-x86_64:
variables:
CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
script:
# FIXME: Cannot use MESON_COMMON_OPTIONS here because meson warns about gtkdoc
# feature fully functional in 0.54, but we only depend on 0.52. So we cannot build
# with --fatal-meson-warnings.
- meson ${MESON_COMMON_OPTIONS_NO_WARNING}
- meson ${MESON_COMMON_OPTIONS}
--werror
--default-library=both
--prefix=$HOME/glib-installed
@ -564,10 +560,7 @@ dist-job:
only:
- tags
script:
# FIXME: Cannot use MESON_COMMON_OPTIONS here because meson warns about gtkdoc
# feature fully functional in 0.54, but we only depend on 0.52. So we cannot build
# with --fatal-meson-warnings.
- meson ${MESON_COMMON_OPTIONS_NO_WARNING} --buildtype release -Dgtk_doc=true -Dman=true _build
- meson ${MESON_COMMON_OPTIONS} --buildtype release -Dgtk_doc=true -Dman=true _build
- cd _build
- ninja dist
- ninja glib-doc gobject-doc gio-doc

View File

@ -47,9 +47,6 @@ gtkdoc_common_scan_args = [
]
if get_option('gtk_doc')
if not meson.version().version_compare('>=0.52.0')
error('Building documentation requires Meson >= 0.52.0.')
endif
# Check we have the minimum gtk-doc version required. Older versions won't
# generate correct documentation.
dependency('gtk-doc', version : '>=1.32.1',

View File

@ -829,17 +829,12 @@ schemas_subdir = join_paths('glib-2.0', 'schemas')
libgio_dep = declare_dependency(link_with : libgio,
dependencies : [libgmodule_dep, libgobject_dep, gioenumtypes_dep],
include_directories : [gioinc])
# Work around variables kwarg requiring Meson 0.56
if meson.version().version_compare('>=0.56.0')
libgio_dep = declare_dependency(dependencies: libgio_dep,
variables: [
'schemasdir=' + join_paths(glib_datadir, schemas_subdir),
'giomoduledir=' + glib_giomodulesdir,
]
)
endif
include_directories : [gioinc],
variables : [
'schemasdir=' + join_paths(glib_datadir, schemas_subdir),
'giomoduledir=' + glib_giomodulesdir,
],
)
pkg.generate(libgio,
requires : ['glib-2.0', 'gobject-2.0'],
@ -861,11 +856,7 @@ pkg.generate(libgio,
name : 'GIO',
description : 'glib I/O library',
)
if meson.version().version_compare('>=0.54.0')
meson.override_dependency('gio-2.0', libgio_dep)
endif
meson.override_dependency('gio-2.0', libgio_dep)
if host_system == 'windows'
pkg.generate(requires : ['gobject-2.0', 'gmodule-no-export-2.0', 'gio-2.0'],
@ -876,9 +867,7 @@ if host_system == 'windows'
name : 'GIO Windows specific APIs',
description : 'Windows specific headers for glib I/O library',
)
if meson.version().version_compare('>=0.54.0')
meson.override_dependency('gio-windows-2.0', libgio_dep)
endif
meson.override_dependency('gio-windows-2.0', libgio_dep)
else
pkg.generate(requires : ['gobject-2.0', 'gio-2.0'],
subdirs : ['gio-unix-2.0'],
@ -888,9 +877,7 @@ else
name : 'GIO unix specific APIs',
description : 'unix specific headers for glib I/O library',
)
if meson.version().version_compare('>=0.54.0')
meson.override_dependency('gio-unix-2.0', libgio_dep)
endif
meson.override_dependency('gio-unix-2.0', libgio_dep)
endif
if host_system == 'windows'

View File

@ -401,10 +401,7 @@ pkg.generate(libglib,
name : 'GLib',
description : 'C Utility Library',
)
if meson.version().version_compare('>=0.54.0')
meson.override_dependency('glib-2.0', libglib_dep)
endif
meson.override_dependency('glib-2.0', libglib_dep)
# On Windows, glib needs a spawn helper for g_spawn* API
if host_system == 'windows'
@ -453,11 +450,9 @@ configure_file(
install_data('glib_gdb.py', install_dir : join_paths(glib_pkgdatadir, 'gdb'))
# This is needed to make gdb find glib_gdb.py
if meson.version().version_compare('>=0.58')
env = environment()
env.prepend('PYTHONPATH', meson.current_source_dir())
meson.add_devenv(env)
endif
env = environment()
env.prepend('PYTHONPATH', meson.current_source_dir())
meson.add_devenv(env)
gdb_conf = configuration_data()
gdb_conf.set('datadir', glib_datadir)

View File

@ -126,11 +126,9 @@ libgmodule_dep = declare_dependency(link_with : libgmodule,
include_directories : [gmoduleinc],
dependencies : [libglib_dep])
if meson.version().version_compare('>=0.54.0')
meson.override_dependency('gmodule-no-export-2.0', libgmodule_dep)
meson.override_dependency('gmodule-export-2.0', libgmodule_dep)
meson.override_dependency('gmodule-2.0', libgmodule_dep)
endif
meson.override_dependency('gmodule-no-export-2.0', libgmodule_dep)
meson.override_dependency('gmodule-export-2.0', libgmodule_dep)
meson.override_dependency('gmodule-2.0', libgmodule_dep)
if build_tests
subdir('tests')

View File

@ -150,10 +150,7 @@ pkg.generate(libgobject,
libgobject_dep = declare_dependency(link_with : libgobject,
include_directories : [gobjectinc],
dependencies : [libglib_dep, glib_enumtypes_dep])
if meson.version().version_compare('>=0.54.0')
meson.override_dependency('gobject-2.0', libgobject_dep)
endif
meson.override_dependency('gobject-2.0', libgobject_dep)
executable('gobject-query', 'gobject-query.c',
install : true,
@ -171,11 +168,9 @@ configure_file(
)
# This is needed to make gdb find gobject_gdb.py
if meson.version().version_compare('>=0.58')
env = environment()
env.prepend('PYTHONPATH', meson.current_source_dir())
meson.add_devenv(env)
endif
env = environment()
env.prepend('PYTHONPATH', meson.current_source_dir())
meson.add_devenv(env)
if enable_systemtap
gobject_stp = configure_file(input : 'gobject.stp.in',

View File

@ -34,7 +34,4 @@ pkg.generate(libgthread,
)
libgthread_dep = declare_dependency(link_with : libgthread)
if meson.version().version_compare('>=0.54.0')
meson.override_dependency('gthread-2.0', libgthread_dep)
endif
meson.override_dependency('gthread-2.0', libgthread_dep)

View File

@ -662,19 +662,6 @@ if host_system != 'windows' and cc.has_function('stpcpy', prefix : '#include <st
glib_conf.set('HAVE_STPCPY', 1)
endif
# When building for Android-20 and earlier, require Meson 0.54.2 or newer.
# This is needed, because Meson build versions prior to 0.54.2 return false
# positive for stpcpy has_function check when building for legacy Android.
if host_system == 'android'
android_is_older = cc.compiles('''#if __ANDROID_API__ >= 21
#error Android is 21 or newer
#endif''')
if android_is_older and meson.version().version_compare('< 0.54.2')
error('Compiling for <Android-21 requires Meson 0.54.2 or newer')
endif
endif
if cc.has_function('memalign', prefix: '#include <stdlib.h>\n#include <malloc.h>')
glib_conf.set('HAVE_MEMALIGN', 1)
endif