Patches to compile GTK on Cygwin with native win32 backend
| --- old/glib-2.46.2/glib/glib.h 2015-12-27 00:25:04.433176000 -0500 | |
| +++ new/glib-2.46.2/glib/glib.h 2015-12-27 00:59:55.030049900 -0500 | |
| @@ -94,9 +94,7 @@ | |
| #include <glib/gvariant.h> | |
| #include <glib/gversion.h> | |
| #include <glib/gversionmacros.h> | |
| -#ifdef G_OS_WIN32 | |
| #include <glib/gwin32.h> | |
| -#endif | |
| #ifndef G_DISABLE_DEPRECATED | |
| #include <glib/deprecated/gallocator.h> |
| --- old/glib-2.46.2/glib/gwin32.c 2015-11-05 15:49:18.000000000 -0500 | |
| +++ new/glib-2.46.2/glib/gwin32.c 2015-12-27 01:07:28.156695900 -0500 | |
| @@ -295,8 +295,12 @@ | |
| { | |
| gchar tmp[MAX_PATH]; | |
| - cygwin_conv_to_posix_path (retval, tmp); | |
| + ssize_t e = cygwin_conv_path (CCP_WIN_A_TO_POSIX, retval, tmp, sizeof tmp); | |
| g_free (retval); | |
| + if (e == -1) | |
| + { | |
| + return NULL; | |
| + } | |
| retval = g_strdup (tmp); | |
| } | |
| #endif |
| --- new/glib-2.46.2/glib/gwin32.h 2015-12-27 00:25:04.451187700 -0500 | |
| +++ old/glib-2.46.2/glib/gwin32.h 2015-12-27 01:03:46.825053300 -0500 | |
| @@ -31,8 +31,6 @@ | |
| #include <glib/gtypes.h> | |
| -#ifdef G_OS_WIN32 | |
| - | |
| G_BEGIN_DECLS | |
| #ifndef MAXPATHLEN | |
| @@ -109,7 +107,6 @@ | |
| #define G_WIN32_HAVE_WIDECHAR_API() TRUE | |
| #ifndef __GTK_DOC_IGNORE__ | |
| -#ifdef G_OS_WIN32 | |
| #ifdef _WIN64 | |
| #define g_win32_get_package_installation_directory g_win32_get_package_installation_directory_utf8 | |
| #define g_win32_get_package_installation_subdirectory g_win32_get_package_installation_subdirectory_utf8 | |
| @@ -122,7 +119,6 @@ | |
| gchar *g_win32_get_package_installation_subdirectory_utf8 (const gchar *package, | |
| const gchar *dll_name, | |
| const gchar *subdir); | |
| -#endif /* G_OS_WIN32 */ | |
| #endif /* __GTK_DOC_IGNORE__ */ | |
| /** | |
| @@ -151,6 +147,4 @@ | |
| G_END_DECLS | |
| -#endif /* G_OS_WIN32 */ | |
| - | |
| #endif /* __G_WIN32_H__ */ |
| --- old/glib-2.46.2/glib/Makefile.am 2015-10-14 08:52:57.000000000 -0400 | |
| +++ old/glib-2.46.2/glib/Makefile.am 2015-12-27 00:50:19.530510900 -0500 | |
| @@ -204,7 +204,9 @@ | |
| gwakeup.c \ | |
| gprintf.c \ | |
| gprintfint.h \ | |
| - valgrind.h | |
| + valgrind.h \ | |
| + gwin32.h \ | |
| + gwin32.c | |
| if OS_UNIX | |
| libglib_2_0_la_SOURCES += glib-unix.c |
| --- gtk+-3.18.6.orig/configure.ac 2015-12-04 19:48:16.000000000 -0500 | |
| +++ gtk+-3.18.6/configure.ac 2015-12-26 17:41:51.158959700 -0500 | |
| @@ -1258,7 +1258,7 @@ | |
| fi | |
| if $have_base_x_pc ; then | |
| - GDK_EXTRA_LIBS="$x_extra_libs" | |
| + GDK_EXTRA_LIBS="$x_extra_libs $GDK_EXTRA_LIBS" | |
| else | |
| GDK_EXTRA_LIBS="$X_LIBS $x_extra_libs -lXext -lX11 $GDK_EXTRA_LIBS" | |
| fi |
| --- old/gdk/win32/gdkprivate-win32.h 2015-12-25 18:31:39.731875100 -0500 | |
| +++ new/gdk/win32/gdkprivate-win32.h 2015-12-25 18:31:52.300803800 -0500 | |
| @@ -105,7 +105,7 @@ | |
| #define GDK_DEBUG_EVENTS_OR_INPUT (GDK_DEBUG_EVENTS|GDK_DEBUG_INPUT) | |
| #define GDK_DEBUG_MISC_OR_EVENTS (GDK_DEBUG_MISC|GDK_DEBUG_EVENTS) | |
| -GdkScreen *GDK_WINDOW_SCREEN(GObject *win); | |
| +GdkScreen *GDK_WINDOW_SCREEN(GdkWindow *win); | |
| #define GDK_WINDOW_IS_WIN32(win) (GDK_IS_WINDOW_IMPL_WIN32 (win->impl)) |
| --- gtk+-3.18.6.orig/gtk/Makefile.am 2015-12-04 17:27:43.000000000 -0500 | |
| +++ gtk+-3.18.6/gtk/Makefile.am 2015-12-26 19:16:18.112563300 -0500 | |
| @@ -977,7 +977,11 @@ | |
| gtkwin32embed.h \ | |
| gtkwin32embedwidget.h | |
| if USE_WIN32 | |
| +if USE_X11 | |
| +gtk_c_sources += $(filter-out gtkmountoperation-stub.c,$(gtk_use_win32_c_sources)) | |
| +else | |
| gtk_c_sources += $(gtk_use_win32_c_sources) | |
| +endif | |
| gtk_private_h_sources += $(gtk_use_win32_private_h_sources) | |
| endif | |
| --- old/gtk/deprecated/gtkstatusicon.c 2015-12-26 22:49:11.002867000 -0500 | |
| +++ new/gtk/deprecated/gtkstatusicon.c 2015-12-26 22:45:08.986527900 -0500 | |
| @@ -2220,7 +2220,9 @@ | |
| gboolean *push_in, | |
| gpointer user_data) | |
| { | |
| -#ifdef GDK_WINDOWING_X11 | |
| +#if defined GDK_WINDOWING_X11 && defined GDK_WINDOWING_WIN32 | |
| + return; | |
| +#elif defined GDK_WINDOWING_X11 | |
| GtkStatusIcon *status_icon = GTK_STATUS_ICON (user_data); | |
| GtkStatusIconPrivate *priv = status_icon->priv; | |
| GtkAllocation allocation; | |
| @@ -2313,9 +2315,9 @@ | |
| *y -= menu_req.height - height; | |
| *push_in = FALSE; | |
| -#endif /* GDK_WINDOWING_X11 */ | |
| -#ifdef GDK_WINDOWING_WIN32 | |
| +#elif defined GDK_WINDOWING_WIN32 | |
| + | |
| GtkStatusIcon *status_icon; | |
| GtkStatusIconPrivate *priv; | |
| GtkRequisition menu_req; | |
| @@ -2332,7 +2334,7 @@ | |
| *y = priv->taskbar_top - menu_req.height; | |
| *push_in = TRUE; | |
| -#endif | |
| +#endif /* defined GDK_WINDOWING_X11 && defined GDK_WINDOWING_WIN32 */ | |
| } | |
| /** |
| --- old/gdk/win32/gdkwin32misc.h 2015-12-25 18:35:09.286021800 -0500 | |
| +++ new/gdk/win32/gdkwin32misc.h 2015-12-25 18:34:38.884533800 -0500 | |
| @@ -35,6 +35,7 @@ | |
| #ifndef STRICT | |
| #define STRICT /* We want strict type checks */ | |
| #endif | |
| +#undef Status | |
| #include <windows.h> | |
| #include <commctrl.h> |
| --- old/gdk/win32/gdkwindow-win32.c 2015-12-25 18:36:02.339186600 -0500 | |
| +++ new/gdk/win32/gdkwindow-win32.c 2015-12-25 18:36:14.644631000 -0500 | |
| @@ -79,7 +79,7 @@ | |
| GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN) | |
| GdkScreen * | |
| -GDK_WINDOW_SCREEN (GObject *win) | |
| +GDK_WINDOW_SCREEN (GdkWindow *win) | |
| { | |
| return _gdk_screen; | |
| } |
| --- old/gdk/win32/gdkwindow-win32.h 2015-12-25 18:37:02.734143000 -0500 | |
| +++ new/gdk/win32/gdkwindow-win32.h 2015-12-25 18:37:16.792716100 -0500 | |
| @@ -29,6 +29,7 @@ | |
| #include "gdk/gdkwindowimpl.h" | |
| #include "gdk/gdkcursor.h" | |
| +#undef Status | |
| #include <windows.h> | |
| G_BEGIN_DECLS |
| --- libepoxy-1.3.1.orig/configure 2015-07-15 19:47:03.000000000 -0400 | |
| +++ libepoxy-1.3.1/configure 2015-12-25 03:01:06.327845700 -0500 | |
| @@ -18658,6 +18658,15 @@ | |
| has_znow=no | |
| EPOXY_LINK_LIBS="" | |
| ;; | |
| + cygwin*) | |
| + build_egl=yes | |
| + build_glx=yes | |
| + build_wgl=yes | |
| + # On windows, the DLL has to have all of its functions | |
| + # resolved at link time, so we have to link directly aginst | |
| + # opengl32.dll. But that's the only GL provider, anyway. | |
| + EPOXY_LINK_LIBS="-lopengl32" | |
| + ;; | |
| *) | |
| build_egl=yes | |
| build_glx=yes |
| --- libepoxy-1.3.1.orig/src/dispatch_common.c 2015-07-15 17:45:02.000000000 -0400 | |
| +++ libepoxy-1.3.1/src/dispatch_common.c 2015-12-25 17:29:28.336191500 -0500 | |
| @@ -90,6 +90,7 @@ | |
| #include <assert.h> | |
| #include <stdlib.h> | |
| #ifdef _WIN32 | |
| +#undef Status /* LOCAL EDIT */ | |
| #include <windows.h> | |
| #else | |
| #include <dlfcn.h> |
| --- libepoxy-1.3.1.orig/src/dispatch_common.h 2015-07-15 17:44:56.000000000 -0400 | |
| +++ libepoxy-1.3.1/src/dispatch_common.h 2015-12-25 17:45:22.737939300 -0500 | |
| @@ -45,16 +45,22 @@ | |
| #define EPOXY_IMPORTEXPORT | |
| #endif | |
| +/* #include "epoxy/gl.h" */ | |
| +/* #if PLATFORM_HAS_GLX */ | |
| +/* #include "epoxy/glx.h" */ | |
| +/* #endif */ | |
| +/* #if PLATFORM_HAS_EGL */ | |
| +/* #include "epoxy/egl.h" */ | |
| +/* #endif */ | |
| +/* #if PLATFORM_HAS_WGL */ | |
| +/* #include "epoxy/wgl.h" */ | |
| +/* #endif */ | |
| +/* BEGIN LOCAL EDIT */ | |
| #include "epoxy/gl.h" | |
| -#if PLATFORM_HAS_GLX | |
| +#include "epoxy/wgl.h" | |
| #include "epoxy/glx.h" | |
| -#endif | |
| -#if PLATFORM_HAS_EGL | |
| #include "epoxy/egl.h" | |
| -#endif | |
| -#if PLATFORM_HAS_WGL | |
| -#include "epoxy/wgl.h" | |
| -#endif | |
| +/* END LOCAL EDIT */ | |
| #ifndef PUBLIC | |
| # ifdef _WIN32 | |
| @@ -76,11 +82,12 @@ | |
| * since the function pointers depend on the device and pixel format | |
| * of the current context. | |
| */ | |
| -#if defined(_WIN32) | |
| -#define USING_DISPATCH_TABLE 1 | |
| -#else | |
| -#define USING_DISPATCH_TABLE 0 | |
| -#endif | |
| +/* #if defined(_WIN32) */ | |
| +/* #define USING_DISPATCH_TABLE 1 */ | |
| +/* #else */ | |
| +/* #define USING_DISPATCH_TABLE 0 */ | |
| +/* #endif */ | |
| +#define USING_DISPATCH_TABLE 1 /* LOCAL EDIT: patching for Cygwin */ | |
| #define UNWRAPPED_PROTO(x) (GLAPIENTRY *x) | |
| #define WRAPPER_VISIBILITY(type) static type GLAPIENTRY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment