summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2020-10-01 10:07:28 +0100
committerSimon McVittie <smcv@debian.org>2020-10-01 10:36:33 +0100
commitafd155430075cee5380334a9c263cc28426fc79c (patch)
tree11c59a71af08872bc9f3de73bc880d06d387e1cb
parent66170163c605dd86a7898634208a13d4e17d95f6 (diff)
downloadepiphany-wip/smcv/libportal-optional.tar.gz
build: Allow libportal support to be disabledwip/smcv/libportal-optional
It isn't clear whether the API/ABI of libportal are entirely stable yet (https://github.com/flatpak/libportal/issues/33) so it is not necessarily appropriate for longer-term-supported OS distributions to include it. When building a version of epiphany for a distribution package, which is only intended to be packaged in a format other than as a Flatpak app, libportal isn't necessary anyway. libportal is also Linux-specific, so non-Linux OSs will likely want to disable it (even if it might compile successfully). Signed-off-by: Simon McVittie <smcv@debian.org>
-rw-r--r--lib/ephy-flatpak-utils.c9
-rw-r--r--meson.build26
-rw-r--r--meson_options.txt6
3 files changed, 29 insertions, 12 deletions
diff --git a/lib/ephy-flatpak-utils.c b/lib/ephy-flatpak-utils.c
index 6f91e5ff5..818af95f4 100644
--- a/lib/ephy-flatpak-utils.c
+++ b/lib/ephy-flatpak-utils.c
@@ -28,7 +28,9 @@
#include <fcntl.h>
#include <gio/gio.h>
#include <gio/gunixfdlist.h>
+#if USE_LIBPORTAL
#include <libportal/portal-gtk3.h>
+#endif
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -63,6 +65,7 @@ ephy_is_running_inside_flatpak (void)
return under_flatpak;
}
+#if USE_LIBPORTAL
static void
opened_uri (GObject *object,
GAsyncResult *result,
@@ -81,11 +84,13 @@ opened_uri (GObject *object,
if (!res)
g_warning ("%s", error->message);
}
+#endif
static void
ephy_open_uri (const char *uri,
gboolean is_dir)
{
+#if USE_LIBPORTAL
GApplication *application;
GtkWindow *window;
XdpParent *parent;
@@ -101,6 +106,10 @@ ephy_open_uri (const char *uri,
xdp_portal_open_uri (g_steal_pointer (&portal), parent, uri, XDP_OPEN_URI_FLAG_ASK, NULL, opened_uri, GINT_TO_POINTER (FALSE));
xdp_parent_free (parent);
+#else
+ g_warning ("Flatpak portal support disabled at compile time, cannot open %s",
+ uri);
+#endif
}
void
diff --git a/meson.build b/meson.build
index 9160738bd..4dcd7ad5b 100644
--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,7 @@
project('epiphany', 'c',
license: 'GPL3+',
version: '40.alpha',
- meson_version: '>= 0.46.0',
+ meson_version: '>= 0.47.0',
default_options: ['c_std=gnu11',
'warning_level=2']
)
@@ -74,16 +74,6 @@ if gsb_api_key != ''
endif
conf.set10('ENABLE_GSB', get_option('enable_gsb'))
-config_h = declare_dependency(
- sources: vcs_tag(
- input: configure_file(
- output: 'config.h.in',
- configuration: conf
- ),
- output: 'config.h'
- )
-)
-
glib_requirement = '>= 2.61.2'
gtk_requirement = '>= 3.24.0'
nettle_requirement = '>= 3.4'
@@ -108,11 +98,23 @@ libsecret_dep = dependency('libsecret-1', version: '>= 0.19.0')
libsoup_dep = dependency('libsoup-2.4', version: '>= 2.48.0')
libxml_dep = dependency('libxml-2.0', version: '>= 2.6.12')
nettle_dep = dependency('nettle', version: nettle_requirement)
-portal_dep = dependency('libportal', version: '>= 0.0.2')
+portal_dep = dependency('libportal', version: '>= 0.0.2', required: get_option('libportal'))
sqlite3_dep = dependency('sqlite3', version: '>= 3.22')
webkit2gtk_dep = dependency('webkit2gtk-4.0', version: webkitgtk_requirement)
webkit2gtk_web_extension_dep = dependency('webkit2gtk-web-extension-4.0', version: webkitgtk_requirement)
+conf.set10('USE_LIBPORTAL', portal_dep.found())
+
+config_h = declare_dependency(
+ sources: vcs_tag(
+ input: configure_file(
+ output: 'config.h.in',
+ configuration: conf
+ ),
+ output: 'config.h'
+ )
+)
+
cc = meson.get_compiler('c')
gmp_dep = cc.find_library('gmp')
m_dep = cc.find_library('m', required: false)
diff --git a/meson_options.txt b/meson_options.txt
index 7f3648781..cd83fcdca 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,6 +4,12 @@ option('developer_mode',
description: 'Enable developer mode'
)
+option('libportal',
+ type: 'feature',
+ value: 'enabled',
+ description: 'Depend on libportal for Flatpak support'
+)
+
option('network_tests',
type: 'feature',
value: 'disabled',