From 9128afb9343976fcf25632475e06c12248e799b5 Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Tue, 5 Apr 2011 00:26:55 -0700 Subject: [PATCH] Trying gtk-2.24 --- plat/win32/gtk-win/jhbuildrc/gtk.moduleset | 27 +- plat/win32/gtk-win/jhbuildrc/jhbuildrc | 2 +- .../patches/glib-2.28-spawn-win32-moo.patch | 12 + .../patches/glib-2.28-spawn-win32.patch | 312 ++++++++++++++++++ .../gtk-win/jhbuildrc/patches/glib-2.28.patch | 60 ++++ 5 files changed, 394 insertions(+), 19 deletions(-) create mode 100644 plat/win32/gtk-win/jhbuildrc/patches/glib-2.28-spawn-win32-moo.patch create mode 100644 plat/win32/gtk-win/jhbuildrc/patches/glib-2.28-spawn-win32.patch create mode 100644 plat/win32/gtk-win/jhbuildrc/patches/glib-2.28.patch diff --git a/plat/win32/gtk-win/jhbuildrc/gtk.moduleset b/plat/win32/gtk-win/jhbuildrc/gtk.moduleset index b89b5b33..cb7fec71 100644 --- a/plat/win32/gtk-win/jhbuildrc/gtk.moduleset +++ b/plat/win32/gtk-win/jhbuildrc/gtk.moduleset @@ -74,17 +74,17 @@ --> - + - - - + + + @@ -229,17 +229,9 @@ --> - wargv) ++ g_array_append_vals (cmd_line, L" ", 1); ++ g_array_append_vals (cmd_line, *p, wcslen (*p)); ++ } ++ g_array_append_vals (cmd_line, L"", 1); ++ ++ memset (&sinfo, 0, sizeof sinfo); ++ sinfo.cb = sizeof (STARTUPINFO); ++ sinfo.dwFlags = STARTF_USESHOWWINDOW; ++ sinfo.wShowWindow = SW_HIDE; ++ flags = CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP; ++ ++ if (wenvp) ++ { ++ GArray *tmp; ++ ++ flags |= CREATE_UNICODE_ENVIRONMENT; ++ ++ /* format is "var=value\0var=value\0\0" */ ++ tmp = g_array_new (FALSE, FALSE, sizeof (wchar_t)); ++ for (p = wenvp; p && *p; p++) ++ g_array_append_vals (tmp, *p, wcslen (*p) + 1); ++ g_array_append_vals (tmp, L"", 1); ++ env_string = (wchar_t*) g_array_free (tmp, FALSE); ++ } ++ ++ if (CreateProcessW (NULL, (wchar_t*) cmd_line->data, NULL, NULL, TRUE, ++ flags, env_string, NULL, &sinfo, &pinfo)) ++ { ++ rc = (int) pinfo.hProcess; ++ CloseHandle (pinfo.hThread); ++ } ++ else ++ { ++ g_set_error (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, ++ _("Failed to execute helper program (%s)"), ++ g_win32_error_message (GetLastError ())); ++ } ++ ++ g_free (env_string); ++ g_array_free (cmd_line, TRUE); ++ return rc; ++} ++ ++static void ++sprintf_file_descriptor (gchar *dest, ++ gint fd, ++ gboolean print_handle) ++{ ++ if (print_handle) ++ _g_sprintf (dest, "%ld", _get_osfhandle (fd)); ++ else ++ _g_sprintf (dest, "%d", fd); ++} ++ + static gboolean + do_spawn_with_pipes (gint *exit_status, + gboolean do_return_handle, +@@ -549,6 +625,8 @@ + wchar_t *whelper, **wargv, **wenvp; + extern gchar *_glib_get_dll_directory (void); + gchar *glib_dll_directory; ++ gboolean error_set = FALSE; ++ gboolean handles_in_argv = FALSE; + + if (child_setup && !warned_about_child_setup) + { +@@ -559,6 +637,7 @@ + argc = protect_argv (argv, &protected_argv); + + if (!standard_input && !standard_output && !standard_error && ++ !(flags & G_SPAWN_WIN32_HIDDEN_CONSOLE) && + (flags & G_SPAWN_CHILD_INHERITS_STDIN) && + !(flags & G_SPAWN_STDOUT_TO_DEV_NULL) && + !(flags & G_SPAWN_STDERR_TO_DEV_NULL) && +@@ -590,7 +669,8 @@ + goto cleanup_and_fail; + + new_argv = g_new (char *, argc + 1 + ARG_COUNT); +- if (GetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cursor_info)) ++ if ((flags & G_SPAWN_WIN32_HIDDEN_CONSOLE) || ++ GetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cursor_info)) + helper_process = HELPER_PROCESS "-console.exe"; + else + helper_process = HELPER_PROCESS ".exe"; +@@ -606,9 +686,16 @@ + + new_argv[0] = protect_argv_string (helper_process); + +- _g_sprintf (args[ARG_CHILD_ERR_REPORT], "%d", child_err_report_pipe[1]); ++ if (flags & G_SPAWN_WIN32_HIDDEN_CONSOLE) ++ handles_in_argv = TRUE; ++ ++ strcpy (args[ARG_HANDLES_IN_ARGV], handles_in_argv ? "y" : "n"); ++ new_argv[ARG_HANDLES_IN_ARGV] = args[ARG_HANDLES_IN_ARGV]; ++ ++ sprintf_file_descriptor (args[ARG_CHILD_ERR_REPORT], ++ child_err_report_pipe[1], handles_in_argv); + new_argv[ARG_CHILD_ERR_REPORT] = args[ARG_CHILD_ERR_REPORT]; +- ++ + /* Make the read end of the child error report pipe + * noninherited. Otherwise it will needlessly be inherited by the + * helper process, and the started actual user process. As such that +@@ -637,7 +724,7 @@ + + if (standard_input) + { +- _g_sprintf (args[ARG_STDIN], "%d", stdin_pipe[0]); ++ sprintf_file_descriptor (args[ARG_STDIN], stdin_pipe[0], handles_in_argv); + new_argv[ARG_STDIN] = args[ARG_STDIN]; + } + else if (flags & G_SPAWN_CHILD_INHERITS_STDIN) +@@ -653,7 +740,7 @@ + + if (standard_output) + { +- _g_sprintf (args[ARG_STDOUT], "%d", stdout_pipe[1]); ++ sprintf_file_descriptor (args[ARG_STDOUT], stdout_pipe[1], handles_in_argv); + new_argv[ARG_STDOUT] = args[ARG_STDOUT]; + } + else if (flags & G_SPAWN_STDOUT_TO_DEV_NULL) +@@ -667,7 +754,7 @@ + + if (standard_error) + { +- _g_sprintf (args[ARG_STDERR], "%d", stderr_pipe[1]); ++ sprintf_file_descriptor (args[ARG_STDERR], stderr_pipe[1], handles_in_argv); + new_argv[ARG_STDERR] = args[ARG_STDERR]; + } + else if (flags & G_SPAWN_STDERR_TO_DEV_NULL) +@@ -750,7 +837,13 @@ + whelper = g_utf8_to_utf16 (helper_process, -1, NULL, NULL, NULL); + g_free (helper_process); + +- if (wenvp != NULL) ++ if (flags & G_SPAWN_WIN32_HIDDEN_CONSOLE) ++ { ++ rc = spawn_with_hidden_console (wargv, wenvp, error); ++ if (rc == -1) ++ error_set = TRUE; ++ } ++ else if (wenvp != NULL) + rc = _wspawnvpe (P_NOWAIT, whelper, (const wchar_t **) wargv, (const wchar_t **) wenvp); + else + rc = _wspawnvp (P_NOWAIT, whelper, (const wchar_t **) wargv); +@@ -777,11 +870,12 @@ + g_free (new_argv); + + /* Check if gspawn-win32-helper couldn't be run */ +- if (rc == -1 && saved_errno != 0) ++ if (rc == -1 && (saved_errno != 0 || error_set)) + { +- g_set_error (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, +- _("Failed to execute helper program (%s)"), +- g_strerror (saved_errno)); ++ if (!error_set) ++ g_set_error (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, ++ _("Failed to execute helper program (%s)"), ++ g_strerror (saved_errno)); + goto cleanup_and_fail; + } + +diff -r c42e8e0c6f6f glib/gspawn.h +--- a/glib/gspawn.h Mon Apr 04 19:06:05 2011 -0700 ++++ b/glib/gspawn.h Mon Apr 04 19:07:28 2011 -0700 +@@ -70,7 +70,8 @@ + G_SPAWN_STDOUT_TO_DEV_NULL = 1 << 3, + G_SPAWN_STDERR_TO_DEV_NULL = 1 << 4, + G_SPAWN_CHILD_INHERITS_STDIN = 1 << 5, +- G_SPAWN_FILE_AND_ARGV_ZERO = 1 << 6 ++ G_SPAWN_FILE_AND_ARGV_ZERO = 1 << 6, ++ G_SPAWN_WIN32_HIDDEN_CONSOLE = 1 << 7 + } GSpawnFlags; + + GQuark g_spawn_error_quark (void); diff --git a/plat/win32/gtk-win/jhbuildrc/patches/glib-2.28.patch b/plat/win32/gtk-win/jhbuildrc/patches/glib-2.28.patch new file mode 100644 index 00000000..b38e07c6 --- /dev/null +++ b/plat/win32/gtk-win/jhbuildrc/patches/glib-2.28.patch @@ -0,0 +1,60 @@ +diff -r 00b9c5da9d6e Makefile.in +--- a/Makefile.in Mon Apr 04 19:01:52 2011 -0700 ++++ b/Makefile.in Mon Apr 04 19:04:39 2011 -0700 +@@ -422,7 +422,7 @@ + gio-2.0-uninstalled.pc.in gio-unix-2.0-uninstalled.pc.in + TEST_PROGS = + ACLOCAL_AMFLAGS = -I m4macros ${ACLOCAL_FLAGS} +-SUBDIRS = . m4macros glib gmodule gthread gobject gio tests po docs ++SUBDIRS = . glib gmodule gthread gobject gio po + DIST_SUBDIRS = $(SUBDIRS) build + bin_SCRIPTS = glib-gettextize + AM_CPPFLAGS = \ +diff -r 00b9c5da9d6e gio/Makefile.in +--- a/gio/Makefile.in Mon Apr 04 19:01:52 2011 -0700 ++++ b/gio/Makefile.in Mon Apr 04 19:04:39 2011 -0700 +@@ -619,7 +619,7 @@ + TEST_PROGS = + NULL = + SUBDIRS = $(am__append_1) $(am__append_3) $(am__append_7) \ +- $(am__append_10) . $(am__append_13) tests ++ $(am__append_10) . $(am__append_13) + @MS_LIB_AVAILABLE_TRUE@@OS_WIN32_AND_DLL_COMPILATION_TRUE@noinst_DATA = gio-2.0.lib + @MS_LIB_AVAILABLE_TRUE@@OS_WIN32_AND_DLL_COMPILATION_TRUE@install_ms_lib_cmd = $(INSTALL) gio-2.0.lib $(DESTDIR)$(libdir) + @MS_LIB_AVAILABLE_TRUE@@OS_WIN32_AND_DLL_COMPILATION_TRUE@uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/gio-2.0.lib +diff -r 00b9c5da9d6e glib/Makefile.in +--- a/glib/Makefile.in Mon Apr 04 19:01:52 2011 -0700 ++++ b/glib/Makefile.in Mon Apr 04 19:04:39 2011 -0700 +@@ -546,7 +546,7 @@ + @ENABLE_REGEX_TRUE@gregex_h = gregex.h + @HAVE_GCC_BUILTINS_FOR_ATOMIC_OPERATIONS_FALSE@gatomic_c = gatomic.c + @HAVE_GCC_BUILTINS_FOR_ATOMIC_OPERATIONS_TRUE@gatomic_c = gatomic-gcc.c +-SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre . tests ++SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre . + DIST_SUBDIRS = libcharset gnulib pcre update-pcre tests + AM_CPPFLAGS = \ + $(glib_INCLUDES) \ +diff -r 00b9c5da9d6e gobject/Makefile.in +--- a/gobject/Makefile.in Mon Apr 04 19:01:52 2011 -0700 ++++ b/gobject/Makefile.in Mon Apr 04 19:04:39 2011 -0700 +@@ -440,7 +440,7 @@ + # GObject - GLib Type, Object, Parameter and Signal Library + # Copyright (C) 1997,98,99,2000 Tim Janik and Red Hat, Inc. + # +-SUBDIRS = . tests ++SUBDIRS = . + CLEANFILES = $(am__append_2) $(gen_sources) + @HAVE_THREADS_TRUE@THREAD_FLAGS = -DG_THREADS_MANDATORY + AM_CPPFLAGS = \ +diff -r 00b9c5da9d6e gthread/Makefile.in +--- a/gthread/Makefile.in Mon Apr 04 19:01:52 2011 -0700 ++++ b/gthread/Makefile.in Mon Apr 04 19:04:39 2011 -0700 +@@ -397,7 +397,7 @@ + EXTRA_DIST = makefile.msc.in gthread-posix.c gthread-win32.c \ + gthread-none.c gthread.def gthread.rc.in + TEST_PROGS = +-SUBDIRS = . tests ++SUBDIRS = . + DIST_SUBDIRS = tests + AM_CPPFLAGS = \ + $(glib_INCLUDES) \