[gtk/wip/smcv/system-roaring: 3/3] Add support for using a system copy of libroaring




commit 261650a46e972c5c172912d077f8a0add68a0e00
Author: Simon McVittie <smcv debian org>
Date:   Fri Aug 7 09:48:50 2020 +0100

    Add support for using a system copy of libroaring
    
    Distributions try to avoid using bundled copies of libraries that are
    maintained in an API- and ABI-stable way.
    
    Signed-off-by: Simon McVittie <smcv debian org>

 gtk/gtkbitset.c   |  4 ++++
 gtk/meson.build   |  1 +
 meson.build       | 19 +++++++++++++++++++
 meson_options.txt |  2 ++
 4 files changed, 26 insertions(+)
---
diff --git a/gtk/gtkbitset.c b/gtk/gtkbitset.c
index 7a390aaddd..593a1c3396 100644
--- a/gtk/gtkbitset.c
+++ b/gtk/gtkbitset.c
@@ -21,7 +21,11 @@
 
 #include "gtkbitset.h"
 
+#ifdef HAVE_LIBROARING
+#include <roaring/roaring.h>
+#else
 #include "roaring.c"
+#endif
 
 /**
  * SECTION:gtkbitset
diff --git a/gtk/meson.build b/gtk/meson.build
index a2d9272e74..b2e31b8083 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -968,6 +968,7 @@ gtk_deps = [
   epoxy_dep,
   libm,
   graphene_dep,
+  roaring_dep,
 ]
 
 if harfbuzz_dep.found() and pangoft_dep.found()
diff --git a/meson.build b/meson.build
index d193835a75..a07a2bd5bf 100644
--- a/meson.build
+++ b/meson.build
@@ -683,6 +683,25 @@ else
   endif
 endif
 
+roaring_dep = []
+
+internal_roaring = get_option('internal_roaring')
+if internal_roaring == 'yes'
+  message('Using bundled copy of libroaring as requested.')
+else
+  roaring_dep = dependency('roaring', required: false)
+  if roaring_dep.found()
+    cdata.set('HAVE_LIBROARING', 1)
+  else
+    if internal_roaring == 'no'
+      error('System copy of libroaring not found, but was explicitly requested.')
+    else
+      message('Using bundled copy of libroaring automatically.')
+      roaring_dep = []
+    endif
+  endif
+endif
+
 cloudproviders_enabled = get_option('cloudproviders')
 if cloudproviders_enabled
   cloudproviders_dep = dependency('cloudproviders',
diff --git a/meson_options.txt b/meson_options.txt
index f73f966d60..ce1aee4b2b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -27,6 +27,8 @@ option('profiler', type: 'boolean', value: false,
   description : 'Enable profiler support')
 option('tracker3', type: 'boolean', value: false,
   description : 'Enable Tracker3 filechooser search')
+option('internal_roaring', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto',
+  description : 'use bundled copy of libroaring?')
 
 # Print backends
 option('print-backends', type : 'string', value : 'cups,file',


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