[libgit2-glib/wip/meson] Port to meson build system
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib/wip/meson] Port to meson build system
- Date: Sat, 24 Dec 2016 15:26:04 +0000 (UTC)
commit 241a5142a8dbf41e266d0d08f29e90b287c7baa0
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Sat Dec 24 11:44:31 2016 +0100
Port to meson build system
libgit2-glib/meson.build | 180 +++++++++++++++++++++++++++++++++++++++++++++
meson.build | 182 ++++++++++++++++++++++++++++++++++++++++++++++
meson_options.txt | 3 +
3 files changed, 365 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/meson.build b/libgit2-glib/meson.build
new file mode 100644
index 0000000..7609564
--- /dev/null
+++ b/libgit2-glib/meson.build
@@ -0,0 +1,180 @@
+headers = [
+ 'ggit-annotated-commit.h',
+ 'ggit-blame.h',
+ 'ggit-blame-options.h',
+ 'ggit-blob.h',
+ 'ggit-blob-output-stream.h',
+ 'ggit-branch.h',
+ 'ggit-branch-enumerator.h',
+ 'ggit-checkout-options.h',
+ 'ggit-cherry-pick-options.h',
+ 'ggit-clone-options.h',
+ 'ggit-commit.h',
+ 'ggit-commit-parents.h',
+ 'ggit-config-entry.h',
+ 'ggit-cred.h',
+ 'ggit-cred-plaintext.h',
+ 'ggit-diff.h',
+ 'ggit-diff-binary.h',
+ 'ggit-diff-binary-file.h',
+ 'ggit-diff-delta.h',
+ 'ggit-diff-file.h',
+ 'ggit-diff-find-options.h',
+ 'ggit-diff-format-email-options.h',
+ 'ggit-diff-hunk.h',
+ 'ggit-diff-line.h',
+ 'ggit-diff-options.h',
+ 'ggit-diff-similarity-metric.h',
+ 'ggit-error.h',
+ 'ggit-fetch-options.h',
+ 'ggit-index.h',
+ 'ggit-index-entry.h',
+ 'ggit-index-entry-resolve-undo.h',
+ 'ggit-main.h',
+ 'ggit-message.h',
+ 'ggit-merge-options.h',
+ 'ggit-native.h',
+ 'ggit-note.h',
+ 'ggit-object.h',
+ 'ggit-object-factory.h',
+ 'ggit-object-factory-base.h',
+ 'ggit-oid.h',
+ 'ggit-patch.h',
+ 'ggit-push-options.h',
+ 'ggit-rebase-operation.h',
+ 'ggit-rebase-options.h',
+ 'ggit-rebase.h',
+ 'ggit-ref.h',
+ 'ggit-ref-spec.h',
+ 'ggit-reflog.h',
+ 'ggit-reflog-entry.h',
+ 'ggit-remote.h',
+ 'ggit-remote-callbacks.h',
+ 'ggit-repository.h',
+ 'ggit-revert-options.h',
+ 'ggit-revision-walker.h',
+ 'ggit-signature.h',
+ 'ggit-status-options.h',
+ 'ggit-submodule.h',
+ 'ggit-submodule-update-options.h',
+ 'ggit-tag.h',
+ 'ggit-transfer-progress.h',
+ 'ggit-tree.h',
+ 'ggit-tree-builder.h',
+ 'ggit-tree-entry.h',
+]
+
+private_headers = [
+ 'ggit-convert.h',
+ 'ggit-utils.h',
+]
+
+sources = [
+ 'ggit-annotated-commit.c',
+ 'ggit-blame.c',
+ 'ggit-blame-options.c',
+ 'ggit-blob.c',
+ 'ggit-blob-output-stream.c',
+ 'ggit-branch.c',
+ 'ggit-branch-enumerator.c',
+ 'ggit-checkout-options.c',
+ 'ggit-cherry-pick-options.c',
+ 'ggit-clone-options.c',
+ 'ggit-commit.c',
+ 'ggit-commit-parents.c',
+ 'ggit-config.c',
+ 'ggit-config-entry.c',
+ 'ggit-convert.c',
+ 'ggit-cred.c',
+ 'ggit-cred-plaintext.c',
+ 'ggit-diff.c',
+ 'ggit-diff-binary.c',
+ 'ggit-diff-binary-file.c',
+ 'ggit-diff-delta.c',
+ 'ggit-diff-file.c',
+ 'ggit-diff-find-options.c',
+ 'ggit-diff-format-email-options.c',
+ 'ggit-diff-hunk.c',
+ 'ggit-diff-line.c',
+ 'ggit-diff-options.c',
+ 'ggit-diff-similarity-metric.c',
+ 'ggit-error.c',
+ 'ggit-fetch-options.c',
+ 'ggit-index.c',
+ 'ggit-index-entry.c',
+ 'ggit-index-entry-resolve-undo.c',
+ 'ggit-main.c',
+ 'ggit-message.c',
+ 'ggit-merge-options.c',
+ 'ggit-native.c',
+ 'ggit-note.c',
+ 'ggit-object.c',
+ 'ggit-object-factory.c',
+ 'ggit-object-factory-base.c',
+ 'ggit-oid.c',
+ 'ggit-patch.c',
+ 'ggit-push-options.c',
+ 'ggit-rebase-operation.c',
+ 'ggit-rebase-options.c',
+ 'ggit-rebase.c',
+ 'ggit-ref.c',
+ 'ggit-ref-spec.c',
+ 'ggit-reflog.c',
+ 'ggit-reflog-entry.c',
+ 'ggit-remote.c',
+ 'ggit-remote-callbacks.c',
+ 'ggit-repository.c',
+ 'ggit-revert-options.c',
+ 'ggit-revision-walker.c',
+ 'ggit-signature.c',
+ 'ggit-status-options.c',
+ 'ggit-submodule.c',
+ 'ggit-submodule-update-options.c',
+ 'ggit-tag.c',
+ 'ggit-transfer-progress.c',
+ 'ggit-tree.c',
+ 'ggit-tree-builder.c',
+ 'ggit-tree-entry.c',
+ 'ggit-types.c',
+ 'ggit-utils.c',
+]
+
+install_headers(headers, subdir: 'libgit2-glib-1.0')
+
+pkgconfig_files = [ 'libgit2-glib-@0@'.format(libgit2_glib_api_version) ]
+platform_deps = [ gobject, libgit2 ]
+
+if cc.get_id() == 'msvc'
+ graphene_link_args = []
+else
+ graphene_link_args = [ '-Wl,-Bsymbolic-functions' ]
+endif
+
+libgit2_glib = shared_library('libgit2-glib-@0@'.format(libgit2_glib_api_version),
+ sources: sources + private_headers,
+ version: libversion,
+ soversion: soversion,
+ install: true,
+ dependencies: platform_deps,
+ c_args: extra_args + common_flags + debug_flags + [
+ '-DG_LOG_DOMAIN="Ggit"',
+ '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_30',
+ '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32' ],
+ link_args: graphene_link_args)
+
+if build_gir
+ gir_extra_args = [
+ '--identifier-filter-cmd=' + join_paths(meson.current_source_dir(), 'identfilter.py'),
+ '--c-include=ggit.h',
+ '-DGRAPHENE_COMPILATION',
+ ]
+ gnome.generate_gir(libgit2_glib,
+ sources: headers + sources,
+ namespace: 'Ggit',
+ nsversion: libgit2_glib_api_version,
+ identifier_prefix: 'Ggit',
+ symbol_prefix: 'ggit',
+ includes: [ 'GObject-2.0' ],
+ install: true,
+ extra_args: gir_extra_args)
+endif
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..63c0c79
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,182 @@
+project('libgit2-glib', 'c',
+ version: '0.24.5',
+ default_options: [
+ 'buildtype=debugoptimized',
+ 'warning_level=1'
+ ],
+ license: 'LGPL2+',
+ meson_version: '>= 0.36.0')
+
+libgit2_glib_version = meson.project_version()
+version_array = libgit2_glib_version.split('.')
+libgit2_glib_major_version = version_array[0].to_int()
+libgit2_glib_minor_version = version_array[1].to_int()
+libgit2_glib_micro_version = version_array[2].to_int()
+
+libgit2_glib_api_version = '@0@.0'.format(libgit2_glib_major_version)
+
+# The interface age is reset every time we add new API; this
+# should only happen during development cycles, otherwise the
+# interface age is the same as the micro version
+if libgit2_glib_minor_version.is_odd()
+ libgit2_glib_interface_age = 0
+else
+ libgit2_glib_interface_age = libgit2_glib_micro_version
+endif
+
+soversion = 0
+# maintaining compatibility with the previous libtool versioning
+# current = minor * 100 + micro - interface
+# revision = interface
+current = libgit2_glib_minor_version * 100 + libgit2_glib_micro_version - libgit2_glib_interface_age
+revision = libgit2_glib_interface_age
+libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
+
+libgit2_glib_prefix = get_option('prefix')
+libgit2_glib_libdir = join_paths(libgit2_glib_prefix, get_option('libdir'))
+libgit2_glib_includedir = join_paths(libgit2_glib_prefix, get_option('includedir'))
+libgit2_glib_datadir = join_paths(libgit2_glib_prefix, get_option('datadir'))
+
+libgit2_glib_simd = []
+
+cc = meson.get_compiler('c')
+host_system = host_machine.system()
+
+conf = configuration_data()
+
+# Compat variables for pkgconfig
+conf.set('prefix', libgit2_glib_prefix)
+conf.set('exec_prefix', libgit2_glib_prefix)
+conf.set('libdir', libgit2_glib_libdir)
+conf.set('includedir', libgit2_glib_includedir)
+
+# Version macros
+conf.set('LIBGIT2_GLIB_MAJOR_VERSION', libgit2_glib_major_version)
+conf.set('LIBGIT2_GLIB_MINOR_VERSION', libgit2_glib_minor_version)
+conf.set('LIBGIT2_GLIB_MICRO_VERSION', libgit2_glib_micro_version)
+conf.set('LIBGIT2_GLIB_VERSION', libgit2_glib_version)
+
+# Compiler flags
+if cc.get_id() == 'msvc'
+ # Make MSVC more pedantic, this is a recommended pragma list
+ # from _Win32_Programming_ by Rector and Newcomer. Taken from
+ # glib's msvc_recommended_pragmas.h--please see that file for
+ # the meaning of the warning codes used here
+ test_cflags = [
+ '-W3',
+ '-we4002',
+ '-we4003',
+ '-w14010',
+ '-we4013',
+ '-w14016',
+ '-we4020',
+ '-we4021',
+ '-we4027',
+ '-we4029',
+ '-we4033',
+ '-we4035',
+ '-we4045',
+ '-we4047',
+ '-we4049',
+ '-we4053',
+ '-we4071',
+ '-we4150',
+ '-we4819'
+ ]
+else
+ test_cflags = [
+ '-ffast-math',
+ '-fstrict-aliasing',
+ '-Wall',
+ '-Wpointer-arith',
+ '-Wmissing-declarations',
+ '-Wformat=2',
+ '-Wstrict-prototypes',
+ '-Wmissing-prototypes',
+ '-Wnested-externs',
+ '-Wold-style-definition',
+ '-Wdeclaration-after-statement',
+ '-Wunused',
+ '-Wuninitialized',
+ '-Wshadow',
+ '-Wmissing-noreturn',
+ '-Wmissing-format-attribute',
+ '-Wredundant-decls',
+ '-Wlogical-op',
+ '-Wcast-align',
+ '-Wno-unused-local-typedefs',
+ '-Werror=implicit',
+ '-Werror=init-self',
+ '-Werror=main',
+ '-Werror=missing-braces',
+ '-Werror=return-type',
+ '-Werror=array-bounds',
+ '-Werror=write-strings'
+ ]
+endif
+common_flags = []
+foreach cflag: test_cflags
+ if cc.has_argument(cflag)
+ common_flags += [ cflag ]
+ endif
+endforeach
+
+# Debugging
+enable_debug = get_option('enable-debug')
+if enable_debug == 'auto'
+ if libgit2_glib_minor_version.is_odd()
+ enable_debug = 'yes'
+ else
+ enable_debug = 'minimum'
+ endif
+endif
+
+debug_flags = []
+if enable_debug == 'yes'
+ debug_flags += [
+ '-DLIBGIT2_GLIB_ENABLE_DEBUG'
+ ]
+endif
+
+if enable_debug == 'minimum'
+ debug_flags += [
+ '-DLIBGIT2_GLIB_ENABLE_DEBUG',
+ '-DG_DISABLE_CAST_CHECKS'
+ ]
+endif
+
+if enable_debug == 'no'
+ debug_flags += [
+ '-DG_DISABLE_CAST_CHECKS',
+ '-DG_DISABLE_CHECKS',
+ '-DG_DISABLE_ASSERT'
+ ]
+endif
+
+extra_args= []
+
+# Required dependencies
+gobject = dependency('gobject-2.0', version: '>= 2.30.0')
+build_gobject = gobject.found()
+
+libgit2 = dependency('libgit2', version: '>=0.24.0')
+
+conf.set('LIBGIT2_GLIB_REQS', 'gobject-2.0')
+
+build_gir = build_gobject
+if get_option('enable-introspection')
+ # XXX: Not nice, but probably our best option
+ gir = find_program('g-ir-scanner', required: false)
+ build_gir = gir.found() and not meson.is_cross_build()
+endif
+
+# Configuration for our installed config header
+libgit2_glib_conf = configuration_data()
+
+gnome = import('gnome')
+
+subdir('libgit2-glib')
+
+if get_option('enable-gtk-doc')
+ subdir('docs')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..847d9df
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,3 @@
+option('enable-gtk-doc', type: 'boolean', value: false, description: 'Enable generating the API reference
(depends on GTK-Doc)')
+option('enable-introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection')
+option('enable-debug', type: 'combo', choices: [ 'auto', 'yes', 'minimum', 'no' ], value: 'yes',
description: 'Enable debugging level')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]