Commit 1dc1cf0b authored by Milan Crha's avatar Milan Crha

Miscellaneous Win32 related changes

 * use e_util_win32_initialize() in main() to avoid code duplication
 * e-spinner - correct image path build under win32
 * export WIN32_SERVICELIBEXECDIR when building eds, which relies on it now
 * update D-Bus patch and session-local.conf creation, thus D-Bus
   can actually autostart services
parent f863aa6d
......@@ -29,20 +29,15 @@
#include <libebook/libebook.h>
#include "e-util/e-util-private.h"
#include "evolution-addressbook-export.h"
#ifdef G_OS_WIN32
#ifdef DATADIR
#undef DATADIR
#endif
#include <windows.h>
#include <conio.h>
#ifndef PROCESS_DEP_ENABLE
#define PROCESS_DEP_ENABLE 0x00000001
#endif
#ifndef PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
#define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 0x00000002
#endif
#include <libedataserver/libedataserver.h>
#endif
/* Command-Line Options */
......@@ -82,25 +77,7 @@ main (gint argc,
gint IsVCard = FALSE;
#ifdef G_OS_WIN32
/* Reduce risks */
{
typedef BOOL (WINAPI *t_SetDllDirectoryA) (LPCSTR lpPathName);
t_SetDllDirectoryA p_SetDllDirectoryA;
p_SetDllDirectoryA = GetProcAddress (GetModuleHandle ("kernel32.dll"), "SetDllDirectoryA");
if (p_SetDllDirectoryA)
(*p_SetDllDirectoryA) ("");
}
#ifndef _WIN64
{
typedef BOOL (WINAPI *t_SetProcessDEPPolicy) (DWORD dwFlags);
t_SetProcessDEPPolicy p_SetProcessDEPPolicy;
p_SetProcessDEPPolicy = GetProcAddress (GetModuleHandle ("kernel32.dll"), "SetProcessDEPPolicy");
if (p_SetProcessDEPPolicy)
(*p_SetProcessDEPPolicy) (PROCESS_DEP_ENABLE | PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION);
}
#endif
e_util_win32_initialize ();
#endif
/*i18n-lize */
......
......@@ -33,14 +33,7 @@
#include "config-data.h"
#ifdef G_OS_WIN32
#include <windows.h>
#include <conio.h>
#ifndef PROCESS_DEP_ENABLE
#define PROCESS_DEP_ENABLE 0x00000001
#endif
#ifndef PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
#define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 0x00000002
#endif
#include <libedataserver/libedataserver.h>
#endif
#include "e-util/e-util-private.h"
......@@ -52,28 +45,9 @@ main (gint argc,
AlarmNotify *alarm_notify_service;
gint exit_status;
GError *error = NULL;
#ifdef G_OS_WIN32
gchar *path;
/* Reduce risks */
{
typedef BOOL (WINAPI *t_SetDllDirectoryA) (LPCSTR lpPathName);
t_SetDllDirectoryA p_SetDllDirectoryA;
p_SetDllDirectoryA = GetProcAddress (GetModuleHandle ("kernel32.dll"), "SetDllDirectoryA");
if (p_SetDllDirectoryA)
(*p_SetDllDirectoryA) ("");
}
#ifndef _WIN64
{
typedef BOOL (WINAPI *t_SetProcessDEPPolicy) (DWORD dwFlags);
t_SetProcessDEPPolicy p_SetProcessDEPPolicy;
p_SetProcessDEPPolicy = GetProcAddress (GetModuleHandle ("kernel32.dll"), "SetProcessDEPPolicy");
if (p_SetProcessDEPPolicy)
(*p_SetProcessDEPPolicy) (PROCESS_DEP_ENABLE | PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION);
}
#endif
#ifdef G_OS_WIN32
e_util_win32_initialize ();
#endif
bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
......@@ -84,13 +58,6 @@ main (gint argc,
e_gdbus_templates_init_main_thread ();
#ifdef G_OS_WIN32
path = g_build_path (";", _e_get_bindir (), g_getenv ("PATH"), NULL);
if (!g_setenv ("PATH", path, TRUE))
g_warning ("Could not set PATH for Evolution Alarm Notifier");
#endif
alarm_notify_service = alarm_notify_new (NULL, &error);
if (error != NULL) {
......
......@@ -22,6 +22,8 @@
#include <gtk/gtk.h>
#include "e-util/e-util-private.h"
#include "e-spinner.h"
#define MAIN_IMAGE_FILENAME "working.png"
......@@ -112,7 +114,15 @@ e_spinner_constructed (GObject *object)
spinner = E_SPINNER (object);
#ifdef G_OS_WIN32
{
gchar *filename = g_strconcat (EVOLUTION_IMAGESDIR, G_DIR_SEPARATOR_S, MAIN_IMAGE_FILENAME, NULL);
main_pixbuf = gdk_pixbuf_new_from_file (filename, &error);
g_free (filename);
}
#else
main_pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR G_DIR_SEPARATOR_S MAIN_IMAGE_FILENAME, &error);
#endif
if (!main_pixbuf) {
g_warning ("%s: Failed to load image: %s", error ? error->message : "Unknown error", G_STRFUNC);
g_clear_error (&error);
......
......@@ -34,14 +34,6 @@
#ifdef DATADIR
#undef DATADIR
#endif
#include <windows.h>
#include <conio.h>
#ifndef PROCESS_DEP_ENABLE
#define PROCESS_DEP_ENABLE 0x00000001
#endif
#ifndef PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
#define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 0x00000002
#endif
#endif
#include "e-util/e-util-private.h"
......@@ -836,33 +828,7 @@ main (gint argc,
GError *error = NULL;
#ifdef G_OS_WIN32
/* Reduce risks */
{
typedef BOOL (WINAPI *t_SetDllDirectoryA) (LPCSTR lpPathName);
t_SetDllDirectoryA p_SetDllDirectoryA;
p_SetDllDirectoryA = GetProcAddress (
GetModuleHandle ("kernel32.dll"),
"SetDllDirectoryA");
if (p_SetDllDirectoryA != NULL)
p_SetDllDirectoryA ("");
}
#ifndef _WIN64
{
typedef BOOL (WINAPI *t_SetProcessDEPPolicy) (DWORD dwFlags);
t_SetProcessDEPPolicy p_SetProcessDEPPolicy;
p_SetProcessDEPPolicy = GetProcAddress (
GetModuleHandle ("kernel32.dll"),
"SetProcessDEPPolicy");
if (p_SetProcessDEPPolicy)
p_SetProcessDEPPolicy (
PROCESS_DEP_ENABLE |
PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION);
}
#endif
e_util_win32_initialize ();
#endif
bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
......
......@@ -41,17 +41,10 @@
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0601
#endif
#include <windows.h>
#include <conio.h>
#include <io.h>
#ifndef PROCESS_DEP_ENABLE
#define PROCESS_DEP_ENABLE 0x00000001
#endif
#ifndef PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
#define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 0x00000002
#endif
#include <windows.h>
#include "e-util/e-util-private.h"
#include <libedataserver/libedataserver.h>
#endif
......@@ -431,50 +424,7 @@ main (gint argc,
GError *error = NULL;
#ifdef G_OS_WIN32
gchar *path;
/* Reduce risks */
{
typedef BOOL (WINAPI *t_SetDllDirectoryA) (LPCSTR lpPathName);
t_SetDllDirectoryA p_SetDllDirectoryA;
p_SetDllDirectoryA = GetProcAddress (
GetModuleHandle ("kernel32.dll"),
"SetDllDirectoryA");
if (p_SetDllDirectoryA)
(*p_SetDllDirectoryA) ("");
}
#ifndef _WIN64
{
typedef BOOL (WINAPI *t_SetProcessDEPPolicy) (DWORD dwFlags);
t_SetProcessDEPPolicy p_SetProcessDEPPolicy;
p_SetProcessDEPPolicy = GetProcAddress (
GetModuleHandle ("kernel32.dll"),
"SetProcessDEPPolicy");
if (p_SetProcessDEPPolicy)
(*p_SetProcessDEPPolicy) (
PROCESS_DEP_ENABLE |
PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION);
}
#endif
if (fileno (stdout) != -1 && _get_osfhandle (fileno (stdout)) != -1) {
/* stdout is fine, presumably redirected to a file or pipe */
} else {
typedef BOOL (* WINAPI AttachConsole_t) (DWORD);
AttachConsole_t p_AttachConsole =
(AttachConsole_t) GetProcAddress (
GetModuleHandle ("kernel32.dll"), "AttachConsole");
if (p_AttachConsole && p_AttachConsole (ATTACH_PARENT_PROCESS)) {
freopen ("CONOUT$", "w", stdout);
dup2 (fileno (stdout), 1);
freopen ("CONOUT$", "w", stderr);
dup2 (fileno (stderr), 2);
}
}
e_util_win32_initialize ();
#endif
/* Make ElectricFence work. */
......@@ -521,13 +471,6 @@ main (gint argc,
e_gdbus_templates_init_main_thread ();
#ifdef G_OS_WIN32
path = g_build_path (";", _e_get_bindir (), g_getenv ("PATH"), NULL);
if (!g_setenv ("PATH", path, TRUE))
g_warning ("Could not set PATH for Evolution and its child processes");
g_free (path);
if (register_handlers || reinstall || show_icons) {
_e_win32_register_mailer ();
_e_win32_register_addressbook ();
......
......@@ -54,7 +54,8 @@ $(BUILD_ROOT_EVO)/lib/pkgconfig/libedataserver-1.2.pc:
@if test ! -f "../../evolution-data-server/gtk-doc.make" ; then \
cp "patches/gtk-doc.make" "../../evolution-data-server/"; \
fi
@./build acmmi "$(BUILD_ROOT_EVO)" ../../../evolution-data-server "" "--enable-weather --disable-goa --disable-uoa --disable-examples --without-libdb --with-openldap=$(BUILD_ROOT_DEPS) $(DISABLE_GTK_DOC)" $(VERBOSE)
@cd "$(BUILD_ROOT_EVO)/libexec" && export WIN32_SERVICELIBEXECDIR=`pwd -W` && cd - >/dev/null && \
./build acmmi "$(BUILD_ROOT_EVO)" ../../../evolution-data-server "" "--enable-weather --disable-goa --disable-uoa --disable-examples --without-libdb --with-openldap=$(BUILD_ROOT_DEPS) $(DISABLE_GTK_DOC)" $(VERBOSE)
evolution-master: env evolution-data-server-master $(BUILD_ROOT_EVO)/lib/pkgconfig/evolution-shell-3.0.pc
......@@ -66,7 +67,7 @@ $(BUILD_ROOT_EVO)/lib/pkgconfig/evolution-shell-3.0.pc:
@if test ! -f "../../evolution/gtk-doc.make" ; then \
cp "patches/gtk-doc.make" "../../evolution/"; \
fi
@./build acmmi "$(BUILD_ROOT_EVO)" ../../../evolution "" "--enable-plugins=all --enable-weather --disable-canberra --disable-contact-maps --disable-goa --disable-libcryptui --disable-bogofilter --disable-spamassassin --disable-text-highlight --disable-pst-import --disable-gnome-desktop --without-clutter --without-help $(DISABLE_GTK_DOC)" $(VERBOSE)
@./build acmmi "$(BUILD_ROOT_EVO)" ../../../evolution "" "--enable-plugins=all --enable-weather --disable-canberra --disable-contact-maps --disable-goa --disable-libcryptui --disable-bogofilter --disable-spamassassin --disable-text-highlight --disable-pst-import --disable-gnome-desktop --disable-autoar --without-clutter --without-help $(DISABLE_GTK_DOC)" $(VERBOSE)
evolution-ews-master: env evolution-master $(BUILD_ROOT_EVO)/lib/evolution-data-server/libeews-1.2.dll.a
......@@ -586,7 +587,7 @@ gdk-pixbuf: env giflib libpng libjpeg libtiff jasper glib $(BUILD_ROOT_DEPS)/lib
$(BUILD_ROOT_DEPS)/lib/pkgconfig/gdk-pixbuf-2.0.pc:
@./get-src https://download.gnome.org/sources/gdk-pixbuf/2.30 gdk-pixbuf-2.30.2.tar.xz
@./build cmmi "$(BUILD_ROOT_DEPS)" gdk-pixbuf-2.30.2 "" "--disable-static --with-libjasper" $(VERBOSE)
@./build cmmi "$(BUILD_ROOT_DEPS)" gdk-pixbuf-2.30.2 "" "--disable-static --disable-modules --with-libjasper" $(VERBOSE)
libcroco: env glib $(BUILD_ROOT_DEPS)/lib/pkgconfig/libcroco-0.6.pc
......
diff -upr -x .deps -x .libs -x '*.la' dbus-1.8.0.old/dbus/Makefile.am dbus-1.8.0/dbus/Makefile.am
--- dbus-1.8.0.old/dbus/Makefile.am 2014-01-20 13:40:21 +0000
+++ dbus-1.8.0/dbus/Makefile.am 2014-08-09 12:50:47 +0000
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' dbus-1.8.0.old/dbus/Makefile.am dbus-1.8.0/dbus/Makefile.am
--- dbus-1.8.0.old/dbus/Makefile.am 2014-09-05 16:09:18 +0000
+++ dbus-1.8.0/dbus/Makefile.am 2014-09-05 16:09:40 +0000
@@ -304,8 +304,8 @@ if DBUS_WIN
# this code is used, we don't actually need libstdc++.
noinst_LTLIBRARIES += libdbus-init-win.la
......@@ -12,9 +12,30 @@ diff -upr -x .deps -x .libs -x '*.la' dbus-1.8.0.old/dbus/Makefile.am dbus-1.8.0
endif
noinst_PROGRAMS =
diff -upr -x .deps -x .libs -x '*.la' dbus-1.8.0.old/dbus/dbus-sysdeps-win.c dbus-1.8.0/dbus/dbus-sysdeps-win.c
--- dbus-1.8.0.old/dbus/dbus-sysdeps-win.c 2014-01-07 11:32:53 +0000
+++ dbus-1.8.0/dbus/dbus-sysdeps-win.c 2014-08-09 13:35:34 +0000
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' dbus-1.8.0.old/dbus/dbus-sysdeps-util-win.c dbus-1.8.0/dbus/dbus-sysdeps-util-win.c
--- dbus-1.8.0.old/dbus/dbus-sysdeps-util-win.c 2014-09-05 16:09:18 +0000
+++ dbus-1.8.0/dbus/dbus-sysdeps-util-win.c 2014-09-05 16:09:28 +0000
@@ -1555,13 +1555,12 @@ _dbus_replace_install_prefix (const char
if ((!_dbus_get_install_root(runtime_prefix, len) ||
strncmp (configure_time_path, DBUS_PREFIX "/",
strlen (DBUS_PREFIX) + 1))) {
- strcat (retval, configure_time_path);
- return retval;
+ strcpy (retval, configure_time_path);
+ } else {
+ strcpy (retval, runtime_prefix);
+ strcat (retval, configure_time_path + strlen (DBUS_PREFIX) + 1);
}
- strcpy (retval, runtime_prefix);
- strcat (retval, configure_time_path + strlen (DBUS_PREFIX) + 1);
-
/* Somehow, in some situations, backslashes get collapsed in the string.
* Since windows C library accepts both forward and backslashes as
* path separators, convert all backslashes to forward slashes.
diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' dbus-1.8.0.old/dbus/dbus-sysdeps-win.c dbus-1.8.0/dbus/dbus-sysdeps-win.c
--- dbus-1.8.0.old/dbus/dbus-sysdeps-win.c 2014-09-05 16:09:18 +0000
+++ dbus-1.8.0/dbus/dbus-sysdeps-win.c 2014-09-05 16:09:40 +0000
@@ -55,6 +55,7 @@
#include <ws2tcpip.h>
#include <wincrypt.h>
......@@ -172,7 +193,7 @@ diff -upr -x .deps -x .libs -x '*.la' dbus-1.8.0.old/dbus/dbus-sysdeps-win.c dbu
_dbus_assert (credentials != NULL);
_dbus_assert (!_dbus_credentials_are_anonymous (credentials));
@@ -3407,18 +3539,16 @@ _dbus_append_keyring_directory_for_crede
@@ -3407,18 +3539,12 @@ _dbus_append_keyring_directory_for_crede
if (!_dbus_string_init (&homedir))
return FALSE;
......@@ -181,14 +202,10 @@ diff -upr -x .deps -x .libs -x '*.la' dbus-1.8.0.old/dbus/dbus-sysdeps-win.c dbu
- {
- _dbus_string_append(&homedir,homedrive);
- }
+ _dbus_set_homedir_from_drive_and_path_env(&homedir);
+ /* It's a default folder, like X:\, try to use a better one, in user's home directory */
+ if (_dbus_string_get_length(&homedir) <= 3) {
+ _dbus_string_set_length(&homedir, 0);
+ if (!_dbus_set_user_home(&homedir)) {
+ _dbus_string_set_length(&homedir, 0);
+ if (!_dbus_set_user_home(&homedir)) {
+ _dbus_string_set_length(&homedir, 0);
+ _dbus_set_homedir_from_drive_and_path_env(&homedir);
+ }
+ _dbus_set_homedir_from_drive_and_path_env(&homedir);
+ }
- homepath = _dbus_getenv("HOMEPATH");
......
......@@ -58,6 +58,7 @@ export LDFLAGS="$LDFLAGS -L$BUILD_ROOT_DEPS/lib -L$BUILD_ROOT_EVO/lib -L/lib"
mkdir -p $BUILD_ROOT_DEPS/bin 2>/dev/null
mkdir -p $BUILD_ROOT_DEPS/include 2>/dev/null
mkdir -p $BUILD_ROOT_DEPS/lib 2>/dev/null
mkdir -p $BUILD_ROOT_DEPS/libexec 2>/dev/null
mkdir -p $BUILD_ROOT_DEPS/share/aclocal 2>/dev/null
mkdir -p $BUILD_ROOT_DEPS/etc/dbus-1/session.d 2>/dev/null
#mkdir -p $BUILD_ROOT_DEPS/share/dbus-1 2>/dev/null
......@@ -65,6 +66,7 @@ mkdir -p $BUILD_ROOT_DEPS/etc/dbus-1/session.d 2>/dev/null
mkdir -p $BUILD_ROOT_EVO/bin 2>/dev/null
mkdir -p $BUILD_ROOT_EVO/include 2>/dev/null
mkdir -p $BUILD_ROOT_EVO/lib 2>/dev/null
mkdir -p $BUILD_ROOT_EVO/libexec 2>/dev/null
mkdir -p $BUILD_ROOT_EVO/share/aclocal 2>/dev/null
#mkdir -p $BUILD_ROOT_EVO/share/dbus-1 2>/dev/null
......@@ -72,5 +74,8 @@ mkdir -p $BUILD_ROOT_EVO/share/aclocal 2>/dev/null
#ln -s $BUILD_ROOT_DEPS/share/dbus-1 /usr/local/share/dbus-1
if [ -f "session-local.conf.in" ] ; then
cat session-local.conf.in | sed 's|@BUILD_ROOT_EVO@|'$BUILD_ROOT_EVO'/share/dbus-1/services|g' >$BUILD_ROOT_DEPS/etc/dbus-1/session.d/session-local.conf
cd $BUILD_ROOT_EVO
WLIKE_PWD=`pwd -W | sed 's|/|\\\\\\\\|g'`
cd - >/dev/null
cat session-local.conf.in | sed 's|@BUILD_ROOT_EVO@|'$WLIKE_PWD'\\share\\dbus-1\\services|g' >$BUILD_ROOT_DEPS/etc/dbus-1/session-local.conf
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment