[libgit2-glib] meson: Use meson build files convention



commit e1797a26dca3e3b9085092b5b4e7e370f293fce3
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Tue Oct 23 07:35:35 2018 +0200

    meson: Use meson build files convention
    
    meson build files has been changed to comply with the convention[0].
    
    [0] https://github.com/mesonbuild/meson/blob/master/data/syntax-highlighting/vim/indent/meson.vim

 docs/reference/meson.build | 42 ++++++++++++-----------
 examples/meson.build       | 11 +++---
 libgit2-glib/meson.build   | 83 ++++++++++++++++++++++++++++------------------
 meson.build                | 18 +++++-----
 tests/meson.build          | 20 +++++++----
 5 files changed, 103 insertions(+), 71 deletions(-)
---
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index 8f545e7..4a414f2 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -3,26 +3,30 @@ docs_conf.set('PACKAGE_VERSION', libgit2_glib_version)
 
 name = 'version.xml'
 
-configure_file(input: name + '.in',
-               output: name,
-               configuration: docs_conf)
+configure_file(
+  input: name + '.in',
+  output: name,
+  configuration: docs_conf,
+)
 
 glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
 glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
 
-gnome.gtkdoc(libgit2_glib_api_name,
-             main_sgml: libgit2_glib_api_name + '-docs.sgml',
-             src_dir: join_paths(meson.source_root(), 'libgit2-glib'),
-             dependencies: libgit2_glib_dep,
-             gobject_typesfile: libgit2_glib_api_name + '.types',
-             scan_args: [
-               '--rebuild-types',
-               '--ignore-headers=' + ' '.join(private_headers),
-             ],
-             fixxref_args: [
-               '--extra-dir=' + join_paths(glib_docpath, 'glib'),
-               '--extra-dir=' + join_paths(glib_docpath, 'gobject'),
-               '--extra-dir=' + join_paths(glib_docpath, 'gio'),
-               '--html-dir=' + join_paths(libgit2_glib_prefix, gnome.gtkdoc_html_dir(libgit2_glib_api_name)),
-             ],
-             install: true)
+gnome.gtkdoc(
+  libgit2_glib_api_name,
+  main_sgml: libgit2_glib_api_name + '-docs.sgml',
+  src_dir: join_paths(meson.source_root(), 'libgit2-glib'),
+  dependencies: libgit2_glib_dep,
+  gobject_typesfile: libgit2_glib_api_name + '.types',
+  scan_args: [
+    '--rebuild-types',
+    '--ignore-headers=' + ' '.join(private_headers),
+  ],
+  fixxref_args: [
+    '--extra-dir=' + join_paths(glib_docpath, 'glib'),
+    '--extra-dir=' + join_paths(glib_docpath, 'gobject'),
+    '--extra-dir=' + join_paths(glib_docpath, 'gio'),
+    '--html-dir=' + join_paths(libgit2_glib_prefix, gnome.gtkdoc_html_dir(libgit2_glib_api_name)),
+  ],
+  install: true,
+)
diff --git a/examples/meson.build b/examples/meson.build
index 3987ae0..e5e8d92 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -4,11 +4,14 @@ examples = [
 ]
 
 if have_termios
-  examples += [ 'clone' ]
+  examples += ['clone']
 endif
 
 foreach example: examples
-  executable(example, example + '.c',
-             dependencies: libgit2_glib_dep,
-             include_directories: libgit2_glib_inc)
+  executable(
+    example,
+    example + '.c',
+    dependencies: libgit2_glib_dep,
+    include_directories: libgit2_glib_inc,
+  )
 endforeach
diff --git a/libgit2-glib/meson.build b/libgit2-glib/meson.build
index b71e527..f50d647 100644
--- a/libgit2-glib/meson.build
+++ b/libgit2-glib/meson.build
@@ -163,7 +163,7 @@ if enable_ssh
 #include <libgit2-glib/ggit-cred-ssh-interactive.h>
 '''
 
-  extra_args += [ '-DGIT_SSH=1' ]
+  extra_args += ['-DGIT_SSH=1']
 else
   private_headers += ssh_headers
 
@@ -179,16 +179,22 @@ sources += configure_file(
   input: ggit_h + '.in',
   output: ggit_h,
   configuration: ggit_h_conf,
-  install_dir: libgit2_glib_pkgincludedir)
+  install_dir: libgit2_glib_pkgincludedir,
+)
 
-enum_types = gnome.mkenums('ggit-enum-types',
-  sources : headers,
-  h_template : 'ggit-enum-types.h.template',
-  c_template : 'ggit-enum-types.c.template',
-  install_header : true,
-  install_dir: libgit2_glib_pkgincludedir)
+enum_types = gnome.mkenums(
+  'ggit-enum-types',
+  sources: headers,
+  h_template: 'ggit-enum-types.h.template',
+  c_template: 'ggit-enum-types.c.template',
+  install_header: true,
+  install_dir: libgit2_glib_pkgincludedir,
+)
 
-install_headers(headers, subdir: join_paths(libgit2_glib_api_name, meson.project_name()))
+install_headers(
+  headers,
+  subdir: join_paths(libgit2_glib_api_name, meson.project_name())
+)
 
 platform_deps = [
   gio_dep,
@@ -200,18 +206,20 @@ platform_deps = [
 if cc.get_id() == 'msvc'
   libgit2_glib_link_args = []
 else
-  libgit2_glib_link_args = [ '-Wl,-Bsymbolic-functions' ]
+  libgit2_glib_link_args = ['-Wl,-Bsymbolic-functions']
 endif
 
-libgit2_glib = shared_library('git2-glib-@0@'.format(libgit2_glib_api_version),
+libgit2_glib = shared_library(
+  'git2-glib-@0@'.format(libgit2_glib_api_version),
   include_directories: core_inc,
   sources: sources + enum_types + private_headers,
   version: libversion,
   soversion: soversion,
   install: true,
   dependencies: platform_deps,
-  c_args: extra_args + [ '-DG_LOG_DOMAIN="@0@"'.format(libgit2_glib_ns) ],
-  link_args: libgit2_glib_link_args)
+  c_args: extra_args + ['-DG_LOG_DOMAIN="@0@"'.format(libgit2_glib_ns)],
+  link_args: libgit2_glib_link_args,
+)
 
 pkg.generate(
   libraries: libgit2_glib,
@@ -226,32 +234,41 @@ pkg.generate(
 )
 
 # Internal dependency, for tests and benchmarks
-libgit2_glib_dep = declare_dependency(link_with: libgit2_glib,
-                                      include_directories: [ core_inc, libgit2_glib_inc ],
-                                      dependencies: platform_deps,
-                                      # Everything that uses libgit2-glib needs this built to compile
-                                      sources: enum_types[1])
+libgit2_glib_dep = declare_dependency(
+  link_with: libgit2_glib,
+  include_directories: [core_inc, libgit2_glib_inc],
+  dependencies: platform_deps,
+  # Everything that uses libgit2-glib needs this built to compile
+  sources: enum_types[1],
+)
 
 if enable_python
-  install_data('Ggit.py', install_dir: join_paths(python.sysconfig_path('purelib'), 'gi', 'overrides'))
+  install_data(
+    'Ggit.py',
+    install_dir: join_paths(python.sysconfig_path('purelib'), 'gi', 'overrides'),
+  )
 endif
 
 if enable_gir
-  libgit2_glib_gir = gnome.generate_gir(libgit2_glib,
-                                        sources: headers + sources + enum_types,
-                                        namespace: libgit2_glib_ns,
-                                        nsversion: libgit2_glib_api_version,
-                                        identifier_prefix: libgit2_glib_ns,
-                                        symbol_prefix: libgit2_glib_ns.to_lower(),
-                                        export_packages: libgit2_glib_api_name,
-                                        includes: [ 'GObject-2.0', 'GLib-2.0', 'Gio-2.0' ],
-                                        header: join_paths(meson.project_name(), ggit_h),
-                                        install: true)
+  libgit2_glib_gir = gnome.generate_gir(
+    libgit2_glib,
+    sources: headers + sources + enum_types,
+    namespace: libgit2_glib_ns,
+    nsversion: libgit2_glib_api_version,
+    identifier_prefix: libgit2_glib_ns,
+    symbol_prefix: libgit2_glib_ns.to_lower(),
+    export_packages: libgit2_glib_api_name,
+    includes: ['GObject-2.0', 'GLib-2.0', 'Gio-2.0'],
+    header: join_paths(meson.project_name(), ggit_h),
+    install: true,
+  )
 
   if enable_vapi
-    gnome.generate_vapi(libgit2_glib_api_name,
-                        sources: libgit2_glib_gir[0],
-                        packages: 'gio-2.0',
-                        install: true)
+    gnome.generate_vapi(
+      libgit2_glib_api_name,
+      sources: libgit2_glib_gir[0],
+      packages: 'gio-2.0',
+      install: true,
+    )
   endif
 endif
diff --git a/meson.build b/meson.build
index bc50b2b..13ddcdd 100644
--- a/meson.build
+++ b/meson.build
@@ -1,8 +1,10 @@
-project('libgit2-glib', 'c',
-        version: '0.27.7',
-        default_options: 'buildtype=debugoptimized',
-        license: 'LGPL2+',
-        meson_version: '>= 0.48.0')
+project(
+  'libgit2-glib', 'c',
+  version: '0.27.7',
+  default_options: 'buildtype=debugoptimized',
+  license: 'LGPL2+',
+  meson_version: '>= 0.48.0',
+)
 
 libgit2_glib_version = meson.project_version()
 version_array = libgit2_glib_version.split('.')
@@ -80,10 +82,10 @@ else
 endif
 
 if libgit2_glib_buildtype.contains('debug')
-  common_flags += [ '-DLIBGIT2_GLIB_ENABLE_DEBUG' ]
+  common_flags += ['-DLIBGIT2_GLIB_ENABLE_DEBUG']
 
   if libgit2_glib_buildtype.contains('optimized')
-    common_flags += [ '-DG_DISABLE_CAST_CHECKS' ]
+    common_flags += ['-DG_DISABLE_CAST_CHECKS']
   endif
 else
   common_flags += [
@@ -95,7 +97,7 @@ endif
 # Workaround for meson's bug
 # https://github.com/mesonbuild/meson/pull/1896
 if get_option('b_ndebug') == true
-  common_flags += [ '-DG_DISABLE_ASSERT' ]
+  common_flags += ['-DG_DISABLE_ASSERT']
 endif
 
 add_project_arguments(common_flags, language: 'c')
diff --git a/tests/meson.build b/tests/meson.build
index 175c7a2..f5ccd07 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,10 +1,16 @@
-unit_tests = [
-  'repository',
-]
+unit_tests = ['repository']
 
 foreach unit: unit_tests
-  exe = executable(unit, unit + '.c',
-                   dependencies: libgit2_glib_dep,
-                   include_directories: libgit2_glib_inc)
-  test(unit, exe, args: [ '--tap', '-k' ])
+  exe = executable(
+    unit,
+    unit + '.c',
+    dependencies: libgit2_glib_dep,
+    include_directories: libgit2_glib_inc,
+  )
+
+  test(
+    unit,
+    exe,
+    args: ['--tap', '-k'],
+  )
 endforeach


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