[geary/geary-0.13] Merge branch 'optional_libunwind' into 'master'
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/geary-0.13] Merge branch 'optional_libunwind' into 'master'
- Date: Wed, 20 Feb 2019 01:44:40 +0000 (UTC)
commit 1124f2d558f254a95cd61d2137a23dec9b5d9c23
Author: Michael Gratton <mike vee net>
Date: Wed Feb 20 01:43:47 2019 +0000
Merge branch 'optional_libunwind' into 'master'
Allow to opt-out from using libunwind.
See merge request GNOME/geary!109
(cherry picked from commit 8081f46621e3e9412a036a4075ff077b96227b52)
a1377f34 Allow to opt-out from using libunwind.
b120525f Turn the 'libunwind' build option into a boolean.
meson.build | 31 ++++++++++++++++---------------
meson_options.txt | 1 +
src/engine/meson.build | 11 ++++++++++-
src/engine/util/util-error-context.vala | 4 ++++
4 files changed, 31 insertions(+), 16 deletions(-)
---
diff --git a/meson.build b/meson.build
index b2d0752f..2917804f 100644
--- a/meson.build
+++ b/meson.build
@@ -70,8 +70,8 @@ libmath = cc.find_library('m')
libnotify = dependency('libnotify', version: '>= 0.7.5')
libsecret = dependency('libsecret-1', version: '>= 0.11')
libsoup = dependency('libsoup-2.4', version: '>= 2.48')
-libunwind_dep = dependency('libunwind', version: '>= 1.1')
-libunwind_generic_dep = dependency('libunwind-generic', version: '>= 1.1')
+libunwind_dep = dependency('libunwind', version: '>= 1.1', required: get_option('libunwind'))
+libunwind_generic_dep = dependency('libunwind-generic', version: '>= 1.1', required: get_option('libunwind'))
libxml = dependency('libxml-2.0', version: '>= 2.7.8')
posix = valac.find_library('posix')
webkit2gtk_web_extension = dependency('webkit2gtk-web-extension-4.0', version: '>=' + target_webkit)
@@ -81,19 +81,20 @@ if not enchant.found()
enchant = dependency('enchant', version: '>=1.6')
endif
-
-# Libunwind system dependencies above ensures appropriate versions,
-# but this declared depencency is what we actually build against so we
-# can include the custom VAPI correctly. We need to add unwind_lib to
-# the search path for these so Flatpak builds can find the C lib.
-unwind_lib = libunwind_dep.get_pkgconfig_variable('libdir')
-libunwind = declare_dependency(
- dependencies: [
- valac.find_library('libunwind', dirs: [vapi_dir, unwind_lib]),
- cc.find_library('libunwind', dirs: unwind_lib),
- cc.find_library('libunwind-generic', dirs: unwind_lib)
- ],
- )
+if libunwind_dep.found()
+ # Libunwind system dependencies above ensures appropriate versions,
+ # but this declared depencency is what we actually build against so we
+ # can include the custom VAPI correctly. We need to add unwind_lib to
+ # the search path for these so Flatpak builds can find the C lib.
+ unwind_lib = libunwind_dep.get_pkgconfig_variable('libdir')
+ libunwind = declare_dependency(
+ dependencies: [
+ valac.find_library('libunwind', dirs: [vapi_dir, unwind_lib]),
+ cc.find_library('libunwind', dirs: unwind_lib),
+ cc.find_library('libunwind-generic', dirs: unwind_lib)
+ ],
+ )
+endif
# Optional libraries
libunity = dependency('unity', version: '>= 5.12.0', required: false)
diff --git a/meson_options.txt b/meson_options.txt
index 234e979d..63bbce7e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,3 +4,4 @@ option('poodle', type: 'boolean', value: true, description: 'Whether to apply th
option('ref_tracking', type: 'boolean', value: false, description: 'Whether to use explicit reference
tracking.')
option('iso_639_xml', type: 'string', value: '', description: 'Full path to the ISO 639 XML file.')
option('iso_3166_xml', type: 'string', value: '', description: 'Full path to the ISO 3166 XML file.')
+option('libunwind', type: 'boolean', value: true, description: 'Whether to depend on libunwind.')
diff --git a/src/engine/meson.build b/src/engine/meson.build
index f9fb1626..3f5bfad9 100644
--- a/src/engine/meson.build
+++ b/src/engine/meson.build
@@ -332,12 +332,15 @@ geary_engine_dependencies = [
glib,
gmime,
javascriptcoregtk,
- libunwind,
libxml,
posix,
sqlite
]
+if libunwind_dep.found()
+ geary_engine_dependencies += libunwind
+endif
+
build_dir = meson.current_build_dir()
# Generate internal VAPI for unit testing. See Meson issue
@@ -349,6 +352,12 @@ geary_engine_vala_options += [
'--internal-vapi=@0@/geary-engine-internal.vapi'.format(build_dir)
]
+if libunwind_dep.found()
+ geary_engine_vala_options += [
+ '-D', 'HAVE_LIBUNWIND',
+ ]
+endif
+
geary_engine_lib = static_library('geary-engine',
geary_engine_sources,
dependencies: geary_engine_dependencies,
diff --git a/src/engine/util/util-error-context.vala b/src/engine/util/util-error-context.vala
index 81cfcb8b..b4f3008f 100644
--- a/src/engine/util/util-error-context.vala
+++ b/src/engine/util/util-error-context.vala
@@ -28,6 +28,7 @@ public class Geary.ErrorContext : BaseObject {
public string name = "unknown";
+#if HAVE_LIBUNWIND
internal StackFrame(Unwind.Cursor frame) {
uint8 proc_name[256];
int ret = -frame.get_proc_name(proc_name);
@@ -36,6 +37,7 @@ public class Geary.ErrorContext : BaseObject {
this.name = (string) proc_name;
}
}
+#endif
public string to_string() {
return this.name;
@@ -56,6 +58,7 @@ public class Geary.ErrorContext : BaseObject {
public ErrorContext(GLib.Error thrown) {
this.thrown = thrown;
+#if HAVE_LIBUNWIND
Unwind.Context trace = Unwind.Context();
Unwind.Cursor cursor = Unwind.Cursor.local(trace);
@@ -64,6 +67,7 @@ public class Geary.ErrorContext : BaseObject {
while (cursor.step() != 0) {
this.backtrace.add(new StackFrame(cursor));
}
+#endif
}
/** Returns a string representation of the error type, for debugging. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]