[gobject-introspection/wip/tingping/meson] Initial work on meson port



commit dffde5acf56a4eb5c353629fd9aef9249c4b18b6
Author: Patrick Griffis <tingping tingping se>
Date:   Mon Oct 23 04:53:04 2017 -0400

    Initial work on meson port

 gir/meson.build               |    1 +
 girepository/cmph/meson.build |   50 +++++++++++++++++
 girepository/meson.build      |  120 +++++++++++++++++++++++++++++++++++++++++
 giscanner/meson.build         |   74 +++++++++++++++++++++++++
 meson.build                   |   50 +++++++++++++++++
 meson_options.txt             |   11 ++++
 tools/meson.build             |   51 +++++++++++++++++
 7 files changed, 357 insertions(+), 0 deletions(-)
---
diff --git a/gir/meson.build b/gir/meson.build
new file mode 100644
index 0000000..23ba919
--- /dev/null
+++ b/gir/meson.build
@@ -0,0 +1 @@
+# TODO: ...
diff --git a/girepository/cmph/meson.build b/girepository/cmph/meson.build
new file mode 100644
index 0000000..0c0e0af
--- /dev/null
+++ b/girepository/cmph/meson.build
@@ -0,0 +1,50 @@
+cmph_sources = [
+  'bdz.c',
+  'bdz_ph.c',
+  'bmz8.c',
+  'bmz.c',
+  'brz.c',
+  'buffer_entry.c',
+  'buffer_manager.c',
+  'chd.c',
+  'chd_ph.c',
+  'chm.c',
+  'cmph.c',
+  'cmph_structs.c',
+  'compressed_rank.c',
+  'compressed_seq.c',
+  'fch_buckets.c',
+  'fch.c',
+  'graph.c',
+  'hash.c',
+  'jenkins_hash.c',
+  'miller_rabin.c',
+  'select.c',
+  'vqueue.c',
+  'vstack.c',
+]
+
+cmph_deps = [
+  gobject_dep,
+  cc.find_library('m', required: false),
+]
+
+cmph = static_library('cmph',
+  sources: cmph_sources,
+  c_args: gi_hidden_visibility_cflags,
+  dependencies: cmph_deps,
+)
+
+cmph_dep = declare_dependency(
+  link_with: cmph,
+  include_directories: include_directories('.'),
+)
+
+cmph_test = executable('cmph-bdz-test', '../cmph-bdz-test.c',
+  dependencies: [
+    cmph_dep,
+    gobject_dep,
+  ]
+)
+
+test('cmph-bdz-test', cmph_test)
diff --git a/girepository/meson.build b/girepository/meson.build
new file mode 100644
index 0000000..632e638
--- /dev/null
+++ b/girepository/meson.build
@@ -0,0 +1,120 @@
+subdir('cmph')
+
+girepo_gthash_lib = static_library('girepository-gthash',
+  sources: 'gthash.c',
+  c_args: gi_hidden_visibility_cflags,
+  dependencies: [
+    cmph_dep,
+    gobject_dep,
+  ],
+)
+
+girepo_gthash_dep = declare_dependency(
+  link_with: girepo_gthash_lib,
+  dependencies: gobject_dep,
+  include_directories: include_directories('.'),
+)
+
+girepo_internals_lib = static_library('girepository-internals',
+  sources: [
+    'girmodule.c',
+    'girnode.c',
+    'giroffsets.c',
+    'girparser.c',
+    'girwriter.c',
+  ],
+  c_args: gi_hidden_visibility_cflags,
+  dependencies: [girepo_gthash_dep, libffi_dep],
+)
+
+girepo_internals_dep = declare_dependency(
+  link_with: girepo_internals_lib,
+  dependencies: libffi_dep,
+  include_directories: include_directories('.'),
+)
+
+girepo_headers = [
+  'giarginfo.h',
+  'gibaseinfo.h',
+  'gicallableinfo.h',
+  'giconstantinfo.h',
+  'gienuminfo.h',
+  'gifieldinfo.h',
+  'gifunctioninfo.h',
+  'giinterfaceinfo.h',
+  'giobjectinfo.h',
+  'gipropertyinfo.h',
+  'giregisteredtypeinfo.h',
+  'girepository.h',
+  'girffi.h',
+  'gisignalinfo.h',
+  'gistructinfo.h',
+  'gitypeinfo.h',
+  'gitypelib.h',
+  'gitypes.h',
+  'giunioninfo.h',
+  'giversionmacros.h',
+  'givfuncinfo.h',
+]
+
+girepo_sources = [
+  'gdump.c',
+  'giarginfo.c',
+  'gibaseinfo.c',
+  'gicallableinfo.c',
+  'giconstantinfo.c',
+  'gienuminfo.c',
+  'gifieldinfo.c',
+  'gifunctioninfo.c',
+  'ginvoke.c',
+  'giinterfaceinfo.c',
+  'giobjectinfo.c',
+  'gipropertyinfo.c',
+  'giregisteredtypeinfo.c',
+  'girepository.c',
+  'girffi.c',
+  'gisignalinfo.c',
+  'gistructinfo.c',
+  'gitypeinfo.c',
+  'gitypelib.c',
+  'giunioninfo.c',
+  'givfuncinfo.c',
+]
+
+girepo_lib = shared_library('girepository-1.0',
+  sources: girepo_sources,
+  c_args: gi_hidden_visibility_cflags + ['-DG_IREPOSITORY_COMPILATION'],
+  dependencies: [
+    gio_dep,
+    gmodule_dep,
+    girepo_internals_dep,
+    dependency('gio-2.0'),
+  ],
+  install: true,
+)
+
+install_data('gdump.c',
+  install_dir: join_paths(get_option('datadir'), 'gobject-introspection-1.0')
+)
+
+girepo_dep = declare_dependency(
+  link_with: girepo_lib,
+  dependencies: gio_dep,
+  include_directories: include_directories('.'),
+)
+
+gthash_test = executable('gthash-test', 'gthash-test.c',
+  dependencies: girepo_gthash_dep,
+)
+
+test('gthash-test', gthash_test)
+
+if giounix_dep.found()
+  executable('gi-dump-types', 'gi-dump-types.c',
+    dependencies: [
+      girepo_dep,
+      gmodule_dep,
+      giounix_dep,
+    ]
+  )
+endif
diff --git a/giscanner/meson.build b/giscanner/meson.build
new file mode 100644
index 0000000..7a82b6d
--- /dev/null
+++ b/giscanner/meson.build
@@ -0,0 +1,74 @@
+pkglibdir = join_paths(get_option('libdir'), meson.project_name())
+giscannerdir = join_paths(pkglibdir, 'giscanner')
+install_data([
+  '__init__.py',
+  'annotationmain.py',
+  'annotationparser.py',
+  'ast.py',
+  'cachestore.py',
+  'ccompiler.py',
+  'codegen.py',
+  'docmain.py',
+  'docwriter.py',
+  'dumper.py',
+  'introspectablepass.py',
+  'girparser.py',
+  'girwriter.py',
+  'gdumpparser.py',
+  'libtoolimporter.py',
+  'maintransformer.py',
+  'message.py',
+  'msvccompiler.py',
+  'shlibs.py',
+  'scannermain.py',
+  'sectionparser.py',
+  'sourcescanner.py',
+  'testcodegen.py',
+  'transformer.py',
+  'utils.py',
+  'xmlwriter.py',
+], install_dir: giscannerdir)
+
+install_data([
+  'collections/__init__.py',
+  'collections/counter.py',
+  'collections/ordereddict.py',
+], install_dir: join_paths(giscannerdir, 'collections'))
+
+install_subdir('doctemplates', install_dir: pkglibdir)
+
+flex = find_program('flex')
+bison = find_program('bison')
+
+scannerparser = custom_target('scannerparser',
+    input: 'scannerparser.y',
+   output: ['scannerparser.c', 'scannerparser.h'],
+  command: [bison, '@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@']
+
+)
+
+scannerlexer = custom_target('scannerlexer',
+    input: 'scannerlexer.l',
+   output: 'scannerlexer.c',
+  command: [flex, '-o', '@OUTPUT@', '@INPUT@']
+)
+
+giscanner_lib = static_library('giscanner',
+  sources: [
+    'sourcescanner.c',
+    scannerparser,
+    scannerlexer,
+  ],
+  dependencies: gio_dep,
+)
+
+# TODO: -export-symbols-regex "init_giscanner|PyInit__giscanner"
+py3.extension_module('_giscanner', 'giscannermodule.c',
+  link_with: giscanner_lib,
+  dependencies: [
+    gobject_dep,
+    dependency('python3'),
+  ],
+  install: true,
+  install_dir: giscannerdir,
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..9103245
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,50 @@
+project('gobject-introspection', 'c',
+  version: '1.55.0',
+  meson_version: '>= 0.40.0',
+  default_options: [
+    'warning_level=1',
+  ],
+)
+
+py3 = import('python3')
+
+cc = meson.get_compiler('c')
+config = configuration_data()
+config.set_quoted('GIR_SUFFIX', 'gir-1.0')
+config.set_quoted('GIR_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'gir-1.0'))
+config.set_quoted('GOBJECT_INTROSPECTION_LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
+
+foreach type : ['char', 'short', 'int', 'long']
+  size = cc.sizeof(type)
+  if size == -1
+    error('Failed to get size of @0@'.format(type))
+  endif
+  config.set('SIZEOF_@0@'.format(type.to_upper()), size)
+endforeach
+
+configure_file(
+  configuration: config,
+  output: 'config.h'
+)
+
+add_project_arguments('-I' + meson.build_root(),
+  language: 'c',
+)
+
+gi_hidden_visibility_cflags = []
+if cc.has_argument('-fvisibility=hidden')
+  gi_hidden_visibility_cflags = [
+    '-D_GI_EXTERN=__attribute__((visibility("default"))) extern',
+    '-fvisibility=hidden',
+  ]
+endif
+
+gobject_dep = dependency('gobject-2.0', version: '>= 2.55.0')
+gio_dep = dependency('gio-2.0')
+giounix_dep = dependency('gio-unix-2.0', required: false)
+gmodule_dep = dependency('gmodule-2.0')
+libffi_dep = dependency('libffi')
+
+subdir('girepository')
+subdir('tools')
+subdir('giscanner')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..3a4f758
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,11 @@
+option('cairo', type: 'boolean',
+  description: 'Use cairo'
+)
+
+option('doctool', type: 'boolean',
+  description: 'Install g-ir-doc-tool'
+)
+
+option('glib-src-dir', type: 'string',
+  description: 'Source directory for glib - needed to add docs to gir'
+)
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 0000000..7f32cbb
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,51 @@
+libdir_abs = join_paths(get_option('prefix'), get_option('libdir'))
+datadir_abs = join_paths(get_option('prefix'), get_option('datadir'))
+python_path = py3.find_python().path()
+
+tools = [
+  ['g-ir-scanner', 'scannermain', 'scanner_main'],
+  ['g-ir-annotation-tool', 'annotationmain', 'annotation_main'],
+]
+if get_option('doctool')
+  tools += [['g-ir-doc-tool', 'docmain', 'doc_main']]
+endif
+
+foreach tool : tools
+  tools_conf = configuration_data()
+  tools_conf.set('libdir', libdir_abs)
+  tools_conf.set('datarootdir', datadir_abs)
+  tools_conf.set('PYTHON', python_path)
+
+  tools_conf.set('TOOL_MODULE', tool[1])
+  tools_conf.set('TOOL_FUNCTION', tool[2])
+  configure_file(
+    input: 'g-ir-tool-template.in',
+    output: tool[0],
+    configuration: tools_conf,
+    install: true,
+    install_dir: get_option('bindir'),
+  )
+endforeach
+
+gircompiler = executable('g-ir-compiler', 'compiler.c',
+  c_args: '-DGIREPO_DEFAULT_SEARCH_PATH="@0"'.format(libdir_abs),
+  dependencies: [
+    girepo_internals_dep,
+    girepo_dep,
+  ],
+  install: true,
+)
+
+girgenerate = executable('g-ir-generate', 'generate.c',
+  c_args: '-DGIREPO_DEFAULT_SEARCH_PATH="@0"'.format(libdir_abs),
+  dependencies: [
+    girepo_internals_dep,
+    girepo_dep,
+  ],
+  install: true,
+)
+
+girinspect = executable('g-ir-inspect', 'g-ir-inspect.c',
+  dependencies: girepo_dep,
+  install: true,
+)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]