[gobject-introspection/wip/tingping/meson] Build girepository gir
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/wip/tingping/meson] Build girepository gir
- Date: Tue, 24 Oct 2017 11:25:19 +0000 (UTC)
commit 156091782be9e65f3f78a54e6a536f3899f0f382
Author: Patrick Griffis <tingping tingping se>
Date: Tue Oct 24 07:24:59 2017 -0400
Build girepository gir
gir/generate_source_list.py | 9 +++--
gir/meson.build | 79 ++++++++++++++++++++++++++++++++++---------
girepository/meson.build | 40 ++++++++++++++++++++++
3 files changed, 108 insertions(+), 20 deletions(-)
---
diff --git a/gir/generate_source_list.py b/gir/generate_source_list.py
index d4c00de..96aaa50 100755
--- a/gir/generate_source_list.py
+++ b/gir/generate_source_list.py
@@ -4,12 +4,13 @@ import sys
from glob import glob
output_file = sys.argv[1]
-glob_str = sys.argv[2]
+glob_strs = sys.argv[2].split(',')
filter_str = tuple(sys.argv[3].split(','))
extra_files = sys.argv[4:]
with open(output_file, 'w') as file_:
- for f in glob(glob_str):
- if filter_str == ' ' or not f.endswith(filter_str):
- file_.write(f + '\n')
+ for s in glob_strs:
+ for f in glob(s):
+ if filter_str == ' ' or not f.endswith(filter_str):
+ file_.write(f + '\n')
file_.write('\n'.join(extra_files))
diff --git a/gir/meson.build b/gir/meson.build
index 481e587..4ebf3f7 100644
--- a/gir/meson.build
+++ b/gir/meson.build
@@ -112,7 +112,7 @@ gobject_sources_file = custom_target('gobject-sources-file',
]
)
-gir_files += custom_target('gir-gobject',
+gobject_gir = custom_target('gir-gobject',
input: gobject_sources_file,
output: 'GObject-2.0.gir',
depends: glib_gir,
@@ -136,6 +136,8 @@ gir_files += custom_target('gir-gobject',
]
)
+gir_files += gobject_gir
+
# GModule
gir_files += custom_target('gir-gmodule',
input: 'gmodule-2.0.c',
@@ -162,8 +164,46 @@ gir_files += custom_target('gir-gmodule',
)
# Gio
+gio_command = scanner_command + [
+ '--identifier-prefix=G',
+ '--symbol-prefix=g',
+ '--c-include=gio/gio.h',
+ '--namespace=Gio',
+ '--nsversion=2.0',
+ '--pkg=gio-2.0',
+ '--library=gio-2.0',
+ '--include-uninstalled=' + gobject_gir.full_path(),
+ '--cflags-begin',
+ '-DGIO_COMPILATION',
+ '-DG_SETTINGS_ENABLE_BACKEND',
+ '-I' + glib_includedir,
+ '--cflags-end',
+ '--filelist=@INPUT@',
+]
+
+gio_glob = glib_includedir + '/gio/*.h'
+
if giounix_dep.found()
-# TODO
+ giounix_includedir = giounix_dep.get_pkgconfig_variable('includedir') + '/gio-unix-2.0'
+ gio_glob += ',' + giounix_includedir + '/gio/*.h'
+
+ get_header_list = '''
+from glob import glob
+from os.path import basename
+
+print(','.join(basename(f) for f in glob('@0@/gio/*.h')))
+'''.format(giounix_includedir)
+
+ ret = run_command(py3.find_python(), '-c', get_header_list)
+ if ret.returncode() != 0
+ error('Failed to get gio header list')
+ endif
+ gio_headers = ret.stdout().strip().split(',')
+ foreach header : gio_headers
+ gio_command += '--c-include=gio/' + header
+ endforeach
+
+ gio_command += '--pkg=gio-unix-2.0'
endif
gio_sources_file = custom_target('gio-sources-file',
@@ -172,7 +212,7 @@ gio_sources_file = custom_target('gio-sources-file',
command: [
find_program('generate_source_list.py'),
'@OUTPUT@',
- glib_includedir + '/gio/*.h',
+ gio_glob,
' ',
'@INPUT@',
]
@@ -181,29 +221,36 @@ gio_sources_file = custom_target('gio-sources-file',
gir_files += custom_target('gir-gio',
input: gio_sources_file,
output: 'Gio-2.0.gir',
- depends: glib_gir,
+ depends: gobject_gir,
+ install: true,
+ install_dir: girdir,
+ command: gio_command,
+)
+
+# GIRepository
+gir_files += custom_target('gir-girepository',
+ input: girepo_gir_sources,
+ output: 'GIRepository-2.0.gir',
+ depends: gobject_gir,
install: true,
install_dir: girdir,
command: scanner_command + [
- '--identifier-prefix=G',
+ '--identifier-prefix=GI',
'--symbol-prefix=g',
- '--c-include=gio/gio.h',
- '--namespace=Gio',
+ '--c-include=girepository.h',
+ '--namespace=GIRepository',
'--nsversion=2.0',
- '--pkg=gio-2.0',
- '--library=gio-2.0',
- '--include-uninstalled=' + glib_gir.full_path(),
+ '--pkg=gobject-introspection-1.0',
+ '--library=girepository-1.0',
+ '--include-uninstalled=' + gobject_gir.full_path(),
'--cflags-begin',
- '-DGIO_COMPILATION',
- '-DG_SETTINGS_ENABLE_BACKEND',
- '-I' + glib_includedir,
+ '-DGI_COMPILATION',
+ '-I' + meson.source_root() + '/girepository',
'--cflags-end',
- '--filelist=@INPUT@',
+ '@INPUT@',
]
)
-# GIRepository
-
foreach gir : gir_files
custom_target('generate-typelib-@0@'.format(gir).underscorify(),
input: gir,
diff --git a/girepository/meson.build b/girepository/meson.build
index cf0ed76..5348624 100644
--- a/girepository/meson.build
+++ b/girepository/meson.build
@@ -81,6 +81,46 @@ girepo_sources = [
'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',
+ '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',
+)
+
install_headers(girepo_headers, subdir: 'gobject-introspection-1.0')
girepo_lib = shared_library('girepository-1.0',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]