meson: Use gnome.mkenum_simple()

Meson now uses find_program() to get glib-mkenum from glib instead of
from system. That was already fixed at least in >=0.60 which is our
current minimum requirement.
This commit is contained in:
Xavier Claessens 2022-09-22 14:59:52 -04:00
parent 6dd5c5002a
commit 756b424cce
8 changed files with 30 additions and 226 deletions

View File

@ -19,6 +19,8 @@
* Author: Ryan Lortie <desrt@desrt.ca> * Author: Ryan Lortie <desrt@desrt.ca>
*/ */
#pragma once
#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
#error "Only <gio/gio.h> can be included directly." #error "Only <gio/gio.h> can be included directly."
#endif #endif

View File

@ -1,63 +0,0 @@
/*** BEGIN file-header ***/
/*
* Copyright © 2007 Red Hat, Inc.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
*
* Authors: Matthias Clasen <mclasen@redhat.com>
*/
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif
#include "config.h"
#include "gioenumtypes.h"
#include <gio.h>
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GType
@enum_name@_get_type (void)
{
static gsize static_g_define_type_id = 0;
if (g_once_init_enter (&static_g_define_type_id))
{
static const G@Type@Value values[] = {
/*** END value-header ***/
/*** BEGIN value-production ***/
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
/*** END value-production ***/
/*** BEGIN value-tail ***/
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
g_once_init_leave (&static_g_define_type_id, g_define_type_id);
}
return static_g_define_type_id;
}
/*** END value-tail ***/

View File

@ -1,46 +0,0 @@
/*** BEGIN file-header ***/
/*
* Copyright © 2007 Red Hat, Inc.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
*
* Authors: Matthias Clasen <mclasen@redhat.com>
*/
#ifndef __GIO_ENUM_TYPES_H__
#define __GIO_ENUM_TYPES_H__
#include <glib-object.h>
#include <gio/gio-visibility.h>
G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GIO_AVAILABLE_IN_ALL GType @enum_name@_get_type (void) G_GNUC_CONST;
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/
/*** BEGIN file-tail ***/
G_END_DECLS
#endif /* __GIO_ENUM_TYPES_H__ */
/*** END file-tail ***/

View File

@ -765,29 +765,16 @@ gio_headers += settings_headers
gio_headers += gdbus_headers gio_headers += gdbus_headers
install_headers(gio_headers, install_dir : gio_includedir) install_headers(gio_headers, install_dir : gio_includedir)
# We can't use gnome.mkenums() because the GNOME module looks for glib-mkenums mkenums_header_prefix = '#include <gio/gio-visibility.h>'
# in PATH, which means you can't bootstrap glib with its own glib-mkenums. gioenumtypes = gnome.mkenums_simple('gioenumtypes',
gioenumtypes_h = custom_target('gioenumtypes_h', sources : gio_headers,
output : 'gioenumtypes.h', decorator : 'GIO_AVAILABLE_IN_ALL',
capture : true, body_prefix : mkenums_body_prefix,
input : gio_headers, header_prefix : mkenums_header_prefix,
install : true, install_header : true,
install_dir : gio_includedir, install_dir : join_paths(get_option('includedir'), 'glib-2.0/gio'),
# FIXME: Not needed with Meson >= 0.64.0 )
install_tag: 'devel', gioenumtypes_h = gioenumtypes[1]
command : [python, glib_mkenums,
'--template', files('gioenumtypes.h.template'),
'@INPUT@', gnetworking_h])
gioenumtypes_c = custom_target('gioenumtypes_c',
output : 'gioenumtypes.c',
capture : true,
input : gio_headers,
depends : [gioenumtypes_h],
command : [python, glib_mkenums,
'--template', files('gioenumtypes.c.template'),
'@INPUT@', gnetworking_h])
gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h, glib_enumtypes_h, gvisibility_h]) gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h, glib_enumtypes_h, gvisibility_h])
# inotify # inotify
@ -840,7 +827,7 @@ else
endif endif
libgio = library('gio-2.0', libgio = library('gio-2.0',
gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources, gioenumtypes, gnetworking_h, gio_sources,
gio_dtrace_hdr, gio_dtrace_obj, gio_dtrace_hdr, gio_dtrace_obj,
version : library_version, version : library_version,
soversion : soversion, soversion : soversion,

View File

@ -1,47 +0,0 @@
/*** BEGIN file-header ***/
#include "config.h"
#include "glib-enumtypes.h"
#include <glib-object.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/*** END file-header ***/
/*** BEGIN file-tail ***/
G_GNUC_END_IGNORE_DEPRECATIONS
/*** END file-tail ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GType
@enum_name@_get_type (void)
{
static gsize static_g_define_type_id = 0;
if (g_once_init_enter (&static_g_define_type_id))
{
static const G@Type@Value values[] = {
/*** END value-header ***/
/*** BEGIN value-production ***/
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
/*** END value-production ***/
/*** BEGIN value-tail ***/
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
g_once_init_leave (&static_g_define_type_id, g_define_type_id);
}
return static_g_define_type_id;
}
/*** END value-tail ***/

View File

@ -1,24 +0,0 @@
/*** BEGIN file-header ***/
#ifndef __GOBJECT_ENUM_TYPES_H__
#define __GOBJECT_ENUM_TYPES_H__
#include <glib-object.h>
G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GOBJECT_AVAILABLE_IN_2_60 GType @enum_name@_get_type (void) G_GNUC_CONST;
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/
/*** BEGIN file-tail ***/
G_END_DECLS
#endif /* __GOBJECT_ENUM_TYPES_H__ */
/*** END file-tail ***/

View File

@ -109,39 +109,32 @@ endforeach
# #
# For now, we only include gunicode.h here, since GScriptType is needed for # For now, we only include gunicode.h here, since GScriptType is needed for
# Pango. More headers can be added as needed in future. # Pango. More headers can be added as needed in future.
#
# We can't use gnome.mkenums() because the GNOME module looks for glib-mkenums
# in PATH, which means you can't bootstrap glib with its own glib-mkenums.
glib_enumtypes_input_headers = files( glib_enumtypes_input_headers = files(
'../glib/gunicode.h', '../glib/gunicode.h',
) )
glib_enumtypes_h = custom_target('glib_enumtypes_h', mkenums_body_prefix = '''
output : 'glib-enumtypes.h', #ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
capture : true, #define GLIB_DISABLE_DEPRECATION_WARNINGS
input : glib_enumtypes_input_headers, #endif
install : true, #include "config.h"
install_dir : join_paths(get_option('includedir'), 'glib-2.0/gobject'), '''
install_tag: 'devel',
command : [python, glib_mkenums,
'--template', files('glib-enumtypes.h.template'),
'@INPUT@'])
glib_enumtypes_c = custom_target('glib_enumtypes_c', glib_enumtypes = gnome.mkenums_simple('glib-enumtypes',
output : 'glib-enumtypes.c', sources : glib_enumtypes_input_headers,
capture : true, decorator : 'GOBJECT_AVAILABLE_IN_2_60',
input : glib_enumtypes_input_headers, body_prefix : mkenums_body_prefix,
depends : [glib_enumtypes_h], install_header : true,
command : [python, glib_mkenums, install_dir : join_paths(get_option('includedir'), 'glib-2.0/gobject'),
'--template', files('glib-enumtypes.c.template'), )
'@INPUT@']) glib_enumtypes_h = glib_enumtypes[1]
# Expose as variable to be used by gobject-introspection # Expose as variable to be used by gobject-introspection
# when it includes GLib as a subproject # when it includes GLib as a subproject
glib_types_h = files('glib-types.h') glib_types_h = files('glib-types.h')
libgobject = library('gobject-2.0', libgobject = library('gobject-2.0',
gobject_dtrace_obj, gobject_dtrace_hdr, glib_enumtypes_h, glib_enumtypes_c, gobject_dtrace_obj, gobject_dtrace_hdr, glib_enumtypes,
sources : gobject_sources, sources : gobject_sources,
version : library_version, version : library_version,
soversion : soversion, soversion : soversion,

View File

@ -9,6 +9,8 @@ project('glib', 'c',
] ]
) )
gnome = import('gnome')
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
c_standards = {} c_standards = {}