Build libgirepository as a GLib sub-library

The introspection API has lived out of tree far too long. It has the
same ABI guarantees as the rest of GLib, so it has no reason to be split
from the main library.

The gobject-introspection project can depend on libgirepository, and the
language bindings can drop the gobject-introspection-1.0 dependency.
This commit is contained in:
Emmanuele Bassi 2023-10-16 15:24:08 +01:00
parent 7aafd8c7d7
commit af36393e60
18 changed files with 134 additions and 527 deletions

View File

@ -25,9 +25,9 @@ cmph_sources = [
]
cmph_deps = [
glib_dep,
gobject_dep,
cc.find_library('m', required: false),
libglib_dep,
libgobject_dep,
libm,
]
custom_c_args = []
@ -49,7 +49,7 @@ endif
cmph = static_library('cmph',
sources: cmph_sources,
c_args: gi_hidden_visibility_cflags + custom_c_args,
c_args: custom_c_args,
dependencies: cmph_deps,
)
@ -68,8 +68,8 @@ endif
cmph_test = executable('cmph-bdz-test', '../cmph-bdz-test.c',
dependencies: [
cmph_dep,
glib_dep,
gobject_dep,
libglib_dep,
libgobject_dep,
],
c_args: custom_c_args,
)

View File

@ -44,10 +44,10 @@ G_BEGIN_DECLS
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_VFUNC))
GI_AVAILABLE_IN_1_34
GI_AVAILABLE_IN_2_34
gboolean g_callable_info_is_method (GICallableInfo *info);
GI_AVAILABLE_IN_1_34
GI_AVAILABLE_IN_2_34
gboolean g_callable_info_can_throw_gerror (GICallableInfo *info);
GI_AVAILABLE_IN_ALL
@ -88,7 +88,7 @@ void g_callable_info_load_arg (GICallableInfo *info,
gint n,
GIArgInfo *arg);
GI_AVAILABLE_IN_1_34
GI_AVAILABLE_IN_2_34
gboolean g_callable_info_invoke (GICallableInfo *info,
gpointer function,
const GIArgument *in_args,
@ -100,7 +100,7 @@ gboolean g_callable_info_invoke (GICallableInfo *info,
gboolean throws,
GError **error);
GI_AVAILABLE_IN_1_42
GI_AVAILABLE_IN_2_42
GITransfer g_callable_info_get_instance_ownership_transfer (GICallableInfo *info);
G_END_DECLS

View File

@ -73,7 +73,7 @@ GI_AVAILABLE_IN_ALL
GISignalInfo * g_interface_info_get_signal (GIInterfaceInfo *info,
gint n);
GI_AVAILABLE_IN_1_34
GI_AVAILABLE_IN_2_34
GISignalInfo * g_interface_info_find_signal (GIInterfaceInfo *info,
const gchar *name);

View File

@ -87,7 +87,7 @@ const gchar * g_object_info_get_type_init (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_object_info_get_abstract (GIObjectInfo *info);
GI_AVAILABLE_IN_1_70
GI_AVAILABLE_IN_2_70
gboolean g_object_info_get_final (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
@ -159,7 +159,7 @@ GI_AVAILABLE_IN_ALL
GIVFuncInfo * g_object_info_find_vfunc (GIObjectInfo *info,
const gchar *name);
GI_AVAILABLE_IN_1_32
GI_AVAILABLE_IN_2_32
GIVFuncInfo * g_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
const gchar *name,
GIObjectInfo **implementor);

View File

@ -50,10 +50,10 @@ GITypeInfo * g_property_info_get_type (GIPropertyInfo *info);
GI_AVAILABLE_IN_ALL
GITransfer g_property_info_get_ownership_transfer (GIPropertyInfo *info);
GI_AVAILABLE_IN_1_70
GI_AVAILABLE_IN_2_70
GIFunctionInfo *g_property_info_get_setter (GIPropertyInfo *info);
GI_AVAILABLE_IN_1_70
GI_AVAILABLE_IN_2_70
GIFunctionInfo *g_property_info_get_getter (GIPropertyInfo *info);
G_END_DECLS

View File

@ -26,6 +26,8 @@
#include <glib-object.h>
#include <gmodule.h>
#include <gi-visibility.h>
#define __GIREPOSITORY_H_INSIDE__
#include <giarginfo.h>
@ -45,9 +47,7 @@
#include <gitypelib.h>
#include <gitypes.h>
#include <giunioninfo.h>
#include <giversionmacros.h>
#include <givfuncinfo.h>
#include <giversion.h>
G_BEGIN_DECLS
@ -103,7 +103,7 @@ GIRepository *g_irepository_get_default (void);
GI_AVAILABLE_IN_ALL
void g_irepository_prepend_search_path (const char *directory);
GI_AVAILABLE_IN_1_36
GI_AVAILABLE_IN_2_36
void g_irepository_prepend_library_path (const char *directory);
GI_AVAILABLE_IN_ALL
@ -144,7 +144,7 @@ GITypelib * g_irepository_require_private (GIRepository *repository,
GIRepositoryLoadFlags flags,
GError **error);
GI_AVAILABLE_IN_1_44
GI_AVAILABLE_IN_2_44
gchar ** g_irepository_get_immediate_dependencies (GIRepository *repository,
const gchar *namespace_);
@ -159,7 +159,7 @@ GI_AVAILABLE_IN_ALL
GIBaseInfo * g_irepository_find_by_gtype (GIRepository *repository,
GType gtype);
GI_AVAILABLE_IN_1_60
GI_AVAILABLE_IN_2_60
void g_irepository_get_object_gtype_interfaces (GIRepository *repository,
GType gtype,
guint *n_interfaces_out,
@ -245,6 +245,4 @@ void gi_cclosure_marshal_generic (GClosure *closure,
G_END_DECLS
#endif /* __G_IREPOSITORY_H__ */

View File

@ -70,12 +70,12 @@ ffi_type * gi_type_tag_get_ffi_type (GITypeTag type_tag, gboolean
GI_AVAILABLE_IN_ALL
ffi_type * g_type_info_get_ffi_type (GITypeInfo *info);
GI_AVAILABLE_IN_1_32
GI_AVAILABLE_IN_2_32
void gi_type_info_extract_ffi_return_value (GITypeInfo *return_info,
GIFFIReturnValue *ffi_value,
GIArgument *arg);
GI_AVAILABLE_IN_1_72
GI_AVAILABLE_IN_2_72
void gi_type_tag_extract_ffi_return_value (GITypeTag return_tag,
GIInfoType interface_type,
GIFFIReturnValue *ffi_value,
@ -86,7 +86,7 @@ gboolean g_function_info_prep_invoker (GIFunctionInfo *info,
GIFunctionInvoker *invoker,
GError **error);
GI_AVAILABLE_IN_1_32
GI_AVAILABLE_IN_2_32
gboolean g_function_invoker_new_for_address (gpointer addr,
GICallableInfo *info,
GIFunctionInvoker *invoker,
@ -96,28 +96,28 @@ GI_AVAILABLE_IN_ALL
void g_function_invoker_destroy (GIFunctionInvoker *invoker);
GI_DEPRECATED_IN_1_72_FOR(g_callable_info_create_closure)
GI_DEPRECATED_IN_2_72_FOR(g_callable_info_create_closure)
ffi_closure * g_callable_info_prepare_closure (GICallableInfo *callable_info,
ffi_cif *cif,
GIFFIClosureCallback callback,
gpointer user_data);
GI_DEPRECATED_IN_1_72_FOR(g_callable_info_destroy_closure)
GI_DEPRECATED_IN_2_72_FOR(g_callable_info_destroy_closure)
void g_callable_info_free_closure (GICallableInfo *callable_info,
ffi_closure *closure);
GI_AVAILABLE_IN_1_72
GI_AVAILABLE_IN_2_72
ffi_closure * g_callable_info_create_closure (GICallableInfo *callable_info,
ffi_cif *cif,
GIFFIClosureCallback callback,
gpointer user_data);
GI_AVAILABLE_IN_1_72
GI_AVAILABLE_IN_2_72
gpointer * g_callable_info_get_closure_native_address (GICallableInfo *callable_info,
ffi_closure *closure);
GI_AVAILABLE_IN_1_72
GI_AVAILABLE_IN_2_72
void g_callable_info_destroy_closure (GICallableInfo *callable_info,
ffi_closure *closure);

View File

@ -48,7 +48,7 @@ GI_AVAILABLE_IN_ALL
GIFieldInfo * g_struct_info_get_field (GIStructInfo *info,
gint n);
GI_AVAILABLE_IN_1_46
GI_AVAILABLE_IN_2_46
GIFieldInfo * g_struct_info_find_field (GIStructInfo *info,
const gchar *name);
@ -75,10 +75,10 @@ gboolean g_struct_info_is_gtype_struct (GIStructInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_struct_info_is_foreign (GIStructInfo *info);
GI_AVAILABLE_IN_1_76
GI_AVAILABLE_IN_2_76
const char * g_struct_info_get_copy_function (GIStructInfo *info);
GI_AVAILABLE_IN_1_76
GI_AVAILABLE_IN_2_76
const char * g_struct_info_get_free_function (GIStructInfo *info);
G_END_DECLS

View File

@ -134,24 +134,24 @@ gboolean g_type_info_is_zero_terminated (GITypeInfo *info);
GI_AVAILABLE_IN_ALL
GIArrayType g_type_info_get_array_type (GITypeInfo *info);
GI_AVAILABLE_IN_1_66
GI_AVAILABLE_IN_2_66
GITypeTag g_type_info_get_storage_type (GITypeInfo *info);
GI_AVAILABLE_IN_1_66
GI_AVAILABLE_IN_2_66
void g_type_info_argument_from_hash_pointer (GITypeInfo *info,
gpointer hash_pointer,
GIArgument *arg);
GI_AVAILABLE_IN_1_66
GI_AVAILABLE_IN_2_66
gpointer g_type_info_hash_pointer_from_argument (GITypeInfo *info,
GIArgument *arg);
GI_AVAILABLE_IN_1_72
GI_AVAILABLE_IN_2_72
void gi_type_tag_argument_from_hash_pointer (GITypeTag storage_type,
gpointer hash_pointer,
GIArgument *arg);
GI_AVAILABLE_IN_1_72
GI_AVAILABLE_IN_2_72
gpointer gi_type_tag_hash_pointer_from_argument (GITypeTag storage_type,
GIArgument *arg);

View File

@ -29,7 +29,7 @@
#include <glib.h>
#include <giversionmacros.h>
#include <gi-visibility.h>
G_BEGIN_DECLS

View File

@ -27,8 +27,6 @@
#error "Only <girepository.h> can be included directly."
#endif
#include <giversionmacros.h>
G_BEGIN_DECLS
typedef struct _GIBaseInfoStub {
@ -513,4 +511,3 @@ typedef struct _GITypelib GTypelib;
G_END_DECLS
#endif /* __GITYPES_H__ */

View File

@ -77,10 +77,10 @@ gsize g_union_info_get_size (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
gsize g_union_info_get_alignment (GIUnionInfo *info);
GI_AVAILABLE_IN_1_76
GI_AVAILABLE_IN_2_76
const char * g_union_info_get_copy_function (GIUnionInfo *info);
GI_AVAILABLE_IN_1_76
GI_AVAILABLE_IN_2_76
const char * g_union_info_get_free_function (GIUnionInfo *info);
G_END_DECLS

View File

@ -1,114 +0,0 @@
/* Copyright (C) 2018 Christoph Reiter
*
* 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 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <girepository.h>
/**
* SECTION:giversion
* @Title: Version Information
* @Short_description: macros and functions to check the girepository version
*/
/**
* GI_MAJOR_VERSION:
*
* The major version number of the girepository library.
*
* Since: 1.60
*/
/**
* GI_MINOR_VERSION:
*
* The minor version number of the girepository library.
*
* Since: 1.60
*/
/**
* GI_MICRO_VERSION:
*
* The micro version number of the girepository library.
*
* Since: 1.60
*/
/**
* GI_CHECK_VERSION:
* @major: the major version to check for
* @minor: the minor version to check for
* @micro: the micro version to check for
*
* Checks the version of the girepository library that is being compiled
* against.
*
* Returns: %TRUE if the version of the girepository header files
* is the same as or newer than the passed-in version.
*
* Since: 1.60
*/
/**
* gi_get_major_version:
*
* Returns the major version number of the girepository library.
* (e.g. in version 1.58.2 this is 1.)
*
* Returns: the major version number of the girepository library
*
* Since: 1.60
*/
guint
gi_get_major_version (void)
{
return GI_MAJOR_VERSION;
}
/**
* gi_get_minor_version:
*
* Returns the minor version number of the girepository library.
* (e.g. in version 1.58.2 this is 58.)
*
* Returns: the minor version number of the girepository library
*
* Since: 1.60
*/
guint
gi_get_minor_version (void)
{
return GI_MINOR_VERSION;
}
/**
* gi_get_micro_version:
*
* Returns the micro version number of the girepository library.
* (e.g. in version 1.58.2 this is 2.)
*
* Returns: the micro version number of the girepository library
*
* Since: 1.60
*/
guint
gi_get_micro_version (void)
{
return GI_MICRO_VERSION;
}

View File

@ -1,47 +0,0 @@
/* Copyright (C) 2018 Christoph Reiter
*
* 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 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GIVERISON_H__
#define __GIVERISON_H__
#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
#error "Only <girepository.h> can be included directly."
#endif
G_BEGIN_DECLS
#define GI_MAJOR_VERSION @GI_MAJOR_VERSION@
#define GI_MINOR_VERSION @GI_MINOR_VERSION@
#define GI_MICRO_VERSION @GI_MICRO_VERSION@
#define GI_CHECK_VERSION(major,minor,micro) \
(GI_MAJOR_VERSION > (major) || \
(GI_MAJOR_VERSION == (major) && GI_MINOR_VERSION > (minor)) || \
(GI_MAJOR_VERSION == (major) && GI_MINOR_VERSION == (minor) && \
GI_MICRO_VERSION >= (micro)))
GI_AVAILABLE_IN_1_60
guint gi_get_major_version (void) G_GNUC_CONST;
GI_AVAILABLE_IN_1_60
guint gi_get_minor_version (void) G_GNUC_CONST;
GI_AVAILABLE_IN_1_60
guint gi_get_micro_version (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GIVERISON_H__ */

View File

@ -1,226 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
* GObject introspection: Versioning and export macros
*
* Copyright (C) 2014 Chun-wei Fan
*
* 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 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <glib.h>
#ifndef __GIVERSIONMACROS_H__
#define __GIVERSIONMACROS_H__
#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
#error "Only <girepository.h> can be included directly."
#endif
#ifndef _GI_EXTERN
#define _GI_EXTERN extern
#endif
#ifndef GI_DISABLE_DEPRECATION_WARNINGS
# define GI_DEPRECATED G_DEPRECATED _GI_EXTERN
# define GI_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GI_EXTERN
# define GI_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj, min) _GI_EXTERN
#else
# define GI_DEPRECATED _GI_EXTERN
# define GI_DEPRECATED_FOR(f) _GI_EXTERN
# define GI_UNAVAILABLE(maj,min) _GI_EXTERN
#endif
#define GI_AVAILABLE_IN_ALL _GI_EXTERN
/* XXX: Every new stable minor release should add a set of macros here
*
* We are using the GLib versions here as the G-I minor versions
* need to be in sync with the GLib minor versions. Api's added
* at or before 1.30 are marked as GI_AVAILABLE_IN_ALL
*/
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
# define GI_DEPRECATED_IN_1_32 GI_DEPRECATED
# define GI_DEPRECATED_IN_1_32_FOR(f) GI_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_32 _GI_EXTERN
# define GI_DEPRECATED_IN_1_32_FOR(f) _GI_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
# define GI_AVAILABLE_IN_1_32 GI_UNAVAILABLE(2, 32)
#else
# define GI_AVAILABLE_IN_1_32 _GI_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
# define GI_DEPRECATED_IN_1_34 GI_DEPRECATED
# define GI_DEPRECATED_IN_1_34_FOR(f) GI_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_34 _GI_EXTERN
# define GI_DEPRECATED_IN_1_34_FOR(f) _GI_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
# define GI_AVAILABLE_IN_1_34 GI_UNAVAILABLE(2, 34)
#else
# define GI_AVAILABLE_IN_1_34 _GI_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36
# define GI_DEPRECATED_IN_1_36 GI_DEPRECATED
# define GI_DEPRECATED_IN_1_36_FOR(f) GI_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_36 _GI_EXTERN
# define GI_DEPRECATED_IN_1_36_FOR(f) _GI_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
# define GI_AVAILABLE_IN_1_36 GI_UNAVAILABLE(2, 36)
#else
# define GI_AVAILABLE_IN_1_36 _GI_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38
# define GI_DEPRECATED_IN_1_38 GI_DEPRECATED
# define GI_DEPRECATED_IN_1_38_FOR(f) GI_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_38 _GI_EXTERN
# define GI_DEPRECATED_IN_1_38_FOR(f) _GI_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
# define GI_AVAILABLE_IN_1_38 GI_UNAVAILABLE(2, 38)
#else
# define GI_AVAILABLE_IN_1_38 _GI_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40
# define GI_DEPRECATED_IN_1_40 GI_DEPRECATED
# define GI_DEPRECATED_IN_1_40_FOR(f) GI_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_40 _GI_EXTERN
# define GI_DEPRECATED_IN_1_40_FOR(f) _GI_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40
# define GI_AVAILABLE_IN_1_40 GI_UNAVAILABLE(2, 40)
#else
# define GI_AVAILABLE_IN_1_40 _GI_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_42
# define GI_DEPRECATED_IN_1_42 GI_DEPRECATED
# define GI_DEPRECATED_IN_1_42_FOR(f) GI_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_42 _GI_EXTERN
# define GI_DEPRECATED_IN_1_42_FOR(f) _GI_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_42
# define GI_AVAILABLE_IN_1_42 GI_UNAVAILABLE(2, 42)
#else
# define GI_AVAILABLE_IN_1_42 _GI_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_44
# define GI_DEPRECATED_IN_1_44 GI_DEPRECATED
# define GI_DEPRECATED_IN_1_44_FOR(f) GI_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_44 _GI_EXTERN
# define GI_DEPRECATED_IN_1_44_FOR(f) _GI_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_44
# define GI_AVAILABLE_IN_1_44 GI_UNAVAILABLE(2, 44)
#else
# define GI_AVAILABLE_IN_1_44 _GI_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_46
# define GI_DEPRECATED_IN_1_46 GI_DEPRECATED
# define GI_DEPRECATED_IN_1_46_FOR(f) GI_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_46 _GI_EXTERN
# define GI_DEPRECATED_IN_1_46_FOR(f) _GI_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_46
# define GI_AVAILABLE_IN_1_46 GI_UNAVAILABLE(2, 46)
#else
# define GI_AVAILABLE_IN_1_46 _GI_EXTERN
#endif
#if defined(GLIB_VERSION_2_60) && GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_60
# define GI_AVAILABLE_IN_1_60 GI_UNAVAILABLE(2, 60)
#else
# define GI_AVAILABLE_IN_1_60 _GI_EXTERN
#endif
#if defined(GLIB_VERSION_2_66) && GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_66
# define GI_AVAILABLE_IN_1_66 GI_UNAVAILABLE(2, 66)
#else
# define GI_AVAILABLE_IN_1_66 _GI_EXTERN
#endif
#if defined(GLIB_VERSION_2_70) && GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_70
# define GI_AVAILABLE_IN_1_70 GI_UNAVAILABLE(2, 70)
#else
# define GI_AVAILABLE_IN_1_70 _GI_EXTERN
#endif
#if defined(GLIB_VERSION_2_72) && GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_72
# define GI_DEPRECATED_IN_1_72 GI_DEPRECATED
# define GI_DEPRECATED_IN_1_72_FOR(f) GI_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_72 _GI_EXTERN
# define GI_DEPRECATED_IN_1_72_FOR(f) _GI_EXTERN
#endif
#if defined(GLIB_VERSION_2_72) && GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_72
# define GI_AVAILABLE_IN_1_72 GI_UNAVAILABLE(2, 72)
#else
# define GI_AVAILABLE_IN_1_72 _GI_EXTERN
#endif
#if defined(GLIB_VERSION_2_76) && GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_76
# define GI_DEPRECATED_IN_1_76 GI_DEPRECATED
# define GI_DEPRECATED_IN_1_76_FOR(f) GI_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_76 _GI_EXTERN
# define GI_DEPRECATED_IN_1_76_FOR(f) _GI_EXTERN
#endif
#if defined(GLIB_VERSION_2_76) && GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_76
# define GI_AVAILABLE_IN_1_76 GI_UNAVAILABLE(2, 76)
#else
# define GI_AVAILABLE_IN_1_76 _GI_EXTERN
#endif
#if defined(GLIB_VERSION_2_78) && GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_78
# define GI_DEPRECATED_IN_1_78 GI_DEPRECATED
# define GI_DEPRECATED_IN_1_78_FOR(f) GI_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_78 _GI_EXTERN
# define GI_DEPRECATED_IN_1_78_FOR(f) _GI_EXTERN
#endif
#if defined(GLIB_VERSION_2_78) && GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_78
# define GI_AVAILABLE_IN_1_78 GI_UNAVAILABLE(2, 78)
#else
# define GI_AVAILABLE_IN_1_78 _GI_EXTERN
#endif
#endif /* __GIVERSIONMACROS_H__ */

View File

@ -1,5 +1,24 @@
subdir('cmph')
gir_dir_prefix = get_option('gir_dir_prefix')
if gir_dir_prefix == '' or gir_dir_prefix == get_option('datadir')
gir_dir_prefix = get_option('datadir')
gir_dir_pc_prefix = '${datadir}'
else
gir_dir_pc_prefix = join_paths('${prefix}', gir_dir_prefix)
endif
glib_girdir = get_option('prefix') / gir_dir_prefix / 'gir-1.0'
gir_c_args = [
'-DG_IREPOSITORY_COMPILATION',
'-DG_LOG_DOMAIN="GLib-GIRepository"',
'-DGIR_SUFFIX="gir-1.0"',
'-DGIR_DIR="@0@"'.format(glib_girdir),
'-DGOBJECT_INTROSPECTION_LIBDIR="@0@"'.format(glib_libdir),
'-DGOBJECT_INTROSPECTION_DATADIR="@0@"'.format(glib_datadir),
]
custom_c_args = []
if cc.get_id() != 'msvc'
@ -12,19 +31,19 @@ endif
girepo_gthash_lib = static_library('girepository-gthash',
sources: 'gthash.c',
include_directories : configinc,
c_args: gi_hidden_visibility_cflags + custom_c_args,
c_args: gir_c_args + custom_c_args,
dependencies: [
cmph_dep,
glib_dep,
gmodule_dep,
gobject_dep,
libglib_dep,
libgmodule_dep,
libgobject_dep,
],
)
girepo_gthash_dep = declare_dependency(
link_with: girepo_gthash_lib,
dependencies: [glib_dep, gmodule_dep, gobject_dep],
include_directories: include_directories('.'),
dependencies: [libglib_dep, libgmodule_dep, libgobject_dep],
include_directories: [girepoinc],
)
if cc.get_id() != 'msvc'
@ -35,7 +54,7 @@ if cc.get_id() != 'msvc'
])
endif
girepo_internals_lib = static_library('girepository-internals',
libgirepo_internals = static_library('girepository-internals',
sources: [
'girmodule.c',
'girnode.c',
@ -43,24 +62,28 @@ girepo_internals_lib = static_library('girepository-internals',
'girparser.c',
'girwriter.c',
],
c_args: gi_hidden_visibility_cflags + custom_c_args,
include_directories : configinc,
c_args: gir_c_args + custom_c_args,
include_directories : [configinc],
dependencies: [girepo_gthash_dep, libffi_dep],
)
girepo_internals_dep = declare_dependency(
link_with: girepo_internals_lib,
libgirepo_internals_dep = declare_dependency(
link_with: libgirepo_internals,
dependencies: libffi_dep,
include_directories: include_directories('.'),
include_directories: [girepoinc],
)
gi_version_h = configure_file(
configuration: config,
input: 'giversion.h.in',
output: 'giversion.h',
gir_includedir = glib_includedir / 'girepository'
gi_visibility_h = custom_target(
output: 'gi-visibility.h',
command: [gen_visibility_macros, meson.project_version(), 'visibility-macros', 'GI', '@OUTPUT@'],
install: true,
install_dir: gir_includedir,
install_tag: 'devel',
)
girepo_headers = [
girepo_headers = files(
'giarginfo.h',
'gibaseinfo.h',
'gicallableinfo.h',
@ -80,12 +103,12 @@ girepo_headers = [
'gitypelib.h',
'gitypes.h',
'giunioninfo.h',
'giversionmacros.h',
'givfuncinfo.h',
gi_version_h,
]
)
girepo_sources = [
install_headers(girepo_headers, install_dir: gir_includedir)
girepo_sources = files(
'gdump.c',
'giarginfo.c',
'gibaseinfo.c',
@ -106,53 +129,8 @@ girepo_sources = [
'gitypeinfo.c',
'gitypelib.c',
'giunioninfo.c',
'giversion.c',
'givfuncinfo.c',
]
# Used in gir/meson.build
girepo_gir_sources = files(
'giarginfo.c',
'gibaseinfo.c',
'gicallableinfo.c',
'giconstantinfo.c',
'gienuminfo.c',
'gifieldinfo.c',
'gifunctioninfo.c',
'giinterfaceinfo.c',
'giobjectinfo.c',
'gipropertyinfo.c',
'giregisteredtypeinfo.c',
'girepository.c',
'gisignalinfo.c',
'gistructinfo.c',
'gitypeinfo.c',
'giunioninfo.c',
'giversion.c',
'givfuncinfo.c',
'giarginfo.h',
'gibaseinfo.h',
'gicallableinfo.h',
'giconstantinfo.h',
'gienuminfo.h',
'gifieldinfo.h',
'gifunctioninfo.h',
'giinterfaceinfo.h',
'giobjectinfo.h',
'gipropertyinfo.h',
'giregisteredtypeinfo.h',
'girepository.h',
'gisignalinfo.h',
'gistructinfo.h',
'gitypeinfo.h',
'gitypelib.h',
'gitypes.h',
'giunioninfo.h',
'givfuncinfo.h',
) + [gi_version_h]
install_headers(girepo_headers, subdir: 'gobject-introspection-1.0')
)
if cc.get_id() != 'msvc'
custom_c_args = cc.get_supported_arguments([
@ -164,40 +142,55 @@ if cc.get_id() != 'msvc'
])
endif
lib_version = '1.0.0'
lib_version_arr = lib_version.split('.')
lib_version_major = lib_version_arr[0].to_int()
lib_version_minor = lib_version_arr[1].to_int()
lib_version_micro = lib_version_arr[2].to_int()
osx_current = lib_version_major + 1
lib_osx_version = [osx_current, '@0@.@1@'.format(osx_current, lib_version_minor)]
girepo_lib = shared_library('girepository-1.0',
sources: girepo_sources,
include_directories : configinc,
c_args: gi_hidden_visibility_cflags + ['-DG_IREPOSITORY_COMPILATION'] +
custom_c_args,
dependencies: [glib_dep, gobject_dep, gmodule_dep,
gio_dep, girepo_internals_dep],
version: lib_version,
darwin_versions: lib_osx_version,
libgirepo = shared_library('girepository-2.0',
sources: girepo_sources + [gi_visibility_h],
include_directories: [configinc],
c_args: gir_c_args,
version: library_version,
soversion: soversion,
darwin_versions: darwin_versions,
gnu_symbol_visibility: 'hidden',
link_args: glib_link_flags,
dependencies: [
libglib_dep,
libgobject_dep,
libgmodule_dep,
libgio_dep,
libgirepo_internals_dep,
],
install: true,
)
girepo_dep = declare_dependency(
link_with: girepo_lib,
dependencies: [glib_dep, gobject_dep, gio_dep, gmodule_dep],
include_directories: include_directories('.'),
libgirepo_dep = declare_dependency(
link_with: libgirepo,
dependencies: [libglib_dep, libgobject_dep, libgio_dep, libgmodule_dep],
include_directories: [girepoinc],
)
gthash_test = executable('gthash-test', 'gthash-test.c',
dependencies: girepo_gthash_dep,
executable('gi-dump-types',
sources: 'gi-dump-types.c',
dependencies: [
libgirepo_dep,
libgiounix_dep,
libgiowin32_dep
],
)
test('gthash-test', gthash_test)
pkgconfig_variables = [
'datadir=' + '${prefix}' / get_option('datadir'),
'bindir=' + '${prefix}' / get_option('bindir'),
'gidatadir=${datadir}/gobject-introspection-1.0',
'girdir=' + gir_dir_pc_prefix / 'gir-1.0',
'typelibdir=${libdir}/girepository-1.0',
]
pkg.generate(libgirepo,
name: 'girepository',
version: glib_version,
filebase: 'girepository-2.0',
install_dir: glib_pkgconfigreldir,
description: 'GObject Introspection repository parser',
variables: pkgconfig_variables,
libraries: [libglib_dep, libgobject_dep],
)
if giounix_dep.found() or giowin_dep.found()
executable('gi-dump-types', 'gi-dump-types.c',
dependencies: [girepo_dep, giounix_dep, giowin_dep])
endif

View File

@ -87,6 +87,7 @@ glibinc = include_directories('glib')
gobjectinc = include_directories('gobject')
gmoduleinc = include_directories('gmodule')
gioinc = include_directories('gio')
girepoinc = include_directories('girepository')
glib_prefix = get_option('prefix')
glib_bindir = join_paths(glib_prefix, get_option('bindir'))
@ -2464,6 +2465,7 @@ subdir('gobject')
subdir('gthread')
subdir('gmodule')
subdir('gio')
subdir('girepository')
subdir('fuzzing')
# xgettext is optional (on Windows for instance)

View File

@ -125,3 +125,7 @@ option('multiarch',
type : 'boolean',
value : false,
description : 'Install some helper executables in per-architecture locations')
option('gir_dir_prefix',
type: 'string',
description: 'Intermediate prefix for gir installation under ${prefix}')