gio: Build the portal code only on *NIX

xdg-desktop-portal support is only usable on *NIX platforms, so don't build
them on non-*NIX platforms.  Also clean up gio/Makefile.am a bit to split out
the listings for the platform-specific sources from the platform-neutral
sources, and assemble them for the final list of sources required for libgio.

https://bugzilla.gnome.org/show_bug.cgi?id=768498
This commit is contained in:
Chun-wei Fan 2016-07-11 21:51:37 +08:00
parent bb5707d6cb
commit b5258d9d76
3 changed files with 50 additions and 23 deletions

View File

@ -105,7 +105,7 @@ settings_headers = \
gsettingsschema.h \ gsettingsschema.h \
gsettings.h gsettings.h
settings_sources = \ settings_base_sources = \
gvdb/gvdb-format.h \ gvdb/gvdb-format.h \
gvdb/gvdb-reader.h \ gvdb/gvdb-reader.h \
gvdb/gvdb-reader.c \ gvdb/gvdb-reader.c \
@ -123,15 +123,21 @@ settings_sources = \
gsettings-mapping.c \ gsettings-mapping.c \
gsettings.c gsettings.c
settings_sources = $(settings_base_sources)
if OS_WIN32 if OS_WIN32
settings_sources += \ win32_settings_sources = \
gregistrysettingsbackend.h \ gregistrysettingsbackend.h \
gregistrysettingsbackend.c gregistrysettingsbackend.c
settings_sources += $(win32_settings_sources)
endif endif
if OS_COCOA if OS_COCOA
settings_sources += \ cocoa_settings_sources = \
gnextstepsettingsbackend.c gnextstepsettingsbackend.c
settings_sources += $(cocoa_settings_sources)
endif endif
application_headers = \ application_headers = \
@ -240,7 +246,7 @@ SUBDIRS += fam
endif endif
if OS_UNIX if OS_UNIX
appinfo_sources += gdesktopappinfo.c unix_appinfo_sources = gdesktopappinfo.c
platform_libadd += xdgmime/libxdgmime.la platform_libadd += xdgmime/libxdgmime.la
platform_deps += xdgmime/libxdgmime.la platform_deps += xdgmime/libxdgmime.la
unix_sources = \ unix_sources = \
@ -264,8 +270,15 @@ unix_sources = \
gfdonotificationbackend.c \ gfdonotificationbackend.c \
ggtknotificationbackend.c \ ggtknotificationbackend.c \
gportalnotificationbackend.c \ gportalnotificationbackend.c \
gdocumentportal.c \
gdocumentportal.h \
gportalsupport.c \
gportalsupport.h \
$(portal_sources) \
$(NULL) $(NULL)
appinfo_sources += $(unix_appinfo_sources)
if OS_COCOA if OS_COCOA
unix_sources += gcocoanotificationbackend.c unix_sources += gcocoanotificationbackend.c
endif endif
@ -327,9 +340,10 @@ win32_more_sources_for_vcproj = \
win32/gwin32filemonitor.c win32/gwin32filemonitor.c
if OS_WIN32 if OS_WIN32
appinfo_sources += gwin32appinfo.c gwin32appinfo.h win32_appinfo_sources = gwin32appinfo.c gwin32appinfo.h
platform_libadd += -lshlwapi -lws2_32 -ldnsapi -liphlpapi platform_libadd += -lshlwapi -lws2_32 -ldnsapi -liphlpapi
win32_sources = $(win32_actual_sources) win32_sources = $(win32_actual_sources)
appinfo_sources += $(win32_appinfo_sources)
giowin32includedir=$(includedir)/gio-win32-2.0/gio giowin32includedir=$(includedir)/gio-win32-2.0/gio
giowin32include_HEADERS = \ giowin32include_HEADERS = \
@ -370,7 +384,7 @@ portal_sources = \
$(xdp_dbus_built_sources) \ $(xdp_dbus_built_sources) \
$(NULL) $(NULL)
libgio_2_0_la_SOURCES = \ gio_base_sources = \
gappinfo.c \ gappinfo.c \
gappinfoprivate.h \ gappinfoprivate.h \
gasynchelper.c \ gasynchelper.c \
@ -392,8 +406,6 @@ libgio_2_0_la_SOURCES = \
gdatagrambased.c \ gdatagrambased.c \
gdatainputstream.c \ gdatainputstream.c \
gdataoutputstream.c \ gdataoutputstream.c \
gdocumentportal.c \
gdocumentportal.h \
gdrive.c \ gdrive.c \
gdummyfile.h \ gdummyfile.h \
gdummyfile.c \ gdummyfile.c \
@ -458,8 +470,6 @@ libgio_2_0_la_SOURCES = \
gpollableutils.c \ gpollableutils.c \
gpollfilemonitor.c \ gpollfilemonitor.c \
gpollfilemonitor.h \ gpollfilemonitor.h \
gportalsupport.c \
gportalsupport.h \
gproxy.c \ gproxy.c \
gproxyaddress.c \ gproxyaddress.c \
gproxyaddressenumerator.c \ gproxyaddressenumerator.c \
@ -520,15 +530,18 @@ libgio_2_0_la_SOURCES = \
gioenumtypes.h \ gioenumtypes.h \
gioenumtypes.c \ gioenumtypes.c \
glistmodel.c \ glistmodel.c \
gliststore.c \ gliststore.c \
$(application_sources) \
$(gdbus_sources) \
$(local_sources) \
$(NULL)
libgio_2_0_la_SOURCES = \
$(gio_base_sources) \
$(appinfo_sources) \ $(appinfo_sources) \
$(unix_sources) \ $(unix_sources) \
$(win32_sources) \ $(win32_sources) \
$(application_sources) \
$(settings_sources) \ $(settings_sources) \
$(gdbus_sources) \
$(local_sources) \
$(portal_sources) \
$(NULL) $(NULL)
EXTRA_DIST += strinfo.c EXTRA_DIST += strinfo.c
@ -903,8 +916,14 @@ gio_LDADD = libgio-2.0.la \
# #
MSVCPROJS = gio glib-compile-resources glib-compile-schemas MSVCPROJS = gio glib-compile-resources glib-compile-schemas
gio_FILES = $(libgio_2_0_la_SOURCES) $(win32_actual_sources) $(win32_more_sources_for_vcproj) gio_FILES = \
gio_EXCLUDES = gunix*.c|gdesktopappinfo.c|gnetworkmonitornetlink.c|gcontenttype.c|gnetworkmonitornm.c $(gio_base_sources) \
$(win32_actual_sources) \
$(win32_more_sources_for_vcproj) \
$(settings_base_sources) \
$(win32_settings_sources)
gio_EXCLUDES = dummy
gio_HEADERS_DIR = $(includedir)/glib-2.0/gio gio_HEADERS_DIR = $(includedir)/glib-2.0/gio
gio_HEADERS_INST = $(gioinclude_HEADERS) $(nodist_gioinclude_HEADERS) gio_HEADERS_INST = $(gioinclude_HEADERS) $(nodist_gioinclude_HEADERS)

View File

@ -23,14 +23,18 @@
#include "gappinfo.h" #include "gappinfo.h"
#include "gappinfoprivate.h" #include "gappinfoprivate.h"
#include "gcontextspecificgroup.h" #include "gcontextspecificgroup.h"
#include "gdbusconnection.h"
#include "gdbusmessage.h"
#include "glibintl.h" #include "glibintl.h"
#include <gioerror.h> #include <gioerror.h>
#include <gfile.h> #include <gfile.h>
#ifdef G_OS_UNIX
#include "gdbusconnection.h"
#include "gdbusmessage.h"
#include "gdocumentportal.h" #include "gdocumentportal.h"
#include "gportalsupport.h" #include "gportalsupport.h"
#endif
/** /**
@ -673,6 +677,7 @@ g_app_info_should_show (GAppInfo *appinfo)
return (* iface->should_show) (appinfo); return (* iface->should_show) (appinfo);
} }
#ifdef G_OS_UNIX
static gboolean static gboolean
launch_default_with_portal (const char *uri, launch_default_with_portal (const char *uri,
GAppLaunchContext *context, GAppLaunchContext *context,
@ -737,6 +742,7 @@ launch_default_with_portal (const char *uri,
return TRUE; return TRUE;
} }
#endif
/** /**
* g_app_info_launch_default_for_uri: * g_app_info_launch_default_for_uri:
@ -761,8 +767,10 @@ g_app_info_launch_default_for_uri (const char *uri,
GList l; GList l;
gboolean res; gboolean res;
#ifdef G_OS_UNIX
if (glib_should_use_portal ()) if (glib_should_use_portal ())
return launch_default_with_portal (uri, launch_context, error); return launch_default_with_portal (uri, launch_context, error);
#endif
/* g_file_query_default_handler() calls /* g_file_query_default_handler() calls
* g_app_info_get_default_for_uri_scheme() too, but we have to do it * g_app_info_get_default_for_uri_scheme() too, but we have to do it

View File

@ -903,10 +903,8 @@ extern GType _g_win32_volume_monitor_get_type (void);
extern GType _g_winhttp_vfs_get_type (void); extern GType _g_winhttp_vfs_get_type (void);
extern GType _g_dummy_proxy_resolver_get_type (void); extern GType _g_dummy_proxy_resolver_get_type (void);
extern GType g_proxy_resolver_portal_get_type (void);
extern GType _g_dummy_tls_backend_get_type (void); extern GType _g_dummy_tls_backend_get_type (void);
extern GType g_network_monitor_base_get_type (void); extern GType g_network_monitor_base_get_type (void);
extern GType g_network_monitor_portal_get_type (void);
#ifdef HAVE_NETLINK #ifdef HAVE_NETLINK
extern GType _g_network_monitor_netlink_get_type (void); extern GType _g_network_monitor_netlink_get_type (void);
extern GType _g_network_monitor_nm_get_type (void); extern GType _g_network_monitor_nm_get_type (void);
@ -916,6 +914,8 @@ extern GType _g_network_monitor_nm_get_type (void);
extern GType g_fdo_notification_backend_get_type (void); extern GType g_fdo_notification_backend_get_type (void);
extern GType g_gtk_notification_backend_get_type (void); extern GType g_gtk_notification_backend_get_type (void);
extern GType g_portal_notification_backend_get_type (void); extern GType g_portal_notification_backend_get_type (void);
extern GType g_proxy_resolver_portal_get_type (void);
extern GType g_network_monitor_portal_get_type (void);
#endif #endif
#ifdef HAVE_COCOA #ifdef HAVE_COCOA
@ -1118,6 +1118,8 @@ _g_io_modules_ensure_loaded (void)
g_type_ensure (g_fdo_notification_backend_get_type ()); g_type_ensure (g_fdo_notification_backend_get_type ());
g_type_ensure (g_gtk_notification_backend_get_type ()); g_type_ensure (g_gtk_notification_backend_get_type ());
g_type_ensure (g_portal_notification_backend_get_type ()); g_type_ensure (g_portal_notification_backend_get_type ());
g_type_ensure (g_network_monitor_portal_get_type ());
g_type_ensure (g_proxy_resolver_portal_get_type ());
#endif #endif
#ifdef HAVE_COCOA #ifdef HAVE_COCOA
g_type_ensure (g_cocoa_notification_backend_get_type ()); g_type_ensure (g_cocoa_notification_backend_get_type ());
@ -1127,7 +1129,6 @@ _g_io_modules_ensure_loaded (void)
#endif #endif
g_type_ensure (_g_local_vfs_get_type ()); g_type_ensure (_g_local_vfs_get_type ());
g_type_ensure (_g_dummy_proxy_resolver_get_type ()); g_type_ensure (_g_dummy_proxy_resolver_get_type ());
g_type_ensure (g_proxy_resolver_portal_get_type ());
g_type_ensure (_g_http_proxy_get_type ()); g_type_ensure (_g_http_proxy_get_type ());
g_type_ensure (_g_https_proxy_get_type ()); g_type_ensure (_g_https_proxy_get_type ());
g_type_ensure (_g_socks4a_proxy_get_type ()); g_type_ensure (_g_socks4a_proxy_get_type ());
@ -1135,7 +1136,6 @@ _g_io_modules_ensure_loaded (void)
g_type_ensure (_g_socks5_proxy_get_type ()); g_type_ensure (_g_socks5_proxy_get_type ());
g_type_ensure (_g_dummy_tls_backend_get_type ()); g_type_ensure (_g_dummy_tls_backend_get_type ());
g_type_ensure (g_network_monitor_base_get_type ()); g_type_ensure (g_network_monitor_base_get_type ());
g_type_ensure (g_network_monitor_portal_get_type ());
#ifdef HAVE_NETLINK #ifdef HAVE_NETLINK
g_type_ensure (_g_network_monitor_netlink_get_type ()); g_type_ensure (_g_network_monitor_netlink_get_type ());
g_type_ensure (_g_network_monitor_nm_get_type ()); g_type_ensure (_g_network_monitor_nm_get_type ());