[gobject-introspection/wip/tingping/meson] Build gobject, gmodule, gio gir
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/wip/tingping/meson] Build gobject, gmodule, gio gir
- Date: Mon, 23 Oct 2017 19:13:16 +0000 (UTC)
commit c2f07d4ffc628a8a586f3460220acea523093f1a
Author: Patrick Griffis <tingping tingping se>
Date: Mon Oct 23 15:12:49 2017 -0400
Build gobject, gmodule, gio gir
gir/generate_source_list.py | 15 ++++
gir/meson.build | 181 +++++++++++++++++++++++++++++++++++--------
2 files changed, 162 insertions(+), 34 deletions(-)
---
diff --git a/gir/generate_source_list.py b/gir/generate_source_list.py
new file mode 100755
index 0000000..d4c00de
--- /dev/null
+++ b/gir/generate_source_list.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import sys
+from glob import glob
+
+output_file = sys.argv[1]
+glob_str = sys.argv[2]
+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')
+ file_.write('\n'.join(extra_files))
diff --git a/gir/meson.build b/gir/meson.build
index 710c52d..481e587 100644
--- a/gir/meson.build
+++ b/gir/meson.build
@@ -35,52 +35,48 @@ gir_files = [
typelibdir = join_paths(get_option('libdir'), 'girepository-1.0')
girdir = join_paths(get_option('datadir'), 'gir-1.0')
-
install_data(gir_files, install_dir: girdir)
-foreach gir : gir_files
- custom_target('generate-typelib-@0@'.format(gir).underscorify(),
- input: gir,
- output: '@BASENAME@.typelib',
- command: [gircompiler, '-o', '@OUTPUT@', '@INPUT@'],
- install: true,
- install_dir: typelibdir,
- )
-endforeach
+scanner_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',
+]
+# GLib
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(',')
+glib_sources_file = custom_target('glib-sources-file',
+ input: 'glib-2.0.c',
+ output: 'glib-sources.list',
+ command: [
+ find_program('generate_source_list.py'),
+ '@OUTPUT@',
+ glib_includedir + '/glib/*.h',
+ 'glib-autocleanups.h',
+ glib_libincludedir + '/glibconfig.h',
+ glib_includedir + '/gobject/glib-types.h',
+ '@INPUT@',
+ ]
+)
-custom_target('gir-glib',
- input: glib_headers,
+glib_gir = custom_target('gir-glib',
+ input: glib_sources_file,
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',
+ command: scanner_command + [
'--identifier-prefix=G',
'--symbol-prefix=g',
'--symbol-prefix=glib',
@@ -88,8 +84,8 @@ custom_target('gir-glib',
'--namespace=GLib',
'--nsversion=2.0',
'--pkg=glib-2.0',
- '--library=gobject-2.0',
'--library=glib-2.0',
+ '--library=gobject-2.0',
'--cflags-begin',
'-I' + glib_includedir,
'-I' + glib_libincludedir,
@@ -97,6 +93,123 @@ custom_target('gir-glib',
'-D__G_I18N_LIB_H__',
'-DGETTEXT_PACKAGE=Dummy',
'--cflags-end',
+ '--filelist=@INPUT@',
+ ]
+)
+
+gir_files += glib_gir
+
+# GObject
+gobject_sources_file = custom_target('gobject-sources-file',
+ input: 'gobject-2.0.c',
+ output: 'gobject-sources.list',
+ command: [
+ find_program('generate_source_list.py'),
+ '@OUTPUT@',
+ glib_includedir + '/gobject/*.h',
+ 'glib-types.h',
+ '@INPUT@',
+ ]
+)
+
+gir_files += custom_target('gir-gobject',
+ input: gobject_sources_file,
+ output: 'GObject-2.0.gir',
+ depends: glib_gir,
+ install: true,
+ install_dir: girdir,
+ command: scanner_command + [
+ '--identifier-prefix=G',
+ '--symbol-prefix=g',
+ '--c-include=glib-object.h',
+ '--namespace=GObject',
+ '--nsversion=2.0',
+ '--pkg=gobject-2.0',
+ '--library=gobject-2.0',
+ '--include-uninstalled=' + glib_gir.full_path(),
+ '--cflags-begin',
+ '-I' + glib_includedir,
+ '-I' + glib_libincludedir,
+ '-DGOBJECT_COMPILATION',
+ '--cflags-end',
+ '--filelist=@INPUT@',
+ ]
+)
+
+# GModule
+gir_files += custom_target('gir-gmodule',
+ input: 'gmodule-2.0.c',
+ output: 'GModule-2.0.gir',
+ depends: glib_gir,
+ install: true,
+ install_dir: girdir,
+ command: scanner_command + [
+ '--identifier-prefix=G',
+ '--symbol-prefix=g',
+ '--c-include=gmodule.h',
+ '--namespace=GModule',
+ '--nsversion=2.0',
+ '--pkg=gmodule-2.0',
+ '--library=gmodule-2.0',
+ '--include-uninstalled=' + glib_gir.full_path(),
+ '--cflags-begin',
+ '-I' + glib_includedir,
+ '-I' + glib_libincludedir,
+ '--cflags-end',
+ glib_includedir + '/gmodule.h',
+ '@INPUT@',
+ ]
+)
+
+# Gio
+if giounix_dep.found()
+# TODO
+endif
+
+gio_sources_file = custom_target('gio-sources-file',
+ input: 'gio-2.0.c',
+ output: 'gio-sources.list',
+ command: [
+ find_program('generate_source_list.py'),
+ '@OUTPUT@',
+ glib_includedir + '/gio/*.h',
+ ' ',
'@INPUT@',
]
)
+
+gir_files += custom_target('gir-gio',
+ input: gio_sources_file,
+ output: 'Gio-2.0.gir',
+ depends: glib_gir,
+ install: true,
+ install_dir: girdir,
+ 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=' + glib_gir.full_path(),
+ '--cflags-begin',
+ '-DGIO_COMPILATION',
+ '-DG_SETTINGS_ENABLE_BACKEND',
+ '-I' + glib_includedir,
+ '--cflags-end',
+ '--filelist=@INPUT@',
+ ]
+)
+
+# GIRepository
+
+foreach gir : gir_files
+ custom_target('generate-typelib-@0@'.format(gir).underscorify(),
+ input: gir,
+ output: '@BASENAME@.typelib',
+ command: [gircompiler, '-o', '@OUTPUT@', '@INPUT@'],
+ install: true,
+ install_dir: typelibdir,
+ )
+endforeach
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]