diff options
author | Milan Crha <mcrha@redhat.com> | 2014-08-25 17:36:19 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2014-08-25 17:36:19 +0800 |
commit | 396e5e82c16d3d81e1e575e02fe05a77149ed0ea (patch) | |
tree | 655b4918d46b56a1a638f6c4d4476c727530ea17 /win32/patches/gcr.patch | |
parent | 9a8604400946bf0fe5d1fa227fa2524e9baf4fb0 (diff) | |
download | gsoc2013-evolution-396e5e82c16d3d81e1e575e02fe05a77149ed0ea.tar gsoc2013-evolution-396e5e82c16d3d81e1e575e02fe05a77149ed0ea.tar.gz gsoc2013-evolution-396e5e82c16d3d81e1e575e02fe05a77149ed0ea.tar.bz2 gsoc2013-evolution-396e5e82c16d3d81e1e575e02fe05a77149ed0ea.tar.lz gsoc2013-evolution-396e5e82c16d3d81e1e575e02fe05a77149ed0ea.tar.xz gsoc2013-evolution-396e5e82c16d3d81e1e575e02fe05a77149ed0ea.tar.zst gsoc2013-evolution-396e5e82c16d3d81e1e575e02fe05a77149ed0ea.zip |
Add Win32 build scripts into sources
See win32/readme.txt for more information.
Diffstat (limited to 'win32/patches/gcr.patch')
-rw-r--r-- | win32/patches/gcr.patch | 933 |
1 files changed, 933 insertions, 0 deletions
diff --git a/win32/patches/gcr.patch b/win32/patches/gcr.patch new file mode 100644 index 0000000000..1ba13b8788 --- /dev/null +++ b/win32/patches/gcr.patch @@ -0,0 +1,933 @@ +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/configure.ac gcr-3.10.1/configure.ac +--- gcr-3.10.1.old/configure.ac 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/configure.ac 2014-06-20 21:46:28 +0000 +@@ -62,20 +62,44 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GET + AC_SUBST(GETTEXT_PACKAGE) + AM_GLIB_GNU_GETTEXT + ++dnl ****************************** ++dnl Check for Win32 ++dnl ****************************** ++AC_MSG_CHECKING([for Win32]) ++case "$host" in ++*-mingw*) ++ os_win32='yes' ++ AC_CACHE_VAL(ac_cv_have_addrinfo, [ac_cv_have_addrinfo=yes]) ++ AC_DEFINE(_WIN32_WINNT, 0x501, [To get getaddrinfo etc declarations]) ++ ;; ++*) ++ os_win32='no' ++ ;; ++esac ++AC_MSG_RESULT([$os_win32]) ++AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes]) ++ + # ----------------------------------------------------------------------------- + # GLib and GTK+ stuff + ++GIO_PLAT= ++if test "$os_win32" = "yes" ; then ++ GIO_PLAT=gio-windows-2.0 ++else ++ GIO_PLAT=gio-unix-2.0 ++fi ++ + PKG_CHECK_MODULES(GLIB, + glib-2.0 >= 2.32.0 + gmodule-no-export-2.0 + gthread-2.0 + gobject-2.0 +- gio-2.0 gio-unix-2.0) ++ gio-2.0 $GIO_PLAT) + AC_SUBST(GLIB_CFLAGS) + AC_SUBST(GLIB_LIBS) + + GLIB_GSETTINGS +-GOBJECT_INTROSPECTION_CHECK([1.34]) ++dnl GOBJECT_INTROSPECTION_CHECK([1.34]) + AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) + AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums) + +@@ -107,7 +131,7 @@ fi + + VALA_REQUIRED=0.18.0.22 + +-VAPIGEN_CHECK($VALA_REQUIRED) ++dnl VAPIGEN_CHECK($VALA_REQUIRED) + + if test "$enable_vala" != "no"; then + AC_PATH_PROG([VALAC], [valac], []) +@@ -120,6 +144,8 @@ AM_CONDITIONAL(HAVE_VALAC, test "x$VALAC + + AC_CHECK_FUNCS(timegm, AC_DEFINE(HAVE_TIMEGM,1,[Have timegm])) + AC_CHECK_FUNCS(mlock) ++AC_CHECK_FUNCS(gmtime_r strptime memrchr) ++AC_CHECK_HEADERS([err.h pwd.h syslog.h sys/mman.h sys/wait.h]) + + # -------------------------------------------------------------------- + # p11-kit +@@ -370,6 +396,9 @@ else + valgrind_status="no" + fi + ++AM_CONDITIONAL(HAVE_INTROSPECTION, test "yes" = "no") ++AM_CONDITIONAL(ENABLE_VAPIGEN, test "yes" = "no") ++ + # ---------------------------------------------------------------------- + + GCK_LT_RELEASE=$GCK_CURRENT:$GCK_REVISION:$GCK_AGE +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/egg/egg-armor.c gcr-3.10.1/egg/egg-armor.c +--- gcr-3.10.1.old/egg/egg-armor.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/egg/egg-armor.c 2014-06-20 21:46:28 +0000 +@@ -60,6 +60,29 @@ EGG_SECURE_DECLARE (armor); + #define ARMOR_PREF_END "-----END " + #define ARMOR_PREF_END_L 9 + ++#ifndef HAVE_MEMRCHR ++extern void* memrchr (const void *s, int c, size_t n); ++ ++void* ++memrchr (const void *s, int c, size_t n) ++{ ++ if (n > 0) { ++ const char* p = (const char*) s; ++ const char* q = p + n; ++ ++ while (1) { ++ q--; if (q < p || q[0] == (char) c) break; ++ q--; if (q < p || q[0] == (char) c) break; ++ q--; if (q < p || q[0] == (char) c) break; ++ q--; if (q < p || q[0] == (char) c) break; ++ } ++ if (q >= p) ++ return (void*)q; ++ } ++ return NULL; ++} ++#endif ++ + static void + parse_header_lines (const gchar *hbeg, + const gchar *hend, +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/egg/egg-asn1x.c gcr-3.10.1/egg/egg-asn1x.c +--- gcr-3.10.1.old/egg/egg-asn1x.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/egg/egg-asn1x.c 2014-06-20 21:46:28 +0000 +@@ -1929,7 +1929,7 @@ static int + two_to_four_digit_year (int year) + { + time_t now; +- struct tm tm; ++ GDate *date; + int century, current; + + g_return_val_if_fail (year >= 0 && year <= 99, -1); +@@ -1937,11 +1937,15 @@ two_to_four_digit_year (int year) + /* Get the current year */ + now = time (NULL); + g_return_val_if_fail (now >= 0, -1); +- if (!gmtime_r (&now, &tm)) ++ date = g_date_new (); ++ g_date_set_time_t (date, now); ++ if (!g_date_valid (date)) + g_return_val_if_reached (-1); + +- current = (tm.tm_year % 100); +- century = (tm.tm_year + 1900) - current; ++ century = (g_date_get_year (date) / 100) * 100; ++ current = g_date_get_year (date) - century; ++ ++ g_date_free (date); + + /* + * Check if it's within 40 years before the +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/egg/egg-secure-memory.c gcr-3.10.1/egg/egg-secure-memory.c +--- gcr-3.10.1.old/egg/egg-secure-memory.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/egg/egg-secure-memory.c 2014-06-20 21:46:28 +0000 +@@ -32,7 +32,9 @@ + #include "egg-secure-memory.h" + + #include <sys/types.h> ++#ifdef HAVE_SYS_MMAN_H + #include <sys/mman.h> ++#endif + #include <stddef.h> + #include <string.h> + #include <stdio.h> +@@ -188,9 +190,11 @@ pool_alloc (void) + + /* Create a new pool */ + if (pool == NULL) { ++#if !defined(_WIN32) + len = getpagesize () * 2; + pages = mmap (0, len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); + if (pages == MAP_FAILED) ++#endif + return NULL; + + /* Fill in the block header, and inlude in block list */ +@@ -254,7 +258,9 @@ pool_free (void* item) + VALGRIND_DESTROY_MEMPOOL (pool); + #endif + ++#if !defined(_WIN32) + munmap (pool, pool->length); ++#endif + return; + } + +@@ -860,11 +866,11 @@ sec_acquire_pages (size_t *sz, + ASSERT (*sz); + ASSERT (during_tag); + ++#if defined(HAVE_MLOCK) + /* Make sure sz is a multiple of the page size */ + pgsize = getpagesize (); + *sz = (*sz + pgsize -1) & ~(pgsize - 1); + +-#if defined(HAVE_MLOCK) + pages = mmap (0, *sz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); + if (pages == MAP_FAILED) { + if (show_warning && egg_secure_warnings) +@@ -902,9 +908,9 @@ static void + sec_release_pages (void *pages, size_t sz) + { + ASSERT (pages); +- ASSERT (sz % getpagesize () == 0); + + #if defined(HAVE_MLOCK) ++ ASSERT (sz % getpagesize () == 0); + if (munlock (pages, sz) < 0 && egg_secure_warnings) + fprintf (stderr, "couldn't unlock private memory: %s\n", strerror (errno)); + +@@ -914,7 +920,7 @@ sec_release_pages (void *pages, size_t s + DEBUG_ALLOC ("gkr-secure-memory: freed block ", sz); + + #else +- ASSERT (FALSE); ++ ASSERT (0); + #endif + } + +@@ -937,6 +943,11 @@ sec_block_create (size_t size, + if (getenv ("SECMEM_FORCE_FALLBACK")) + return NULL; + ++#ifdef _WIN32 ++ /* win32 does not have mlock(), so just fail in that case */ ++ return NULL; ++#endif ++ + block = pool_alloc (); + if (!block) + return NULL; +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/egg/tests/test-asn1x.c gcr-3.10.1/egg/tests/test-asn1x.c +--- gcr-3.10.1.old/egg/tests/test-asn1x.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/egg/tests/test-asn1x.c 2014-06-20 21:46:28 +0000 +@@ -27,7 +27,9 @@ + #include "egg/egg-asn1-defs.h" + #include "egg/egg-testing.h" + ++#ifdef HAVE_PWD_H + #include <pwd.h> ++#endif + #include <stdlib.h> + #include <unistd.h> + +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/gck/Makefile.am gcr-3.10.1/gck/Makefile.am +--- gcr-3.10.1.old/gck/Makefile.am 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/gck/Makefile.am 2014-06-20 21:46:28 +0000 +@@ -1,6 +1,6 @@ + include $(top_srcdir)/Makefile.decl + +-SUBDIRS = . tests ++SUBDIRS = . + + incdir = $(includedir)/gck-@GCK_MAJOR@/gck + +@@ -77,16 +77,6 @@ libgck_@GCK_MAJOR@_la_LIBADD = \ + $(GIO_LIBS) \ + $(GLIB_LIBS) + +-noinst_LTLIBRARIES = libgck-testable.la +-libgck_testable_la_SOURCES = \ +- gck-mock.c \ +- gck-mock.h \ +- gck-test.c \ +- gck-test.h +-libgck_testable_la_LIBADD = $(libgck_@GCK_MAJOR@_la_OBJECTS) \ +- $(libgck_@GCK_MAJOR@_la_LIBADD) +-libgck_testable_la_DEPENDENCIES = $(libgck_@GCK_MAJOR@_la_OBJECTS) +- + gck-marshal.h: gck-marshal.list $(GLIB_GENMARSHAL) + $(GLIB_GENMARSHAL) $< --header --prefix=_gck_marshal > $@ + +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/gck/gck-debug.c gcr-3.10.1/gck/gck-debug.c +--- gcr-3.10.1.old/gck/gck-debug.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/gck/gck-debug.c 2014-06-20 21:46:28 +0000 +@@ -33,6 +33,11 @@ + + #include <unistd.h> + ++#ifdef G_OS_WIN32 ++ ++#include <windows.h> ++#endif ++ + #ifdef WITH_DEBUG + + static gsize initialized_flags = 0; +@@ -69,21 +74,30 @@ on_gck_log_debug (const gchar *log_domai + { + GString *gstring; + const gchar *progname; ++#ifdef G_OS_WIN32 ++ DWORD pid = GetCurrentProcessId (); ++#else ++ pid_t pid = getpid (); ++#endif + + gstring = g_string_new (NULL); + + progname = g_get_prgname (); + g_string_append_printf (gstring, "(%s:%lu): %s-DEBUG: %s\n", + progname ? progname : "process", +- (gulong)getpid (), log_domain, ++ (gulong) pid, log_domain, + message ? message : "(NULL) message"); + ++ ++#ifdef G_OS_WIN32 ++ g_print ("%s", gstring->str); ++#else + /* + * Give up on debug messages if stdout got lost. + */ + if (write (1, gstring->str, gstring->len) != gstring->len) + current_flags = 0; +- ++#endif + g_string_free (gstring, TRUE); + } + +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/gck/gck-slot.c gcr-3.10.1/gck/gck-slot.c +--- gcr-3.10.1.old/gck/gck-slot.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/gck/gck-slot.c 2014-06-20 21:46:28 +0000 +@@ -606,7 +606,7 @@ _gck_token_info_from_pkcs11 (CK_TOKEN_IN + { + GckTokenInfo *token_info; + gchar *string; +- struct tm tm; ++ GTimeVal tv; + + token_info = g_new0 (GckTokenInfo, 1); + token_info->label = gck_string_from_chars (info->label, sizeof (info->label)); +@@ -634,10 +634,12 @@ _gck_token_info_from_pkcs11 (CK_TOKEN_IN + /* Parse the time into seconds since epoch */ + if (info->flags & CKF_CLOCK_ON_TOKEN) { + string = g_strndup ((gchar*)info->utcTime, MIN (14, sizeof (info->utcTime))); +- if (!strptime (string, "%Y%m%d%H%M%S", &tm)) ++ /* Transform into an ISO-8601 string */ ++ string = g_strconcat (g_strndup (string,8), "T", g_strndup (string+8,6), "Z", NULL); ++ if (!g_time_val_from_iso8601 (string, &tv)) + token_info->utc_time = -1; + else +- token_info->utc_time = timegm (&tm); ++ token_info->utc_time = tv.tv_sec; + g_free (string); + } else { + token_info->utc_time = -1; +@@ -649,8 +651,8 @@ _gck_token_info_from_pkcs11 (CK_TOKEN_IN + void + _gck_token_info_to_pkcs11 (GckTokenInfo *token_info, CK_TOKEN_INFO_PTR info) + { +- gchar buffer[64]; +- struct tm tm; ++ gchar *buffer; ++ GDateTime *datetime = NULL; + time_t tim; + gsize len; + +@@ -690,9 +692,12 @@ _gck_token_info_to_pkcs11 (GckTokenInfo + /* Parse the time into seconds since epoch */ + if (token_info->flags & CKF_CLOCK_ON_TOKEN) { + tim = token_info->utc_time; +- if (!gmtime_r (&tim, &tm)) ++ datetime = g_date_time_new_from_unix_utc (tim); ++ if (datetime == NULL) + g_return_if_reached (); +- len = strftime (buffer, sizeof (buffer), "%Y%m%d%H%M%S", &tm); ++ buffer = g_date_time_format (datetime, "%Y%m%d%H%M%S"); ++ len = strlen (buffer); ++ g_date_time_unref (datetime); + g_return_if_fail (len == sizeof (info->utcTime)); + memcpy (info->utcTime, buffer, sizeof (info->utcTime)); + } else { +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/gck/tests/test-gck-crypto.c gcr-3.10.1/gck/tests/test-gck-crypto.c +--- gcr-3.10.1.old/gck/tests/test-gck-crypto.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/gck/tests/test-gck-crypto.c 2014-06-20 21:46:28 +0000 +@@ -57,7 +57,11 @@ setup (Test *test, gconstpointer unused) + GckSlot *slot; + + /* Successful load */ ++#ifdef G_OS_WIN32 ++ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err); ++#else + test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err); ++#endif + g_assert_no_error (err); + g_assert (GCK_IS_MODULE (test->module)); + g_object_add_weak_pointer (G_OBJECT (test->module), (gpointer *)&test->module); +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/gck/tests/test-gck-enumerator.c gcr-3.10.1/gck/tests/test-gck-enumerator.c +--- gcr-3.10.1.old/gck/tests/test-gck-enumerator.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/gck/tests/test-gck-enumerator.c 2014-06-20 21:46:28 +0000 +@@ -50,7 +50,11 @@ setup (Test *test, gconstpointer unused) + GError *err = NULL; + + /* Successful load */ ++#ifdef G_OS_WIN32 ++ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err); ++#else + test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err); ++#endif + g_assert_no_error (err); + g_assert (GCK_IS_MODULE (test->module)); + g_object_add_weak_pointer (G_OBJECT (test->module), (gpointer *)&test->module); +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/gck/tests/test-gck-module.c gcr-3.10.1/gck/tests/test-gck-module.c +--- gcr-3.10.1.old/gck/tests/test-gck-module.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/gck/tests/test-gck-module.c 2014-06-20 21:46:28 +0000 +@@ -42,7 +42,11 @@ setup (Test *test, gconstpointer unused) + GError *err = NULL; + + /* Successful load */ ++#ifdef G_OS_WIN32 ++ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err); ++#else + test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err); ++#endif + g_assert_no_error (err); + g_assert (test->module); + g_object_add_weak_pointer (G_OBJECT (test->module), (gpointer *)&test->module); +@@ -71,7 +75,11 @@ test_initialize_async (void) + GError *error = NULL; + + /* Shouldn't be able to load modules */ ++#ifdef G_OS_WIN32 ++ gck_module_initialize_async (BUILDDIR "/.libs/libmock-test-module.dll", ++#else + gck_module_initialize_async (BUILDDIR "/.libs/libmock-test-module.so", ++#endif + NULL, fetch_async_result, &result); + + egg_test_wait_until (500); +@@ -101,7 +109,11 @@ test_invalid_modules (Test *test, gconst + g_clear_error (&error); + + /* Shouldn't be able to load any file successfully */ ++#ifdef G_OS_WIN32 ++ invalid = gck_module_initialize ("c:\\windows\\system32\\shell32.dll", NULL, &error); ++#else + invalid = gck_module_initialize ("/usr/lib/libm.so", NULL, &error); ++#endif + g_assert_error (error, GCK_ERROR, (int)CKR_GCK_MODULE_PROBLEM); + g_assert (invalid == NULL); + +@@ -139,7 +151,11 @@ test_module_props (Test *test, gconstpoi + + g_object_get (test->module, "path", &path, NULL); + g_assert (path != NULL && "no module-path"); ++#ifdef G_OS_WIN32 ++ g_assert (strcmp (BUILDDIR "/.libs/libmock-test-module.dll", path) == 0 && "module path wrong"); ++#else + g_assert (strcmp (BUILDDIR "/.libs/libmock-test-module.so", path) == 0 && "module path wrong"); ++#endif + g_free (path); + } + +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/gck/tests/test-gck-modules.c gcr-3.10.1/gck/tests/test-gck-modules.c +--- gcr-3.10.1.old/gck/tests/test-gck-modules.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/gck/tests/test-gck-modules.c 2014-06-20 21:46:28 +0000 +@@ -48,7 +48,11 @@ setup (Test *test, gconstpointer unused) + GError *err = NULL; + + /* Successful load */ ++#ifdef G_OS_WIN32 ++ module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err); ++#else + module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err); ++#endif + g_assert_no_error (err); + g_assert (GCK_IS_MODULE (module)); + +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/gck/tests/test-gck-object.c gcr-3.10.1/gck/tests/test-gck-object.c +--- gcr-3.10.1.old/gck/tests/test-gck-object.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/gck/tests/test-gck-object.c 2014-06-20 21:46:28 +0000 +@@ -50,7 +50,11 @@ setup (Test *test, gconstpointer unused) + GList *slots; + + /* Successful load */ ++#ifdef G_OS_WIN32 ++ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err); ++#else + test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err); ++#endif + g_assert_no_error (err); + g_assert (GCK_IS_MODULE (test->module)); + +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/gck/tests/test-gck-session.c gcr-3.10.1/gck/tests/test-gck-session.c +--- gcr-3.10.1.old/gck/tests/test-gck-session.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/gck/tests/test-gck-session.c 2014-06-20 21:46:28 +0000 +@@ -50,7 +50,11 @@ setup (Test *test, gconstpointer unused) + GList *slots; + + /* Successful load */ ++#ifdef G_OS_WIN32 ++ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err); ++#else + test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err); ++#endif + g_assert_no_error (err); + g_assert (GCK_IS_MODULE (test->module)); + g_object_add_weak_pointer (G_OBJECT (test->module), (gpointer *)&test->module); +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/gck/tests/test-gck-slot.c gcr-3.10.1/gck/tests/test-gck-slot.c +--- gcr-3.10.1.old/gck/tests/test-gck-slot.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/gck/tests/test-gck-slot.c 2014-06-20 21:46:28 +0000 +@@ -43,7 +43,11 @@ setup (Test *test, gconstpointer unused) + GList *slots; + + /* Successful load */ ++#ifdef G_OS_WIN32 ++ test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.dll", NULL, &err); ++#else + test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, &err); ++#endif + g_assert_no_error (err); + g_assert (GCK_IS_MODULE (test->module)); + +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/gcr/Makefile.am gcr-3.10.1/gcr/Makefile.am +--- gcr-3.10.1.old/gcr/Makefile.am 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/gcr/Makefile.am 2014-06-20 21:46:28 +0000 +@@ -1,6 +1,6 @@ + include $(top_srcdir)/Makefile.decl + +-SUBDIRS = . tests ++SUBDIRS = . + + incdir = $(includedir)/gcr-@GCR_MAJOR@/gcr + +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/gcr/gcr-gnupg-collection.c gcr-3.10.1/gcr/gcr-gnupg-collection.c +--- gcr-3.10.1.old/gcr/gcr-gnupg-collection.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/gcr/gcr-gnupg-collection.c 2014-06-20 21:46:28 +0000 +@@ -36,7 +36,9 @@ + #include "gcr-record.h" + #include "gcr-util.h" + ++#ifdef HAVE_SYS_WAIT_H + #include <sys/wait.h> ++#endif + #include <string.h> + + enum { +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/gcr/gcr-gnupg-process.c gcr-3.10.1/gcr/gcr-gnupg-process.c +--- gcr-3.10.1.old/gcr/gcr-gnupg-process.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/gcr/gcr-gnupg-process.c 2014-06-20 21:46:28 +0000 +@@ -31,7 +31,12 @@ + + #include <glib/gi18n-lib.h> + ++#ifdef HAVE_SYS_WAIT_H + #include <sys/wait.h> ++#endif ++#ifdef G_OS_WIN32 ++#include <windows.h> ++#endif + #include <fcntl.h> + #include <errno.h> + #include <string.h> +@@ -854,12 +859,18 @@ on_gnupg_process_child_exited (GPid pid, + gint code; + guint i; + ++#if defined (G_OS_UNIX) + _gcr_debug ("process exited: %d", (int)pid); ++#elif defined (G_OS_WIN32) ++ DWORD real_pid = GetProcessId (pid); ++ _gcr_debug ("process exited: %d", (int)real_pid); ++#endif + + g_spawn_close_pid (gnupg_source->child_pid); + gnupg_source->child_pid = 0; + gnupg_source->child_sig = 0; + ++#ifndef G_OS_WIN32 + if (WIFEXITED (status)) { + code = WEXITSTATUS (status); + if (code != 0) { +@@ -873,6 +884,7 @@ on_gnupg_process_child_exited (GPid pid, + error = g_error_new (G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, + _("Gnupg process was terminated with signal: %d"), code); + } ++#endif + + /* Take this as the async result error */ + if (error && !self->pv->error) { +@@ -891,11 +903,16 @@ on_gnupg_process_child_exited (GPid pid, + } + + complete_source_is_done (gnupg_source); ++ ++#ifdef G_OS_WIN32 ++ g_spawn_close_pid (pid); ++#endif + } + + static void + on_gnupg_process_child_setup (gpointer user_data) + { ++#ifdef G_OS_UNIX + int *child_fds = user_data; + long val; + guint i; +@@ -911,6 +928,7 @@ on_gnupg_process_child_setup (gpointer u + fcntl (child_fds[i], F_SETFD, val & ~FD_CLOEXEC); + } + } ++#endif + } + + static void +@@ -929,9 +947,16 @@ on_cancellable_cancelled (GCancellable * + + /* Try and kill the child process */ + if (gnupg_source->child_pid) { ++#if defined(G_OS_UNIX) + _gcr_debug ("sending term signal to process: %d", + (int)gnupg_source->child_pid); + kill (gnupg_source->child_pid, SIGTERM); ++#elif defined(G_OS_WIN32) ++ DWORD real_pid = GetProcessId (gnupg_source->child_pid); ++ _gcr_debug ("sending term signal to process: %d", ++ (int)real_pid); ++ TerminateProcess (gnupg_source->child_pid, 0); ++#endif + } + } + +@@ -1000,14 +1025,22 @@ _gcr_gnupg_process_run_async (GcrGnupgPr + child_fds[FD_ERROR] = 2; + + if (flags & GCR_GNUPG_PROCESS_WITH_STATUS) { ++#if defined(G_OS_UNIX) + if (pipe (status_fds) < 0) ++#elif defined(G_OS_WIN32) ++ if (_pipe (status_fds, 4096, _O_BINARY) < 0) ++#endif + g_return_if_reached (); + child_fds[FD_STATUS] = status_fds[1]; + g_ptr_array_add (args, g_strdup ("--status-fd")); + g_ptr_array_add (args, g_strdup_printf ("%d", child_fds[FD_STATUS])); + } + if (flags & GCR_GNUPG_PROCESS_WITH_ATTRIBUTES) { ++#if defined(G_OS_UNIX) + if (pipe (attribute_fds) < 0) ++#elif defined(G_OS_WIN32) ++ if (_pipe (attribute_fds, 4096, _O_BINARY) < 0) ++#endif + g_return_if_reached (); + child_fds[FD_ATTRIBUTE] = attribute_fds[1]; + g_ptr_array_add (args, g_strdup ("--attribute-fd")); +@@ -1036,11 +1069,11 @@ _gcr_gnupg_process_run_async (GcrGnupgPr + + if (_gcr_debugging) { + gchar *command = g_strjoinv (" ", (gchar**)args->pdata); +- gchar *environ = g_strjoinv (", ", (gchar**)envs->pdata); ++ gchar *environment = g_strjoinv (", ", (gchar**)envs->pdata); + _gcr_debug ("running command: %s", command); +- _gcr_debug ("process environment: %s", environ); ++ _gcr_debug ("process environment: %s", environment); + g_free (command); +- g_free (environ); ++ g_free (environment); + } + + g_spawn_async_with_pipes (self->pv->directory, (gchar**)args->pdata, +@@ -1068,7 +1101,12 @@ _gcr_gnupg_process_run_async (GcrGnupgPr + return; + } + ++#if defined (G_OS_UNIX) + _gcr_debug ("process started: %d", (int)pid); ++#elif defined (G_OS_WIN32) ++ DWORD real_pid = GetProcessId (pid); ++ _gcr_debug ("process started: %d", (int)real_pid); ++#endif + + source = g_source_new (&gnupg_source_funcs, sizeof (GnupgSource)); + +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/gcr/gcr-record.c gcr-3.10.1/gcr/gcr-record.c +--- gcr-3.10.1.old/gcr/gcr-record.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/gcr/gcr-record.c 2014-06-20 21:46:28 +0000 +@@ -597,7 +597,9 @@ _gcr_record_get_date (GcrRecord *record, + const gchar *raw; + gulong result; + gchar *end = NULL; +- struct tm tm; ++ gchar **string; ++ int year, month, day; ++ GDateTime *dt = NULL; + + g_return_val_if_fail (record, NULL); + +@@ -615,14 +617,20 @@ _gcr_record_get_date (GcrRecord *record, + } + + /* Try to parse as a date */ +- memset (&tm, 0, sizeof (tm)); +- end = strptime (raw, "%Y-%m-%d", &tm); +- if (!end || end[0]) { ++ string = g_strsplit (raw, "-", 3); ++ if ((string[0] != NULL) && (string[1] != NULL) && (string[2] != NULL)) { ++ year = strtol (string[0], NULL, 10); ++ month = strtol (string[1], NULL, 10); ++ day = strtol (string[2], NULL, 10); ++ dt = g_date_time_new_utc (year, month, day, 0, 0, 0); ++ } ++ g_strfreev (string); ++ if (dt == NULL) { + _gcr_debug ("invalid date value: %s", raw); + return NULL; + } + +- return g_date_time_new_utc (tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 0, 0, 0); ++ return dt; + } + + /** +@@ -860,4 +868,4 @@ _gcr_records_parse_colons (gconstpointer + g_free (lines); + + return result; +-} ++} +\ No newline at end of file +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/ui/Makefile.am gcr-3.10.1/ui/Makefile.am +--- gcr-3.10.1.old/ui/Makefile.am 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/ui/Makefile.am 2014-06-20 21:46:28 +0000 +@@ -1,6 +1,6 @@ + include $(top_srcdir)/Makefile.decl + +-SUBDIRS = . icons tests ++SUBDIRS = . icons + + incdir = $(includedir)/gcr-@GCR_MAJOR@/ui + +@@ -51,11 +51,13 @@ libgcr_ui_@GCR_MAJOR@_la_LIBADD = \ + $(GTK_LIBS) \ + $(NULL) + ++if !OS_WIN32 + # libgcr-3.so (and friends) symlink to libgcr-ui-3.so for compatibility raisons + install-exec-hook: + $(LN_S) -f `readlink $(DESTDIR)$(libdir)/libgcr-ui-@GCR_MAJOR@.so` $(DESTDIR)$(libdir)/libgcr-@GCR_MAJOR@.so + $(LN_S) -f `readlink $(DESTDIR)$(libdir)/libgcr-ui-@GCR_MAJOR@.so` $(DESTDIR)$(libdir)/libgcr-@GCR_MAJOR@.so.@GCR_CURRENT@ + $(LN_S) -f `readlink $(DESTDIR)$(libdir)/libgcr-ui-@GCR_MAJOR@.so` $(DESTDIR)$(libdir)/libgcr-@GCR_MAJOR@.so.@GCR_CURRENT@.0.0 ++endif + + uidir = $(datadir)/gcr-@GCR_MAJOR@/ui/ + +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/ui/gcr-prompt-dialog.c gcr-3.10.1/ui/gcr-prompt-dialog.c +--- gcr-3.10.1.old/ui/gcr-prompt-dialog.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/ui/gcr-prompt-dialog.c 2014-06-20 21:46:28 +0000 +@@ -31,7 +31,13 @@ + #include "gcr-secure-entry-buffer.h" + + #include <gtk/gtk.h> ++#if defined(GDK_WINDOWING_X11) + #include <gdk/gdkx.h> ++#endif ++#if defined(GDK_WINDOWING_WIN32) ++#include <gdk/gdkwin32.h> ++#include <windows.h> ++#endif + #include <glib/gi18n.h> + + /** +@@ -152,12 +158,21 @@ update_transient_for (GcrPromptDialog *s + } + + display = gtk_widget_get_display (GTK_WIDGET (self)); ++#if defined(GDK_WINDOWING_X11) + transient_for = gdk_x11_window_foreign_new_for_display (display, (Window)handle); ++#elif defined(GDK_WINDOWING_WIN32) ++ transient_for = gdk_win32_window_foreign_new_for_display (display, (HWND)handle); ++#endif + if (transient_for == NULL) { + g_warning ("caller-window property doesn't represent a window on current display: %s", + self->pv->caller_window); + } else { ++#if defined(GDK_WINDOWING_X11) + gdk_window_set_transient_for (window, transient_for); ++#elif defined(GDK_WINDOWING_WIN32) ++ HWND chandle = gdk_win32_window_get_handle (window); ++ SetWindowLongPtr (chandle, GWLP_HWNDPARENT, (LONG_PTR)handle); ++#endif + g_object_unref (transient_for); + } + +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/ui/gcr-prompter-tool.c gcr-3.10.1/ui/gcr-prompter-tool.c +--- gcr-3.10.1.old/ui/gcr-prompter-tool.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/ui/gcr-prompter-tool.c 2014-06-20 21:46:28 +0000 +@@ -30,13 +30,17 @@ + + #include <glib/gi18n.h> + #include <gtk/gtk.h> ++#ifdef GDK_WINDOWING_X11 + #include <gdk/gdkx.h> ++#endif + #include <pango/pango.h> + + #include <locale.h> + #include <stdlib.h> + #include <string.h> ++#ifdef HAVE_SYSLOG_H + #include <syslog.h> ++#endif + + #define QUIT_TIMEOUT 10 + +@@ -138,6 +142,7 @@ log_handler (const gchar *log_domain, + const gchar *message, + gpointer user_data) + { ++#ifdef HAVE_SYSLOG_H + int level; + + /* Note that crit and err are the other way around in syslog */ +@@ -171,6 +176,7 @@ log_handler (const gchar *log_domain, + syslog (level, "%s: %s", log_domain, message); + else + syslog (level, "%s", message); ++#endif + + /* And then to default handler for aborting and stuff like that */ + g_log_default_handler (log_domain, log_level, message, user_data); +@@ -179,9 +185,11 @@ log_handler (const gchar *log_domain, + static void + printerr_handler (const gchar *string) + { ++#ifdef HAVE_SYSLOG_H + /* Print to syslog and stderr */ + syslog (LOG_WARNING, "%s", string); + fprintf (stderr, "%s", string); ++#endif + } + + static void +@@ -191,7 +199,9 @@ prepare_logging () + G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | + G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO; + ++#ifdef HAVE_SYSLOG_H + openlog ("gcr-prompter", LOG_PID, LOG_AUTH); ++#endif + + g_log_set_handler (NULL, flags, log_handler, NULL); + g_log_set_handler ("Glib", flags, log_handler, NULL); +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/ui/gcr-ui.pc.in gcr-3.10.1/ui/gcr-ui.pc.in +--- gcr-3.10.1.old/ui/gcr-ui.pc.in 2013-04-21 12:31:47 +0000 ++++ gcr-3.10.1/ui/gcr-ui.pc.in 2014-06-20 22:22:58 +0000 +@@ -11,5 +11,5 @@ Description: GObject and GUI library for + Version: @VERSION@ + Requires: glib-2.0 gobject-2.0 gio-2.0 gtk+-3.0 gcr-base-@GCR_MAJOR@ gck-@GCK_MAJOR@ + Requires.private: p11-kit-1 +-Libs: -L${libdir} -lgcr-@GCR_MAJOR@ ++Libs: -L${libdir} -lgcr-ui-@GCR_MAJOR@ + Cflags: -I${includedir}/gcr-@GCR_MAJOR@ +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/ui/tests/frob-prompt.c gcr-3.10.1/ui/tests/frob-prompt.c +--- gcr-3.10.1.old/ui/tests/frob-prompt.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/ui/tests/frob-prompt.c 2014-06-20 21:46:28 +0000 +@@ -27,15 +27,45 @@ + #include "gcr/gcr-base.h" + + #include <gtk/gtk.h> ++#ifdef GDK_WINDOWING_X11 + #include <gdk/gdkx.h> ++#endif ++#ifdef GDK_WINDOWING_WIN32 ++#include <gdk/gdkwin32.h> ++#endif + ++#ifdef HAVE_ERR_H + #include <err.h> ++#else ++#include <errno.h> ++#endif ++#include <stdlib.h> + + static const gchar *file_name = NULL; + static gchar *prompt_type = NULL; + static gint prompt_delay = 0; + static gboolean prompt_window = FALSE; + ++#ifndef HAVE_ERR_H ++extern void errx (int eval, char *format, ...); ++ ++void errx (int eval, char *format, ...) ++{ ++ gchar *err_s; ++ ++ va_list ap; ++ va_start (ap, format); ++ vsprintf (err_s, format, ap); ++ va_end (ap); ++ ++ err_s = g_strconcat (g_get_prgname (), ": ", g_strdup (err_s), "\n", NULL); ++ g_printerr (err_s); ++ g_free (err_s); ++ ++ exit (eval); ++} ++#endif ++ + static gboolean + on_delay_timeout (gpointer data) + { +@@ -80,7 +110,11 @@ prompt_perform (GtkWidget *parent) + errx (1, "couldn't create prompt: %s", error->message); + + if (parent) { ++#if defined(GDK_WINDOWING_X11) + caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_XID (gtk_widget_get_window (parent))); ++#elif defined(GDK_WINDOWING_WIN32) ++ caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_HWND (gtk_widget_get_window (parent))); ++#endif + gcr_prompt_set_caller_window (GCR_PROMPT (prompt), caller_id); + g_free (caller_id); + } +diff -upr -x .deps -x .libs -x '*.la' gcr-3.10.1.old/ui/tests/frob-system-prompt.c gcr-3.10.1/ui/tests/frob-system-prompt.c +--- gcr-3.10.1.old/ui/tests/frob-system-prompt.c 2014-06-20 22:20:25 +0000 ++++ gcr-3.10.1/ui/tests/frob-system-prompt.c 2014-06-20 21:46:28 +0000 +@@ -28,7 +28,12 @@ + #include "egg/egg-testing.h" + + #include <gtk/gtk.h> ++#ifdef GDK_WINDOWING_X11 + #include <gdk/gdkx.h> ++#endif ++#ifdef GDK_WINDOWING_WIN32 ++#include <gdk/gdkwin32.h> ++#endif + + #include <unistd.h> + #include <string.h> +@@ -56,7 +61,11 @@ on_prompt_clicked (GtkToolButton *button + gcr_prompt_set_message (GCR_PROMPT (prompt), "This is the message"); + gcr_prompt_set_description (GCR_PROMPT (prompt), "This is the description"); + ++#if defined(GDK_WINDOWING_X11) + caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_XID (gtk_widget_get_window (parent))); ++#elif defined(GDK_WINDOWING_WIN32) ++ caller_id = g_strdup_printf ("%lu", (gulong)GDK_WINDOW_HWND (gtk_widget_get_window (parent))); ++#endif + gcr_prompt_set_caller_window (GCR_PROMPT (prompt), caller_id); + g_free (caller_id); + |