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" MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v5"
MESON_TEST_TIMEOUT_MULTIPLIER: 2 MESON_TEST_TIMEOUT_MULTIPLIER: 2
G_MESSAGES_DEBUG: all G_MESSAGES_DEBUG: all
MESON_COMMON_OPTIONS_NO_WARNING: "--buildtype debug --wrap-mode=nodownload" MESON_COMMON_OPTIONS: "--buildtype debug --wrap-mode=nodownload --fatal-meson-warnings"
MESON_COMMON_OPTIONS: "${MESON_COMMON_OPTIONS_NO_WARNING} --fatal-meson-warnings"
.only-default: .only-default:
only: only:
@ -72,10 +71,7 @@ fedora-x86_64:
variables: variables:
CFLAGS: "-coverage -ftest-coverage -fprofile-arcs" CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
script: script:
# FIXME: Cannot use MESON_COMMON_OPTIONS here because meson warns about gtkdoc - meson ${MESON_COMMON_OPTIONS}
# 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}
--werror --werror
--default-library=both --default-library=both
--prefix=$HOME/glib-installed --prefix=$HOME/glib-installed
@ -564,10 +560,7 @@ dist-job:
only: only:
- tags - tags
script: script:
# FIXME: Cannot use MESON_COMMON_OPTIONS here because meson warns about gtkdoc - meson ${MESON_COMMON_OPTIONS} --buildtype release -Dgtk_doc=true -Dman=true _build
# 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
- cd _build - cd _build
- ninja dist - ninja dist
- ninja glib-doc gobject-doc gio-doc - ninja glib-doc gobject-doc gio-doc

View File

@ -47,9 +47,6 @@ gtkdoc_common_scan_args = [
] ]
if get_option('gtk_doc') 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 # Check we have the minimum gtk-doc version required. Older versions won't
# generate correct documentation. # generate correct documentation.
dependency('gtk-doc', version : '>=1.32.1', 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, libgio_dep = declare_dependency(link_with : libgio,
dependencies : [libgmodule_dep, libgobject_dep, gioenumtypes_dep], dependencies : [libgmodule_dep, libgobject_dep, gioenumtypes_dep],
include_directories : [gioinc]) include_directories : [gioinc],
variables : [
# Work around variables kwarg requiring Meson 0.56 'schemasdir=' + join_paths(glib_datadir, schemas_subdir),
if meson.version().version_compare('>=0.56.0') 'giomoduledir=' + glib_giomodulesdir,
libgio_dep = declare_dependency(dependencies: libgio_dep, ],
variables: [ )
'schemasdir=' + join_paths(glib_datadir, schemas_subdir),
'giomoduledir=' + glib_giomodulesdir,
]
)
endif
pkg.generate(libgio, pkg.generate(libgio,
requires : ['glib-2.0', 'gobject-2.0'], requires : ['glib-2.0', 'gobject-2.0'],
@ -861,11 +856,7 @@ pkg.generate(libgio,
name : 'GIO', name : 'GIO',
description : 'glib I/O library', description : 'glib I/O library',
) )
meson.override_dependency('gio-2.0', libgio_dep)
if meson.version().version_compare('>=0.54.0')
meson.override_dependency('gio-2.0', libgio_dep)
endif
if host_system == 'windows' if host_system == 'windows'
pkg.generate(requires : ['gobject-2.0', 'gmodule-no-export-2.0', 'gio-2.0'], 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', name : 'GIO Windows specific APIs',
description : 'Windows specific headers for glib I/O library', 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)
meson.override_dependency('gio-windows-2.0', libgio_dep)
endif
else else
pkg.generate(requires : ['gobject-2.0', 'gio-2.0'], pkg.generate(requires : ['gobject-2.0', 'gio-2.0'],
subdirs : ['gio-unix-2.0'], subdirs : ['gio-unix-2.0'],
@ -888,9 +877,7 @@ else
name : 'GIO unix specific APIs', name : 'GIO unix specific APIs',
description : 'unix specific headers for glib I/O library', 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)
meson.override_dependency('gio-unix-2.0', libgio_dep)
endif
endif endif
if host_system == 'windows' if host_system == 'windows'

View File

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

View File

@ -126,11 +126,9 @@ libgmodule_dep = declare_dependency(link_with : libgmodule,
include_directories : [gmoduleinc], include_directories : [gmoduleinc],
dependencies : [libglib_dep]) 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-no-export-2.0', libgmodule_dep) meson.override_dependency('gmodule-export-2.0', libgmodule_dep)
meson.override_dependency('gmodule-export-2.0', libgmodule_dep) meson.override_dependency('gmodule-2.0', libgmodule_dep)
meson.override_dependency('gmodule-2.0', libgmodule_dep)
endif
if build_tests if build_tests
subdir('tests') subdir('tests')

View File

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

View File

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

View File

@ -662,19 +662,6 @@ if host_system != 'windows' and cc.has_function('stpcpy', prefix : '#include <st
glib_conf.set('HAVE_STPCPY', 1) glib_conf.set('HAVE_STPCPY', 1)
endif 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>') if cc.has_function('memalign', prefix: '#include <stdlib.h>\n#include <malloc.h>')
glib_conf.set('HAVE_MEMALIGN', 1) glib_conf.set('HAVE_MEMALIGN', 1)
endif endif