atk,pango,gtk+/cygwin



Hello,

Here are some patches to pango,atk and gtk+ which I made to get it running
and compile on cygwin:

pango:

* configure.in: on cygwin add /bin/w32api to library search patch

* pango/pango-utils.c: use DllMain also on cygwin
  pango_get_sysconf_subdirectory(): 
  pango_get_lib_subdirectory(): on cygwin optionaly return standard "unix"
  path or "win32" path


atk:	

* configure.in: define -no-undefined also on cygwin

gtk+:

* configure.in: on cygwin add /bin/w32api to library search patch

* gdk-pixbuf/gdk-pixbuf-io.c: use DllMain also on cygwin
  get_libdir(): on cygwin optionaly return standard "unix" 
  path or "win32" path

* gdk/gdktypes.h: when compiling DLLs on cygwin set GDKVAR to dllexport,
  when compilng static gdk library, don't use dllexport

* gtk/gtkprivate.h: G_OS_WIN32 -> G_PLATFORM_WIN32

* gtk/gtkmain.c: removed functions _gtk_get_libdir(),
  _gtk_get_localedir(), _gtk_get_sysconfdir, _gtk_get_data_prefix()

* gtk/gtkutils.c: new file contains moved functions from gtk/gtkmain.c
  and adapted for cygwin


If the chages are ok, I would like to ask someone with permisions to apply
those patches to CVS. Thanks.

Best regards,
Stevo.

-- 
         />   | Stefan Ondrejicka <ondrej idata sk>
        /<    | http://www.idata.sk/~ondrej/
[XXXXXX( O):::<===================================-
        \<
         \>
--- ../pango-1.0.5/configure.in	2002-10-13 18:32:57.000000000 +0200
+++ configure.in	2002-11-06 12:37:58.000000000 +0100
@@ -241,7 +241,12 @@
 
 
 if test $have_win32 = true; then
-  WIN32_LIBS="-lgdi32"
+case "$host" in
+  *-*-mingw*)
+    WIN32_LIBS="-lgdi32" ;;
+  *-*-cygwin*)
+    WIN32_LIBS="-L/lib/w32api -lgdi32" ;;
+esac
 fi
 
 AC_SUBST(WIN32_LIBS)
--- ../pango-1.0.5x/pango/pango-utils.c	2002-10-02 01:47:51.000000000 +0200
+++ pango/pango-utils.c	2002-11-06 14:15:17.000000000 +0100
@@ -38,7 +38,7 @@
 #  define getc_unlocked(f) getc(f)
 #endif /* !HAVE_FLOCKFILE */
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 
 #include <sys/types.h>
 
@@ -46,6 +46,9 @@
 #include <windows.h>
 
 #endif
+#ifdef G_WITH_CYGWIN
+#include <sys/cygwin.h>
+#endif
 
 struct PangoAlias
 {
@@ -636,7 +639,7 @@
   return g_strdup (g_hash_table_lookup (config_hash, key));
 }
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 
 /* DllMain function needed to tuck away the DLL name */
 
@@ -657,12 +660,24 @@
 G_CONST_RETURN char *
 pango_get_sysconf_subdirectory (void)
 {
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
   static gchar *result = NULL;
 
   if (result == NULL)
+#ifdef G_WITH_CYGWIN
+    {
+      result = g_win32_get_package_installation_subdirectory
+        (PACKAGE " " VERSION, dll_name, "etc/pango");
+      if (!g_file_test(result, G_FILE_TEST_IS_DIR))
+	{
+	  g_free(result);
+	  result = g_strdup(SYSCONFDIR "/pango");
+	}
+    }
+#else
     result = g_win32_get_package_installation_subdirectory
       (PACKAGE " " VERSION, dll_name, "etc\\pango");
+#endif
 
   return result;
 #else
@@ -685,12 +700,24 @@
 G_CONST_RETURN char *
 pango_get_lib_subdirectory (void)
 {
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
   static gchar *result = NULL;
 
   if (result == NULL)
+#ifdef G_WITH_CYGWIN
+    {
+      result = g_win32_get_package_installation_subdirectory
+        (PACKAGE " " VERSION, dll_name, "lib/pango");
+      if (!g_file_test(result, G_FILE_TEST_IS_DIR))
+	{
+	  g_free(result);
+	  result = g_strdup(LIBDIR "/pango");
+	}
+    }
+#else
     result = g_win32_get_package_installation_subdirectory
       (PACKAGE " " VERSION, dll_name, "lib\\pango");
+#endif
 
   return result;
 #else
--- ../gtk+-2.0.7/configure.in	2002-11-04 01:16:21.000000000 +0100
+++ configure.in	2002-11-07 11:31:57.000000000 +0100
@@ -1185,7 +1185,7 @@
     AC_SUBST(GDK_WIN32_EXTRA_CFLAGS)
   fi
 
-  GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -user32 -limm32 -lshell32 -lole32 -luuid"
+  GDK_EXTRA_LIBS="-L/lib/w32api $GDK_EXTRA_LIBS -lgdi32 -user32 -limm32 -lshell32 -lole32 -luuid"
   AM_CONDITIONAL(USE_WIN32, true)
 else
   AM_CONDITIONAL(USE_WIN32, false)
--- ../gtk+-2.0.7/gdk-pixbuf/gdk-pixbuf-io.c	2002-11-04 00:26:26.000000000 +0100
+++ gdk-pixbuf/gdk-pixbuf-io.c	2002-11-06 15:34:28.000000000 +0100
@@ -28,11 +28,14 @@
 #include "gdk-pixbuf-private.h"
 #include "gdk-pixbuf-io.h"
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 #define STRICT
 #include <windows.h>
 #undef STRICT
 #endif
+#ifdef G_WITH_CYGWIN
+#include <sys/cygwin.h>
+#endif
 
 
 
@@ -260,7 +263,7 @@
 	return return_value;
 }
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 
 /* DllMain function needed to tuck away the gdk-pixbuf DLL name */
 
@@ -272,8 +275,20 @@
   static char *libdir = NULL;
 
   if (libdir == NULL)
+#ifdef G_WITH_CYGWIN
+    {
+      libdir = g_win32_get_package_installation_subdirectory
+        (GETTEXT_PACKAGE, dll_name, "lib/gtk-2.0/" GTK_BINARY_VERSION "/loaders");
+      if (!g_file_test(libdir, G_FILE_TEST_IS_DIR))
+	{
+	  g_free(libdir);
+	  libdir = g_strdup(PIXBUF_LIBDIR);
+	}
+    }
+#else
     libdir = g_win32_get_package_installation_subdirectory
       (GETTEXT_PACKAGE, dll_name, "lib\\gtk-2.0\\" GTK_BINARY_VERSION "\\loaders");
+#endif
 
   return libdir;
 }
--- ../gtk+-2.0.7/gdk/gdktypes.h	2002-11-04 00:25:35.000000000 +0100
+++ gdk/gdktypes.h	2002-11-06 17:24:29.000000000 +0100
@@ -33,7 +33,7 @@
 #include <pango/pango.h>
 #include <glib-object.h>
 
-#ifdef G_OS_WIN32
+#if defined(G_PLATFORM_WIN32) && !defined(GTK_STATIC_COMPILATION)
 #  ifdef GDK_COMPILATION
 #    define GDKVAR __declspec(dllexport)
 #  else
--- ../gtk+-2.0.7/gtk/gtkprivate.h	2001-11-04 23:57:03.000000000 +0100
+++ gtk/gtkprivate.h	2002-11-07 11:40:30.000000000 +0100
@@ -78,7 +78,7 @@
 #define GTK_PRIVATE_SET_FLAG(wid,flag)    G_STMT_START{ (GTK_PRIVATE_FLAGS (wid) |= (PRIVATE_ ## flag)); }G_STMT_END
 #define GTK_PRIVATE_UNSET_FLAG(wid,flag)  G_STMT_START{ (GTK_PRIVATE_FLAGS (wid) &= ~(PRIVATE_ ## flag)); }G_STMT_END
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 
 const gchar *_gtk_get_libdir ();
 const gchar *_gtk_get_sysconfdir ();
@@ -94,7 +94,7 @@
 #undef GTK_DATA_PREFIX
 #define GTK_DATA_PREFIX _gtk_get_data_prefix ()
 
-#endif /* G_OS_WIN32 */
+#endif /* G_PLATFORM_WIN32 */
 
 #ifdef __cplusplus
 }
--- /dev/null	2002-11-07 11:42:17.000000000 +0100
+++ gtk/gtkutils.c	2002-11-06 16:47:38.000000000 +0100
@@ -0,0 +1,142 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+/*
+ * please don't include gtkprivate.h, on cygwin it will cause problems
+ */
+
+#include <glib.h>
+#include "config.h"
+
+#ifdef G_PLATFORM_WIN32
+#define STRICT
+#include <windows.h>
+#undef STRICT
+#endif
+#ifdef G_WITH_CYGWIN
+#include <sys/cygwin.h>
+#endif
+
+
+#ifdef G_PLATFORM_WIN32
+
+G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)
+
+const gchar *
+_gtk_get_libdir (void)
+{
+  static char *gtk_libdir = NULL;
+  if (gtk_libdir == NULL)
+#ifdef G_WITH_CYGWIN
+    {
+      gtk_libdir = g_win32_get_package_installation_subdirectory
+        (GETTEXT_PACKAGE, dll_name, "lib");
+      if (!g_file_test(gtk_libdir, G_FILE_TEST_IS_DIR))
+	{
+	  g_free(gtk_libdir);
+	  gtk_libdir = g_strdup(GTK_LIBDIR);
+	}
+    }
+#else
+    gtk_libdir = g_win32_get_package_installation_subdirectory
+      (GETTEXT_PACKAGE, dll_name, "lib");
+#endif
+
+  return gtk_libdir;
+}
+
+const gchar *
+_gtk_get_localedir (void)
+{
+  static char *gtk_localedir = NULL;
+  if (gtk_localedir == NULL)
+#ifdef G_WITH_CYGWIN
+    {
+      gtk_localedir = g_win32_get_package_installation_subdirectory
+        (GETTEXT_PACKAGE, dll_name, "lib/locale");
+      if (!g_file_test(gtk_localedir, G_FILE_TEST_IS_DIR))
+	{
+	  g_free(gtk_localedir);
+	  gtk_localedir = g_strdup(GTK_LOCALEDIR);
+	}
+    }
+#else
+    gtk_localedir = g_win32_get_package_installation_subdirectory
+      (GETTEXT_PACKAGE, dll_name, "lib\\locale");
+#endif
+
+  return gtk_localedir;
+}
+
+const gchar *
+_gtk_get_sysconfdir (void)
+{
+  static char *gtk_sysconfdir = NULL;
+  if (gtk_sysconfdir == NULL)
+#ifdef G_WITH_CYGWIN
+    {
+      gtk_sysconfdir = g_win32_get_package_installation_subdirectory
+        (GETTEXT_PACKAGE, dll_name, "lib");
+      if (!g_file_test(gtk_sysconfdir, G_FILE_TEST_IS_DIR))
+	{
+	  g_free(gtk_sysconfdir);
+	  gtk_sysconfdir = g_strdup(GTK_SYSCONFDIR);
+	}
+    }
+#else
+    gtk_sysconfdir = g_win32_get_package_installation_subdirectory
+      (GETTEXT_PACKAGE, dll_name, "etc");
+#endif
+
+  return gtk_sysconfdir;
+}
+
+const gchar *
+_gtk_get_data_prefix (void)
+{
+  static char *gtk_data_prefix = NULL;
+  if (gtk_data_prefix == NULL)
+#ifdef G_WITH_CYGWIN
+    {
+      gtk_data_prefix = g_win32_get_package_installation_directory
+        (GETTEXT_PACKAGE, dll_name);
+      if (!g_file_test(gtk_data_prefix, G_FILE_TEST_IS_DIR))
+	{
+	  g_free(gtk_data_prefix);
+	  gtk_data_prefix = g_strdup(GTK_DATA_PREFIX);
+	}
+    }
+#else
+    gtk_data_prefix = g_win32_get_package_installation_directory
+      (GETTEXT_PACKAGE, dll_name);
+#endif
+
+  return gtk_data_prefix;
+}
+
+#endif /* G_PLATFORM_WIN32 */
+
+
--- ../gtk+-2.0.7/gtk/gtkmain.c	2002-11-04 00:27:14.000000000 +0100
+++ gtk/gtkmain.c	2002-11-06 16:01:33.000000000 +0100
@@ -40,12 +40,6 @@
 #include <unistd.h>
 #include <sys/types.h>		/* For uid_t, gid_t */
 #endif
-#ifdef G_OS_WIN32
-#define STRICT
-#include <windows.h>
-#undef STRICT
-#endif
-
 #include <pango/pango-utils.h>	/* For pango_split_file_list */
 
 #include "gtkaccelmap.h"
@@ -229,56 +223,6 @@
   return TRUE;
 }
 
-#ifdef G_OS_WIN32
-
-G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)
-
-const gchar *
-_gtk_get_libdir (void)
-{
-  static char *gtk_libdir = NULL;
-  if (gtk_libdir == NULL)
-    gtk_libdir = g_win32_get_package_installation_subdirectory
-      (GETTEXT_PACKAGE, dll_name, "lib");
-
-  return gtk_libdir;
-}
-
-const gchar *
-_gtk_get_localedir (void)
-{
-  static char *gtk_localedir = NULL;
-  if (gtk_localedir == NULL)
-    gtk_localedir = g_win32_get_package_installation_subdirectory
-      (GETTEXT_PACKAGE, dll_name, "lib\\locale");
-
-  return gtk_localedir;
-}
-
-const gchar *
-_gtk_get_sysconfdir (void)
-{
-  static char *gtk_sysconfdir = NULL;
-  if (gtk_sysconfdir == NULL)
-    gtk_sysconfdir = g_win32_get_package_installation_subdirectory
-      (GETTEXT_PACKAGE, dll_name, "etc");
-
-  return gtk_sysconfdir;
-}
-
-const gchar *
-_gtk_get_data_prefix (void)
-{
-  static char *gtk_data_prefix = NULL;
-  if (gtk_data_prefix == NULL)
-    gtk_data_prefix = g_win32_get_package_installation_directory
-      (GETTEXT_PACKAGE, dll_name);
-
-  return gtk_data_prefix;
-}
-
-#endif /* G_OS_WIN32 */
-
 static gchar **
 get_module_path (void)
 {
--- ../gtk+-2.0.7/gtk/Makefile.am	2002-11-04 00:26:40.000000000 +0100
+++ gtk/Makefile.am	2002-11-07 11:46:50.000000000 +0100
@@ -388,6 +388,7 @@
 	gtktreeviewcolumn.c	\
 	gtktypebuiltins.c	\
 	gtktypeutils.c		\
+	gtkutils.c		\
 	gtkvbbox.c		\
 	gtkvbox.c		\
 	gtkviewport.c		\
diff -ruN ../atk-1.0.3/configure.in ./configure.in
--- ../atk-1.0.3/configure.in	2002-07-31 23:08:01.000000000 +0200
+++ ./configure.in	2002-11-06 11:31:02.000000000 +0100
@@ -70,7 +70,7 @@
 
 AC_MSG_CHECKING([for Win32])
 case "$host" in
-  *-*-mingw*)
+  *-*-mingw* | *-*-cygwin*)
     atk_native_win32=yes
     ;;
   *)


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