[gnome-builder] meson-build: Match libgit checks with autoconf



commit f666377049b4b2c7baf104de4ca48a2ea3880584
Author: Patrick Griffis <tingping tingping se>
Date:   Sat Feb 25 20:04:09 2017 -0500

    meson-build: Match libgit checks with autoconf

 meson.build                 |   34 ++++++++++++++++++++++++++++++++++
 plugins/flatpak/meson.build |    2 +-
 plugins/git/meson.build     |   36 ------------------------------------
 3 files changed, 35 insertions(+), 37 deletions(-)
---
diff --git a/meson.build b/meson.build
index 488e42f..22c962e 100644
--- a/meson.build
+++ b/meson.build
@@ -124,6 +124,40 @@ libpeas_dep = dependency('libpeas-1.0', version: '>= 1.18.0')
 libm_dep = cc.find_library('m', required: false)
 libjson_glib_dep = dependency('json-glib-1.0', version: '>= 1.2.0')
 
+if get_option('with_flatpak') or get_option('with_git')
+  libgit_dep = dependency('libgit2-glib-1.0', version: '>= 0.25.0')
+
+  libgit_thread_safe_check = '''
+    #include <libgit2-glib/ggit.h>
+    int main(int argc, const char *argv[])
+    {
+      ggit_init ();
+      return ((ggit_get_features() & GGIT_FEATURE_THREADS) != 0) ? 0 : 1;
+    }
+  '''
+  res = cc.run(libgit_thread_safe_check,
+    dependencies: libgit_dep,
+  )
+  if res.returncode() != 0
+    error('libgit2 was not compiled with -DTHREADSAFE:BOOL=ON')
+  endif
+
+  libgit_ssh_check = '''
+    #include <libgit2-glib/ggit.h>
+    int main(int argc, const char *argv[])
+    {
+      ggit_init ();
+      return ((ggit_get_features() & GGIT_FEATURE_SSH) != 0) ? 0 : 1;
+    }
+  '''
+  res = cc.run(libgit_ssh_check,
+    dependencies: libgit_dep,
+  )
+  if res.returncode() != 0
+    error('libgit2 was not compiled with SSH support')
+  endif
+endif
+
 
 pkglibdir_abs = join_paths(get_option('prefix'), get_option('libdir'), 'gnome-builder')
 pkglibdir = join_paths(get_option('libdir'), 'gnome-builder')
diff --git a/plugins/flatpak/meson.build b/plugins/flatpak/meson.build
index 05a4bcc..cd6af10 100644
--- a/plugins/flatpak/meson.build
+++ b/plugins/flatpak/meson.build
@@ -44,7 +44,7 @@ flatpak_sources = [
 flatpak_deps = plugin_deps + [
   dependency('flatpak', version: '>= 0.8.0'),
   dependency('libsoup-2.4', version: '>= 2.52.0'),
-  dependency('libgit2-glib-1.0', version: '>= 0.24.0'), # FIXME: 0.25.0
+  libgit_dep,
 ]
 
 # FIXME: Check for libgit thread and ssh support
diff --git a/plugins/git/meson.build b/plugins/git/meson.build
index 3f0ed6d..2ed3f90 100644
--- a/plugins/git/meson.build
+++ b/plugins/git/meson.build
@@ -1,41 +1,5 @@
 if get_option('with_git')
 
-libgit_dep = dependency('libgit2-glib-1.0', version: '>=0.24.0')
-cc = meson.get_compiler('c')
-
-libgit_thread_safe_check = '
-               #include <libgit2-glib/ggit.h>
-               int
-               main(int argc, const char *argv[])
-               {
-                       ggit_init ();
-                       return ((ggit_get_features() & GGIT_FEATURE_THREADS) != 0) ? 0 : 1;
-               }
-'
-res = cc.run(libgit_thread_safe_check,
-  dependencies: libgit_dep,
-)
-if res.returncode() != 0
-  error('libgit2 was not compiled with -DTHREADSAFE:BOOL=ON')
-endif
-
-libgit_ssh_check = '
-               #include <libgit2-glib/ggit.h>
-               int
-               main(int argc, const char *argv[])
-               {
-                       ggit_init ();
-                       return ((ggit_get_features() & GGIT_FEATURE_SSH) != 0) ? 0 : 1;
-               }
-'
-
-res = cc.run(libgit_ssh_check,
-  dependencies: libgit_dep,
-)
-if res.returncode() != 0
-  error('libgit2 was not compiled with SSH support')
-endif
-
 git_resources = gnome.compile_resources(
   'ide-git-resources',
   'ide-git-resources.gresource.xml',


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