[gobject-introspection/wip/tingping/meson] Build glib gir
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/wip/tingping/meson] Build glib gir
- Date: Mon, 23 Oct 2017 17:17:19 +0000 (UTC)
commit a089e10553792c984bc2d4ff9ac9d09076e99460
Author: Patrick Griffis <tingping tingping se>
Date: Mon Oct 23 13:16:57 2017 -0400
Build glib gir
gir/meson.build | 53 +++++++++++++++++++++++++++++++++++++++++++
tools/g-ir-tool-template.in | 4 +++
tools/meson.build | 5 +++-
3 files changed, 61 insertions(+), 1 deletions(-)
---
diff --git a/gir/meson.build b/gir/meson.build
index 257804b..710c52d 100644
--- a/gir/meson.build
+++ b/gir/meson.build
@@ -47,3 +47,56 @@ foreach gir : gir_files
install_dir: typelibdir,
)
endforeach
+
+glib_includedir = join_paths(gobject_dep.get_pkgconfig_variable('includedir'), 'glib-2.0')
+glib_libincludedir = join_paths(gobject_dep.get_pkgconfig_variable('libdir'), 'glib-2.0/include')
+glib_headers = [
+ 'glib-2.0.c',
+ glib_libincludedir + '/glibconfig.h',
+ glib_includedir + '/gobject/glib-types.h',
+]
+
+script = '''
+import glob
+print(','.join((f for f in glob.glob("@0@/glib/*.h") if not f.endswith("glib-autocleanups.h"))))
+'''.format(glib_includedir)
+ret = run_command(py3.find_python(), '-c', script)
+if ret.returncode() != 0
+ error('Failed to get glib headers')
+endif
+glib_headers += ret.stdout().strip().split(',')
+
+custom_target('gir-glib',
+ input: glib_headers,
+ output: 'GLib-2.0.gir',
+ install: true,
+ install_dir: girdir,
+ command: [
+ find_program('env'),
+ 'UNINSTALLED_INTROSPECTION_SRCDIR=' + meson.source_root(),
+ 'UNINSTALLED_INTROSPECTION_BUILDDIR=' + meson.build_root(),
+ girscanner,
+ '--output=@OUTPUT@',
+ '--warn-all',
+ '--no-libtool',
+ '--external-library',
+ '--reparse-validate',
+ '--identifier-prefix=G',
+ '--symbol-prefix=g',
+ '--symbol-prefix=glib',
+ '--c-include=glib.h',
+ '--namespace=GLib',
+ '--nsversion=2.0',
+ '--pkg=glib-2.0',
+ '--library=gobject-2.0',
+ '--library=glib-2.0',
+ '--cflags-begin',
+ '-I' + glib_includedir,
+ '-I' + glib_libincludedir,
+ '-DGLIB_COMPILATION',
+ '-D__G_I18N_LIB_H__',
+ '-DGETTEXT_PACKAGE=Dummy',
+ '--cflags-end',
+ '@INPUT@',
+ ]
+)
diff --git a/tools/g-ir-tool-template.in b/tools/g-ir-tool-template.in
index edc68a4..2eac21f 100755
--- a/tools/g-ir-tool-template.in
+++ b/tools/g-ir-tool-template.in
@@ -62,5 +62,9 @@ if srcdir is not None:
sys.path.insert(0, pylibdir)
+builddir = os.getenv('UNINSTALLED_INTROSPECTION_BUILDDIR', None)
+if builddir is not None:
+ sys.path.insert(0, os.path.join(builddir, 'giscanner'))
+
from giscanner.@TOOL_MODULE@ import @TOOL_FUNCTION@
sys.exit(@TOOL_FUNCTION@(sys.argv))
diff --git a/tools/meson.build b/tools/meson.build
index 7f32cbb..73817ec 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -10,6 +10,7 @@ if get_option('doctool')
tools += [['g-ir-doc-tool', 'docmain', 'doc_main']]
endif
+tool_output = []
foreach tool : tools
tools_conf = configuration_data()
tools_conf.set('libdir', libdir_abs)
@@ -18,7 +19,7 @@ foreach tool : tools
tools_conf.set('TOOL_MODULE', tool[1])
tools_conf.set('TOOL_FUNCTION', tool[2])
- configure_file(
+ tool_output += configure_file(
input: 'g-ir-tool-template.in',
output: tool[0],
configuration: tools_conf,
@@ -27,6 +28,8 @@ foreach tool : tools
)
endforeach
+girscanner = tool_output[0]
+
gircompiler = executable('g-ir-compiler', 'compiler.c',
c_args: '-DGIREPO_DEFAULT_SEARCH_PATH="@0"'.format(libdir_abs),
dependencies: [
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]