[evolution] Bug 722068 - Make Evolution build under Win32



commit fa3d3c2403a3fcdd7bd4b66cb2acb7baf40ab231
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jul 10 21:01:42 2014 +0200

    Bug 722068 - Make Evolution build under Win32
    
    This also makes gnome-desktop an optional dependency, which can
    be avoided with --disable-gnome-desktop configure option.

 Makefile.am                                        |    2 +-
 configure.ac                                       |   21 ++++++++++++++++-
 e-util/e-icon-factory.c                            |    8 ++++++
 e-util/e-spell-dictionary.c                        |   24 +------------------
 e-util/e-util-private.h                            |    2 +
 e-util/e-win32-reloc.c                             |    5 ++++
 evolution-shell.pc.in                              |    2 +-
 mail/e-mail-migrate.c                              |    2 +
 .../book-config-ldap/evolution-book-config-ldap.c  |    5 ----
 modules/plugin-lib/e-plugin-lib.c                  |    2 +-
 shell/e-shell-window-private.c                     |    2 +-
 shell/main.c                                       |    5 ++++
 12 files changed, 48 insertions(+), 32 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 2bfd8a2..cfefa7c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,7 @@ pkgconfigdir = $(libdir)/pkgconfig
 INTERFACE_VERSION=3.0
 
 %-$(INTERFACE_VERSION).pc: %.pc
-        cp $< $@
+       cat $< | grep -x -v "Requires.private: " >$@
 
 pkgconfig_in_files =                                   \
        evolution-calendar-$(INTERFACE_VERSION).pc      \
diff --git a/configure.ac b/configure.ac
index e0fb89d..57d1a64 100644
--- a/configure.ac
+++ b/configure.ac
@@ -271,9 +271,23 @@ PKG_CHECK_MODULES([GNOME_PLATFORM],
         gcr-3 >= gcr_minimum_version
         libxml-2.0 >= libxml_minimum_version
         shared-mime-info >= shared_mime_info_minimum_version
-        gnome-desktop-3.0 >= gnome_desktop_minimum_version
         gsettings-desktop-schemas >= gsettings_desktop_schemas_minimum_version
         webkitgtk-3.0 >= webkitgtk_minimum_version])
+
+GNOME_DESKTOP_DEPENDENCY=""
+AC_ARG_ENABLE([gnome-desktop],
+       [AS_HELP_STRING([--enable-gnome-desktop],
+       [Enable GNOME desktop dependency for thumbnails @<:@default=yes@:>@])],
+       [enable_gnome_desktop="$enableval"], [enable_gnome_desktop=yes])
+
+if test "$enable_gnome_desktop" = "yes"; then
+       GNOME_DESKTOP_DEPENDENCY=gnome-desktop-3.0
+       PKG_CHECK_MODULES([GNOME_DESKTOP], [$GNOME_DESKTOP_DEPENDENCY >= gnome_desktop_minimum_version])
+       GNOME_PLATFORM_CFLAGS="$GNOME_PLATFORM_CFLAGS $GNOME_DESKTOP_CFLAGS"
+       GNOME_PLATFORM_LIBS="$GNOME_PLATFORM_LIBS $GNOME_DESKTOP_LIBS"
+       AC_DEFINE(HAVE_GNOME_DESKTOP, 1, [gnome-desktop])
+fi
+AC_SUBST(GNOME_DESKTOP_DEPENDENCY)
 AC_SUBST(GNOME_PLATFORM_CFLAGS)
 AC_SUBST(GNOME_PLATFORM_LIBS)
 
@@ -286,6 +300,11 @@ PKG_CHECK_MODULES([EVOLUTION_DATA_SERVER],
 AC_SUBST(EVOLUTION_DATA_SERVER_CFLAGS)
 AC_SUBST(EVOLUTION_DATA_SERVER_LIBS)
 
+dnl **************************************************
+dnl wait.h is not available on win32
+dnl **************************************************
+
+AC_CHECK_HEADERS(sys/wait.h, AC_DEFINE(HAVE_SYS_WAIT_H, 1, [Have <sys/wait.h>]))
 
 dnl ****************
 dnl Enchant Library
diff --git a/e-util/e-icon-factory.c b/e-util/e-icon-factory.c
index 43c1239..7aac6f6 100644
--- a/e-util/e-icon-factory.c
+++ b/e-util/e-icon-factory.c
@@ -29,9 +29,11 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#ifdef HAVE_GNOME_DESKTOP
 #define GNOME_DESKTOP_USE_UNSTABLE_API
 #include <libgnome-desktop/gnome-desktop-thumbnail.h>
 #undef GNOME_DESKTOP_USE_UNSTABLE_API
+#endif
 
 #include <glib/gstdio.h>
 #include <gtk/gtk.h>
@@ -147,9 +149,11 @@ e_icon_factory_pixbuf_scale (GdkPixbuf *pixbuf,
        if (height <= 0)
                height = 1;
 
+       #ifdef HAVE_GNOME_DESKTOP
        /* because this can only scale down, not up */
        if (gdk_pixbuf_get_width (pixbuf) > width && gdk_pixbuf_get_height (pixbuf) > height)
                return gnome_desktop_thumbnail_scale_down_pixbuf (pixbuf, width, height);
+       #endif
 
        return gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
 }
@@ -166,6 +170,7 @@ e_icon_factory_pixbuf_scale (GdkPixbuf *pixbuf,
 gchar *
 e_icon_factory_create_thumbnail (const gchar *filename)
 {
+#ifdef HAVE_GNOME_DESKTOP
        static GnomeDesktopThumbnailFactory *thumbnail_factory = NULL;
        struct stat file_stat;
        gchar *thumbnail = NULL;
@@ -211,4 +216,7 @@ e_icon_factory_create_thumbnail (const gchar *filename)
        }
 
        return thumbnail;
+#else
+       return NULL;
+#endif /* HAVE_GNOME_DESKTOP */
 }
diff --git a/e-util/e-spell-dictionary.c b/e-util/e-spell-dictionary.c
index e6e06b7..12f2b6e 100644
--- a/e-util/e-spell-dictionary.c
+++ b/e-util/e-spell-dictionary.c
@@ -20,6 +20,7 @@
 #include <config.h>
 #endif
 
+#include "e-util-private.h"
 #include "e-spell-dictionary.h"
 #include "e-spell-checker.h"
 
@@ -69,27 +70,6 @@ G_DEFINE_TYPE (
 #undef DATADIR
 #endif
 #include <shlobj.h>
-static HMODULE hmodule;
-
-BOOL WINAPI
-DllMain (HINSTANCE hinstDLL,
-         DWORD fdwReason,
-         LPVOID lpvReserved);
-
-BOOL WINAPI
-DllMain (HINSTANCE hinstDLL,
-         DWORD fdwReason,
-         LPVOID lpvReserved)
-{
-       switch (fdwReason)
-    {
-    case DLL_PROCESS_ATTACH:
-               hmodule = hinstDLL;
-               break;
-    }
-
-       return TRUE;
-}
 
 static gchar *
 _get_iso_codes_prefix (void)
@@ -101,7 +81,7 @@ _get_iso_codes_prefix (void)
        if (beenhere)
                return retval;
 
-       if (!(temp_dir = g_win32_get_package_installation_directory_of_module ((gpointer) hmodule))) {
+       if (!(temp_dir = g_win32_get_package_installation_directory_of_module (_e_get_dll_hmodule ()))) {
                strcpy (retval, ISO_CODES_PREFIX);
                return retval;
        }
diff --git a/e-util/e-util-private.h b/e-util/e-util-private.h
index e0205e9..030f2b6 100644
--- a/e-util/e-util-private.h
+++ b/e-util/e-util-private.h
@@ -34,6 +34,8 @@
 
 #define fsync(fd) 0
 
+gpointer _e_get_dll_hmodule (void) G_GNUC_CONST;
+
 const gchar *_e_get_bindir (void) G_GNUC_CONST;
 const gchar *_e_get_datadir (void) G_GNUC_CONST;
 const gchar *_e_get_ecpsdir (void) G_GNUC_CONST;
diff --git a/e-util/e-win32-reloc.c b/e-util/e-win32-reloc.c
index bf03256..2c559cf 100644
--- a/e-util/e-win32-reloc.c
+++ b/e-util/e-win32-reloc.c
@@ -178,3 +178,8 @@ GETTER(sounddir)
 GETTER(sysconfdir)
 GETTER(toolsdir)
 GETTER(uidir)
+
+gpointer _e_get_dll_hmodule (void)
+{
+       return hmodule;
+}
diff --git a/evolution-shell.pc.in b/evolution-shell.pc.in
index 85872e8..9954edc 100644
--- a/evolution-shell.pc.in
+++ b/evolution-shell.pc.in
@@ -19,6 +19,6 @@ Name: evolution-shell
 Description: libraries needed for Evolution shell components
 Version: @VERSION@
 Requires: gtk+-3.0 libebackend-1.2 webkitgtk-3.0
-Requires.private: gnome-desktop-3.0
+Requires.private: @GNOME_DESKTOP_DEPENDENCY@
 Libs: -L${privlibdir} -levolution-shell -levolution-util -Wl,-R${privlibdir}
 Cflags: -I${privincludedir}
diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c
index bb88d3c..9554c4e 100644
--- a/mail/e-mail-migrate.c
+++ b/mail/e-mail-migrate.c
@@ -138,8 +138,10 @@ cp (const gchar *src,
                        em_migrate_set_progress (((gdouble) total) / ((gdouble) st.st_size));
        } while (total < st.st_size);
 
+       #ifndef G_OS_WIN32
        if (fsync (writefd) == -1)
                goto exception;
+       #endif
 
        close (readfd);
        if (close (writefd) == -1)
diff --git a/modules/book-config-ldap/evolution-book-config-ldap.c 
b/modules/book-config-ldap/evolution-book-config-ldap.c
index feb0167..d76cbdb 100644
--- a/modules/book-config-ldap/evolution-book-config-ldap.c
+++ b/modules/book-config-ldap/evolution-book-config-ldap.c
@@ -25,15 +25,10 @@
 
 #include "e-source-ldap.h"
 
-#ifndef G_OS_WIN32
 #include <ldap.h>
 #ifndef SUNLDAP
 #include <ldap_schema.h>
 #endif
-#else
-#include <winldap.h>
-#include "openldap-extract.h"
-#endif
 
 /* Combo box ordering */
 #define LDAP_PORT  389
diff --git a/modules/plugin-lib/e-plugin-lib.c b/modules/plugin-lib/e-plugin-lib.c
index 46ddae3..a97dd24 100644
--- a/modules/plugin-lib/e-plugin-lib.c
+++ b/modules/plugin-lib/e-plugin-lib.c
@@ -25,7 +25,7 @@
 #include "e-plugin-lib.h"
 
 #ifdef G_OS_WIN32
-#include <libedataserver/e-data-server-util.h> /* for e_util_replace_prefix() */
+#include <libedataserver/libedataserver.h> /* for e_util_replace_prefix() */
 #endif
 
 #include <string.h>
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c
index 6761206..7a84b2e 100644
--- a/shell/e-shell-window-private.c
+++ b/shell/e-shell-window-private.c
@@ -260,9 +260,9 @@ e_shell_window_private_constructed (EShellWindow *shell_window)
        GtkWindow *window;
        guint merge_id;
        const gchar *id;
+       GSettings *settings;
 
 #ifndef G_OS_WIN32
-       GSettings *settings;
        GtkActionGroup *action_group;
 #endif
 
diff --git a/shell/main.c b/shell/main.c
index 3125cd5..62d2456 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -38,7 +38,9 @@
 #ifdef DATADIR
 #undef DATADIR
 #endif
+#ifndef _WIN32_WINNT
 #define _WIN32_WINNT 0x0601
+#endif
 #include <windows.h>
 #include <conio.h>
 #include <io.h>
@@ -48,6 +50,9 @@
 #ifndef PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
 #define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 0x00000002
 #endif
+
+#include "e-util/e-util-private.h"
+
 #endif
 
 #include <libxml/xmlmemory.h>


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