Autoconfiscation patch for GTK+ on Win32



Here is a suggested patch for GTK+, that enables
auto*/configure/libtool builds on Win32, and adds the Win32 backend to
the Makefiles. OK to commit?

(Diffs to some Win32-specific files left out from this message.)

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.2371
diff -u -2 -r1.2371 ChangeLog
--- ChangeLog	2001/10/09 18:51:43	1.2371
+++ ChangeLog	2001/10/09 23:57:52
@@ -1,2 +1,61 @@
+2001-10-10  Tor Lillqvist  <tml iki fi>
+
+	Changes for autoconfiscated build on Win32, and addition of Win32
+	backend:
+	
+	* configure.in: Like in GLib, set LT_CURRENT_MINUS_AGE for use
+	when forming DLL name in some files. Call
+	AC_LIBTOOL_WIN32_DLL. Set PLATFORM_WIN32, OS_WIN32 and USE_WIN32
+	automake conditionals. Add win32 target, using pangowin32. Don't
+	use the -export-symbols-regex option on Win32, we use .def files
+	to list exported symbols. Check <winsock.h> (for gethostname() in
+	gtkfilesel.c). Enclose nested AC_CHECK_* macros in brackets to
+	prevent premature m4 expansion.
+
+	* acconfig.h: Add HAVE_FT2.
+
+	* gdk/Makefile.am: Add libgdk-win32-1.3.la target and associated
+	macros and rules. Use -no-undefined on Win32. Use gdk.def file.
+
+	* gdk/gdkglobals.c: Mark gdk_threads_mutex for export with GDKVAR.
+
+	* gdk/win32/Makefile.am: Actually enable building the win32
+	objects here, not just list files in EXTRA_DIST.
+
+	* gdk/win32/gdkregion-win32.c: Remove.
+
+	* gdk/win32/gdkevents-win32.c (print_event): Add GDK_SETTING.
+
+	* gdk/win32/gdkfont-win32.c
+	* gdk/win32/gdkgeometry-win32.c: Remove unused variables.
+
+	* Don't assume the name of the GDK DLL when fetching the icon. Use
+	the HMODULE saved in gdk_dll_hinstance by DllMain.
+
+	* gdk/win32/rc/Makefile.am: Build gdk-win32res.lo using the
+	build/win32/lt-compile-resource script.
+
+	* gdk/win32/rc/gdk.rc.in
+	* gtk/gtk-win32.rc.in: Use the DLL name that libtool would use.
+
+	* gtk/Makefile.am: Add libgtk-win32-1.3.la target and associated
+	macros and rules. Use -no-undefined on Win32. Use gtk-win32.def
+	file.
+
+	* gtk/gtk.def: Updates.
+
+	* gtk/gtkfilesel.c: Include <winsock.h> (if available) for
+	gethostname().
+
+	* gtk/gtkmain.c
+	* gtk/gtkrc.c: (Win32) Save actual DLL name for later use in DLL
+	entry function. Avoid hardcoded paths GTK_LIBDIR, GTK_SYSCONFDIR,
+	GTK_DATA_PREFIX and GTK_LOCALEDIR, instead call
+	g_win32_get_package_installation_subdirectory() with the actual
+	DLL name saved above. Remove some ifdefs.
+
+	* gtk/maketypes.awk: Output GTKTYPEBUILTINS_VAR (that marks
+	variable for export on Win32) also to the _vars file.
+
 Tue Oct  9 14:50:51 2001  Jonathan Blandford  <jrb redhat com>
 
Index: acconfig.h
===================================================================
RCS file: /cvs/gnome/gtk+/acconfig.h,v
retrieving revision 1.22
diff -u -2 -r1.22 acconfig.h
--- acconfig.h	2001/06/25 23:01:35	1.22
+++ acconfig.h	2001/10/09 23:57:52
@@ -34,4 +34,5 @@
 #undef HAVE_XCONVERTCASE
 #undef HAVE_XFT
+#undef HAVE_FT2
 
 #undef NO_FD_SET
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gtk+/configure.in,v
retrieving revision 1.231
diff -u -2 -r1.231 configure.in
--- configure.in	2001/09/30 04:12:26	1.231
+++ configure.in	2001/10/09 23:57:55
@@ -54,8 +54,10 @@
 LT_REVISION=$GTK_INTERFACE_AGE
 LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
+LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
 AC_SUBST(LT_RELEASE)
 AC_SUBST(LT_CURRENT)
 AC_SUBST(LT_REVISION)
 AC_SUBST(LT_AGE)
+AC_SUBST(LT_CURRENT_MINUS_AGE)
 
 # Define a string for the earliest version that this release has
@@ -101,4 +103,5 @@
 
 dnl Initialize libtool
+AC_LIBTOOL_WIN32_DLL
 AM_PROG_LIBTOOL
 
@@ -108,4 +111,33 @@
 AC_CANONICAL_HOST
 
+AC_MSG_CHECKING([for some Win32 platform])
+case "$host" in
+  *-*-mingw*|*-*-cygwin*)
+    platform_win32=yes
+    ;;
+  *)
+    platform_win32=no
+    ;;
+esac
+AC_MSG_RESULT([$platform_win32])
+AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
+
+AC_MSG_CHECKING([for native Win32])
+case "$host" in
+  *-*-mingw*)
+    os_win32=yes
+
+    AS="$CC"
+    ASFLAGS="$CFLAGS"
+    AC_SUBST(AS)
+    AC_SUBST(ASFLAGS)
+    ;;
+  *)
+    os_win32=no
+    ;;
+esac
+AC_MSG_RESULT([$os_win32])
+AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
+
 dnl figure debugging default, prior to $ac_help setup
 dnl
@@ -134,14 +166,21 @@
 AC_ARG_WITH(xinput, [  --with-xinput=[no/gxi/xfree] support XInput ])
 
-gdktarget=x11
-gdktargetlib=libgdk-x11-1.3.la
-gtktargetlib=libgtk-x11-1.3.la
-AC_ARG_WITH(gdktarget, [  --with-gdktarget=[x11/linux-fb] select GDK target [default=x11] ],
+if test "$platform_win32" = yes; then
+  gdktarget=win32
+  gdktargetlib=libgdk-win32-1.3.la
+  gtktargetlib=libgtk-win32-1.3.la
+else
+  gdktarget=x11
+  gdktargetlib=libgdk-x11-1.3.la
+  gtktargetlib=libgtk-x11-1.3.la
+fi
+
+AC_ARG_WITH(gdktarget, [  --with-gdktarget=[x11/linux-fb/win32] select GDK target [default=$gdktarget]],
 	gdktarget=$with_gdktarget)
 
 AC_SUBST(gdktarget)
 case $gdktarget in
-  x11|linux-fb) ;;
-  *) AC_MSG_ERROR([Invalid target for GDK: use x11 or linux-fb.]);;
+  x11|linux-fb|win32) ;;
+  *) AC_MSG_ERROR([Invalid target for GDK: use x11, linux-fb or win32.]);;
 esac
 
@@ -192,4 +231,11 @@
     esac
   fi
+
+  if test "$os_win32" = "yes"; then
+    case " $CFLAGS " in
+    *[[\ \	]]-fnative-struct[[\ \	]]*) ;;
+    *) CFLAGS="$CFLAGS -fnative-struct" ;;
+    esac
+  fi
 fi
 changequote([,])dnl
@@ -206,7 +252,11 @@
 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION atk >= $ATK_REQUIRED_VERSION pango >= $PANGO_REQUIRED_VERSION)
 
-# libtool option to control which symbols are exported
-# right now, symbols starting with _ are not exported
-LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
+if test "$os_win32" != yes; then
+    # libtool option to control which symbols are exported
+    # right now, symbols starting with _ are not exported
+    LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
+else
+    LIBTOOL_EXPORT_OPTIONS=
+fi
 AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
 
@@ -320,4 +370,5 @@
 AC_CHECK_HEADERS(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H))
 AC_CHECK_HEADERS(unistd.h, AC_DEFINE(HAVE_UNISTD_H))
+AC_CHECK_HEADERS(winsock.h, AC_DEFINE(HAVE_WINSOCK_H))
 
 saved_cflags="$CFLAGS"
@@ -456,16 +507,16 @@
   if test -z "$LIBTIFF"; then
     AC_CHECK_LIB(tiff, TIFFReadScanline,
-      AC_CHECK_HEADER(tiffio.h,
+      [AC_CHECK_HEADER(tiffio.h,
         TIFF='tiff'; LIBTIFF='-ltiff',
-        AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***)),
-      AC_CHECK_LIB(tiff, TIFFWriteScanline,
-        AC_CHECK_HEADER(tiffio.h,
+        AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
+      [AC_CHECK_LIB(tiff, TIFFWriteScanline,
+        [AC_CHECK_HEADER(tiffio.h,
           TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz',
-          AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***)),
-        AC_CHECK_LIB(tiff34, TIFFFlushData,
-          AC_CHECK_HEADER(tiffio.h,
+          AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
+        [AC_CHECK_LIB(tiff34, TIFFFlushData,
+          [AC_CHECK_HEADER(tiffio.h,
             TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz',
-            AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***)),
-        AC_MSG_WARN(*** TIFF plug-in will not be built (TIFF library not found) ***), -ljpeg -lz -lm), -ljpeg -lz -lm), -lm)
+            AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
+        AC_MSG_WARN(*** TIFF plug-in will not be built (TIFF library not found) ***), -ljpeg -lz -lm)], -ljpeg -lz -lm)], -lm)
   fi
 
@@ -500,7 +551,7 @@
   if test -z "$LIBPNG"; then
     AC_CHECK_LIB(png, png_read_info,
-      AC_CHECK_HEADER(png.h,
+      [AC_CHECK_HEADER(png.h,
         png_ok=yes,
-        png_ok=no),
+        png_ok=no)],
       AC_MSG_WARN(*** PNG loader will not be built (PNG library not found) ***), -lz -lm)
     if test "$png_ok" = yes; then
@@ -832,4 +883,52 @@
 fi
 
+if test "x$gdktarget" = "xwin32"; then
+  # We start off with the libraries from Pango
+
+  ## be sure we also have Pango built with win32 or ft2 support
+  if $PKG_CONFIG --exists pangoft2 ; then
+    PANGO_PACKAGES="pangowin32 pangoft2"
+    have_ft2=true
+    AC_DEFINE(HAVE_FT2)
+  else
+    PANGO_PACKAGES="pangowin32"
+    have_ft2=false
+  fi
+
+  AM_CONDITIONAL(HAVE_FT2, $have_ft2)
+
+  win32_libs="`$PKG_CONFIG --libs $PANGO_PACKAGES`"
+  win32_cflags="`$PKG_CONFIG --cflags $PANGO_PACKAGES`"
+  win32_extra_libs=
+
+  ## Strip the .la files
+ 
+  win32_libs_for_checks=""
+  for I in $win32_libs ; do
+    case $I in 
+      *.la) ;;
+      *) win32_libs_for_checks="$win32_libs_for_checks $I" ;;
+    esac
+  done
+
+  # Sanity check for the gdi32 library
+  AC_CHECK_LIB(gdi32, CreateDCA 16, :,
+            AC_MSG_ERROR([*** libgdi32 not found. Check 'config.log' for more details.]),
+            $win32_libs_for_checks)
+
+  GDK_PIXBUF_WIN32_EXTRA_CFLAGS="$win32_cflags"
+  GDK_PIXBUF_WIN32_EXTRA_LIBS="$win32_extra_libs `$PKG_CONFIG --libs pangowin32`"
+
+  win32_cflags="$WIN32_CFLAGS"
+  win32_ldflags="$WIN32_LDFLAGS"
+
+  GDK_EXTRA_CFLAGS=
+  GDK_EXTRA_LIBS="$win32_extra_libs"
+
+  AM_CONDITIONAL(USE_WIN32, true)
+else
+  AM_CONDITIONAL(USE_WIN32, false)
+fi
+
 AC_SUBST(xinput_progs)
 
@@ -890,4 +989,6 @@
             PANGO_PACKAGES=pangox
         fi
+elif test "x$gdktarget" = "xwin32"; then
+        PANGO_PACKAGES=pangowin32
 elif test "x$gdktarget" = "xlinux-fb"; then
         PANGO_PACKAGES=pangoft2
@@ -1094,4 +1195,7 @@
   gdk_windowing='
 #define GDK_WINDOWING_X11'
+elif test "x$gdktarget" = "xwin32" ; then
+  gdk_windowing='
+#define GDK_WINDOWING_WIN32'
 elif test "x$gdktarget" = "xlinux-fb" ; then
   gdk_windowing='
Index: gdk/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/Makefile.am,v
retrieving revision 1.72
diff -u -2 -r1.72 Makefile.am
--- gdk/Makefile.am	2001/09/20 16:31:21	1.72
+++ gdk/Makefile.am	2001/10/09 23:58:02
@@ -19,4 +19,5 @@
 	@GTK_DEBUG_FLAGS@ 		\
 	@GDK_DEP_CFLAGS@		\
+	-DGDK_COMPILATION		\
 @STRIP_END@
 
@@ -24,4 +25,12 @@
 gtarget= gdktarget@
 
+if PLATFORM_WIN32
+no_undefined = -no-undefined
+endif
+
+if OS_WIN32
+gdk_win32_symbols = -export-symbols gdk.def
+endif
+
 # libtool stuff: set version and export symbols for resolving
 # since automake doesn't support conditionalized libsomething_la_LDFLAGS
@@ -31,4 +40,5 @@
 	-export-dynamic 					\
 	-rpath @prefix@/lib 					\
+	$(no_undefined)						\
 	@LIBTOOL_EXPORT_OPTIONS@				\
 	$(top_builddir)/gdk-pixbuf/libgdk_pixbuf-1.3.la		\
@@ -128,8 +138,21 @@
 endif
 
+if USE_WIN32
+libgdk_win32_includedir = $(includedir)/gtk-2.0/gdk
+
+libgdk_win32_1_3_la_LIBADD = \
+	$(gtarget)/libgdk-$(gtarget).la
+
+libgdk_win32_include_HEADERS = $(gdk_headers)
+libgdk_win32_1_3_la_SOURCES = $(gdk_c_sources) gdkenumtypes.c
+
+libgdk_win32_1_3_la_LDFLAGS = $(gdk_win32_symbols) -lgdi32 -user32 -limm32 -lshell32 -lole32 -luuid
+
+endif
+
 # now define the real one to workaround automake's mishandling
 lib_LTLIBRARIES = $(extra)
 
-EXTRA_LTLIBRARIES = libgdk-x11-1.3.la libgdk-linux-fb-1.3.la
+EXTRA_LTLIBRARIES = libgdk-x11-1.3.la libgdk-linux-fb-1.3.la libgdk-win32-1.3.la
 
 MAINTAINERCLEANFILES =
Index: gdk/gdkglobals.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkglobals.c,v
retrieving revision 1.24
diff -u -2 -r1.24 gdkglobals.c
--- gdk/gdkglobals.c	2001/09/07 21:49:49	1.24
+++ gdk/gdkglobals.c	2001/10/09 23:58:02
@@ -39,4 +39,5 @@
 GList            *_gdk_queued_tail = NULL;
 
+GDKVAR
 GMutex           *gdk_threads_mutex = NULL;          /* Global GDK lock */
 
Index: gdk/win32/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/win32/Makefile.am,v
retrieving revision 1.11
diff -u -2 -r1.11 Makefile.am
--- gdk/win32/Makefile.am	2001/05/25 15:43:52	1.11
+++ gdk/win32/Makefile.am	2001/10/09 23:58:03
@@ -1,7 +1,30 @@
+## Process this file with automake to produce Makefile.in
+
+libgdkincludedir = $(includedir)/gtk-2.0/gdk
+
+INCLUDES = @STRIP_BEGIN@ 	\
+	-DG_LOG_DOMAIN=\"Gdk\"	\
+	-DINSIDE_GDK_WIN32	\
+	-I$(top_srcdir)		\
+	-I$(top_srcdir)/gdk	\
+	-I$(top_builddir)/gdk	\
+	@GTK_DEBUG_FLAGS@ 	\
+	@GDK_DEP_CFLAGS@	\
+	-DGDK_COMPILATION	\
+ STRIP_END@
+
+LDADDS = @STRIP_BEGIN@ 		\
+	@GDK_DEP_LIBS@		\
+ STRIP_END@
+
+noinst_LTLIBRARIES = libgdk-win32.la
+
 SUBDIRS=rc
 
 EXTRA_DIST = \
 	makefile.mingw \
-	makefile.msc \
+	makefile.msc
+
+libgdk_win32_la_SOURCES = \
 	bdfcursor.c \
 	xcursors.h \
@@ -28,5 +51,4 @@
 	gdkprivate-win32.h \
 	gdkproperty-win32.c \
-	gdkregion-win32.c \
 	gdkselection-win32.c \
 	gdkvisual-win32.c \
@@ -36,2 +58,7 @@
 	gdkwindow-win32.h \
 	surrogate-dimm.h
+
+libgdkinclude_HEADERS =		\
+	gdkwin32.h
+
+libgdk_win32_la_LIBADD = rc/gdk-win32res.lo
Index: gdk/win32/rc/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/win32/rc/Makefile.am,v
retrieving revision 1.3
diff -u -2 -r1.3 Makefile.am
--- gdk/win32/rc/Makefile.am	2001/02/23 03:51:40	1.3
+++ gdk/win32/rc/Makefile.am	2001/10/09 23:58:09
@@ -3,2 +3,9 @@
 	gdk.rc.in \
 	gtk.ico
+
+if USE_WIN32
+noinst_DATA = gdk-win32res.lo
+endif
+
+gdk-win32res.lo : gdk.rc
+	$(top_srcdir)/build/win32/lt-compile-resource gdk.rc gdk-win32res.lo
Index: gdk-pixbuf/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/ChangeLog,v
retrieving revision 1.339
diff -u -2 -r1.339 ChangeLog
--- gdk-pixbuf/ChangeLog	2001/10/05 18:51:47	1.339
+++ gdk-pixbuf/ChangeLog	2001/10/09 23:58:11
@@ -1,2 +1,14 @@
+2001-10-10  Tor Lillqvist  <tml iki fi>
+
+	* Makefile.am: Use -no-undefined on Win32. Make
+	libgdk_pixbug_1_3_la_OBJECTS depend on gdk-pixbuf-marshal.c.
+
+	* gdk-pixbuf-io.c (DllMain): (Win32) DLL entry point, saves DLL
+	name.
+	(get_libdir): Use above actual DLL name instead of guessing.
+
+	* io-xbm.c (gdk_pixbuf__xbm_image_begin_load): Use g_file_open_tmp
+	insread of mkstemp().
+
 2001-10-05  Sven Neumann  <sven gimp org>
 
Index: gdk-pixbuf/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/Makefile.am,v
retrieving revision 1.109
diff -u -2 -r1.109 Makefile.am
--- gdk-pixbuf/Makefile.am	2001/09/26 22:09:28	1.109
+++ gdk-pixbuf/Makefile.am	2001/10/09 23:58:11
@@ -2,4 +2,8 @@
 SUBDIRS = pixops
 
+if PLATFORM_WIN32
+no_undefined = -no-undefined
+endif
+
 lib_LTLIBRARIES = 		\
 	libgdk_pixbuf-1.3.la
@@ -13,5 +17,5 @@
 #
 libpixbufloader_png_la_SOURCES = io-png.c
-libpixbufloader_png_la_LDFLAGS = -avoid-version -module
+libpixbufloader_png_la_LDFLAGS = -avoid-version -module $(no_undefined)
 libpixbufloader_png_la_LIBADD = $(LIBPNG) $(module_libs)
 libpixbufloader_static_png_la_SOURCES = io-png.c
@@ -22,5 +26,5 @@
 libpixbufloader_static_jpeg_la_SOURCES = io-jpeg.c
 libpixbufloader_jpeg_la_SOURCES = io-jpeg.c
-libpixbufloader_jpeg_la_LDFLAGS = -avoid-version -module
+libpixbufloader_jpeg_la_LDFLAGS = -avoid-version -module $(no_undefined)
 libpixbufloader_jpeg_la_LIBADD = $(LIBJPEG) $(module_libs)
 
@@ -30,5 +34,5 @@
 libpixbufloader_static_xpm_la_SOURCES = io-xpm.c
 libpixbufloader_xpm_la_SOURCES = io-xpm.c
-libpixbufloader_xpm_la_LDFLAGS = -avoid-version -module
+libpixbufloader_xpm_la_LDFLAGS = -avoid-version -module $(no_undefined)
 libpixbufloader_xpm_la_LIBADD = $(module_libs)
 
@@ -38,5 +42,5 @@
 libpixbufloader_static_gif_la_SOURCES = io-gif.c io-gif-animation.c io-gif-animation.h
 libpixbufloader_gif_la_SOURCES = io-gif.c io-gif-animation.c io-gif-animation.h
-libpixbufloader_gif_la_LDFLAGS = -avoid-version -module
+libpixbufloader_gif_la_LDFLAGS = -avoid-version -module $(no_undefined)
 libpixbufloader_gif_la_LIBADD = $(module_libs)
 
@@ -46,5 +50,5 @@
 libpixbufloader_static_ico_la_SOURCES = io-ico.c
 libpixbufloader_ico_la_SOURCES = io-ico.c
-libpixbufloader_ico_la_LDFLAGS = -avoid-version -module
+libpixbufloader_ico_la_LDFLAGS = -avoid-version -module $(no_undefined)
 libpixbufloader_ico_la_LIBADD = $(module_libs)
 
@@ -54,5 +58,5 @@
 libpixbufloader_static_ras_la_SOURCES = io-ras.c
 libpixbufloader_ras_la_SOURCES = io-ras.c
-libpixbufloader_ras_la_LDFLAGS = -avoid-version -module
+libpixbufloader_ras_la_LDFLAGS = -avoid-version -module $(no_undefined)
 libpixbufloader_ras_la_LIBADD = $(module_libs)
 
@@ -62,5 +66,5 @@
 libpixbufloader_static_tiff_la_SOURCES = io-tiff.c
 libpixbufloader_tiff_la_SOURCES = io-tiff.c
-libpixbufloader_tiff_la_LDFLAGS = -avoid-version -module
+libpixbufloader_tiff_la_LDFLAGS = -avoid-version -module $(no_undefined)
 libpixbufloader_tiff_la_LIBADD = $(LIBTIFF) $(module_libs)
 
@@ -70,5 +74,5 @@
 libpixbufloader_static_pnm_la_SOURCES = io-pnm.c
 libpixbufloader_pnm_la_SOURCES = io-pnm.c
-libpixbufloader_pnm_la_LDFLAGS = -avoid-version -module
+libpixbufloader_pnm_la_LDFLAGS = -avoid-version -module $(no_undefined)
 libpixbufloader_pnm_la_LIBADD = $(module_libs)
 
@@ -78,5 +82,5 @@
 libpixbufloader_static_bmp_la_SOURCES = io-bmp.c
 libpixbufloader_bmp_la_SOURCES = io-bmp.c
-libpixbufloader_bmp_la_LDFLAGS = -avoid-version -module
+libpixbufloader_bmp_la_LDFLAGS = -avoid-version -module $(no_undefined)
 libpixbufloader_bmp_la_LIBADD = $(module_libs)
 
@@ -86,5 +90,5 @@
 libpixbufloader_static_wbmp_la_SOURCES = io-wbmp.c
 libpixbufloader_wbmp_la_SOURCES = io-wbmp.c
-libpixbufloader_wbmp_la_LDFLAGS = -avoid-version -module
+libpixbufloader_wbmp_la_LDFLAGS = -avoid-version -module $(no_undefined)
 libpixbufloader_wbmp_la_LIBADD = $(module_libs)
 
@@ -93,5 +97,5 @@
 #
 libpixbufloader_xbm_la_SOURCES = io-xbm.c
-libpixbufloader_xbm_la_LDFLAGS = -avoid-version -module
+libpixbufloader_xbm_la_LDFLAGS = -avoid-version -module $(no_undefined)
 libpixbufloader_xbm_la_LIBADD = $(module_libs)
 
@@ -100,5 +104,5 @@
 #
 libpixbufloader_tga_la_SOURCES = io-tga.c
-libpixbufloader_tga_la_LDFLAGS = -avoid-version -module
+libpixbufloader_tga_la_LDFLAGS = -avoid-version -module $(no_undefined)
 libpixbufloader_tga_la_LIBADD = $(module_libs)
 
@@ -176,4 +180,5 @@
 	-I$(top_srcdir)/gdk-pixbuf 		\
 	-I$(top_builddir)/gdk-pixbuf 		\
+	-DGTK_VERSION=\"@GTK_VERSION \"		\
 	@INCLUDED_LOADER_DEFINE@ 		\
 	@GTK_DEBUG_FLAGS@			\
@@ -218,4 +223,5 @@
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)    \
 	@LIBTOOL_EXPORT_OPTIONS@				\
+	 $(no_undefined)					\
 @STRIP_END@
 
@@ -239,5 +245,5 @@
 gdk_pixbuf_built_headers = gdk-pixbuf-enum-types.h gdk-pixbuf-marshal.h
 gdk_pixbuf_built_cfiles = gdk-pixbuf-enum-types.c 
-$(OBJECTS): $(gdk_pixbuf_built_headers) $(gdk_pixbuf_built_cfiles) gdk-pixbuf-marshal.c
+$(libgdk_pixbuf_1_3_la_OBJECTS) $(OBJECTS): $(gdk_pixbuf_built_headers) $(gdk_pixbuf_built_cfiles) gdk-pixbuf-marshal.c
 
 CLEANFILES =
Index: gdk-pixbuf/gdk-pixbuf-io.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/gdk-pixbuf-io.c,v
retrieving revision 1.61
diff -u -2 -r1.61 gdk-pixbuf-io.c
--- gdk-pixbuf/gdk-pixbuf-io.c	2001/10/05 18:51:47	1.61
+++ gdk-pixbuf/gdk-pixbuf-io.c	2001/10/09 23:58:12
@@ -29,4 +29,10 @@
 #include "gdk-pixbuf-io.h"
 
+#ifdef G_OS_WIN32
+#define STRICT
+#include <windows.h>
+#undef STRICT
+#endif
+
 
 
@@ -253,4 +259,23 @@
 #ifdef G_OS_WIN32
 
+/* DllMain function needed to tuck away the GLib DLL name */
+
+static char dll_name[MAX_PATH];
+
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL,
+	 DWORD     fdwReason,
+	 LPVOID    lpvReserved)
+{
+  switch (fdwReason)
+    {
+    case DLL_PROCESS_ATTACH:
+      GetModuleFileName ((HMODULE) hinstDLL, dll_name, sizeof (dll_name));
+      break;
+    }
+
+  return TRUE;
+}
+
 static char *
 get_libdir (void)
@@ -260,12 +285,10 @@
   if (libdir == NULL)
     libdir = g_win32_get_package_installation_subdirectory
-      (GETTEXT_PACKAGE,
-       g_strdup_printf ("gdk_pixbuf-%d.%d.dll",
-			GDK_PIXBUF_MAJOR, GDK_PIXBUF_MINOR),
-       "loaders");
+      (GETTEXT_PACKAGE, dll_name, "lib\\gtk-2.0\\" GTK_VERSION "\\loaders");
 
   return libdir;
 }
 
+#undef PIXBUF_LIBDIR
 #define PIXBUF_LIBDIR get_libdir ()
 
Index: gdk-pixbuf/io-xbm.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/io-xbm.c,v
retrieving revision 1.4
diff -u -2 -r1.4 io-xbm.c
--- gdk-pixbuf/io-xbm.c	2001/07/18 04:25:03	1.4
+++ gdk-pixbuf/io-xbm.c	2001/10/09 23:58:12
@@ -367,8 +367,8 @@
 	context->user_data = user_data;
 	context->all_okay = TRUE;
-	context->tempname = g_strdup ("/tmp/gdkpixbuf-xbm-tmp.XXXXXX");
-	fd = mkstemp (context->tempname);
+	fd = g_file_open_tmp ("gdkpixbuf-xbm-tmp.XXXXXX",
+			      &context->tempname,
+			      NULL);
 	if (fd < 0) {
-	        g_free (context->tempname);
 		g_free (context);
 		return NULL;
Index: gtk/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/Makefile.am,v
retrieving revision 1.185
diff -u -2 -r1.185 Makefile.am
--- gtk/Makefile.am	2001/09/20 16:31:21	1.185
+++ gtk/Makefile.am	2001/10/09 23:58:13
@@ -13,4 +13,5 @@
 	-DTESTGTK_RCFILE=\"`pwd`/$(srcdir)/testgtkrc\"	\
 	-DG_DISABLE_CONST_RETURNS			\
+	-DGTK_COMPILATION				\
 	-I$(top_builddir)/gtk				\
 	-I$(top_srcdir) -I../gdk			\
@@ -23,4 +24,18 @@
 gtarget= gdktarget@
 
+if PLATFORM_WIN32
+no_undefined = -no-undefined
+endif
+
+if OS_WIN32
+gtk_def = gtk.def
+gtk_win32_symbols = -export-symbols $(gtk_def)
+
+gtk_win32res_lo = gtk-win32res.lo
+
+gtk-win32res.lo : gtk-win32.rc
+	$(top_srcdir)/build/win32/lt-compile-resource gtk-win32.rc gtk-win32res.lo
+endif
+
 # libtool stuff: set version and export symbols for resolving
 # since automake doesn't support conditionalized libsomething_la_LDFLAGS
@@ -31,4 +46,5 @@
 	-export-dynamic						\
 	-rpath @prefix@/lib					\
+	$(no_undefined)						\
 	@LIBTOOL_EXPORT_OPTIONS@				\
 	$(top_builddir)/gdk-pixbuf/libgdk_pixbuf-1.3.la		\
@@ -396,5 +412,4 @@
 @STRIP_END@
 
-
 #
 # setup GTK+ sources and their dependancies
@@ -505,6 +520,14 @@
 libgtk_linux_fb_include_HEADERS = $(gtk_target_headers)
 libgtk_linux_fb_1_3_la_SOURCES = $(gtk_target_sources)
+endif
+if USE_WIN32
+libgtk_win32_includedir = $(includedir)/gtk-2.0/gtk
+libgtk_win32_include_HEADERS = $(gtk_target_headers)
+libgtk_win32_1_3_la_SOURCES = $(gtk_target_sources)
+libgtk_win32_1_3_la_LDFLAGS = $(gtk_win32_symbols) -lwsock32
+libgtk_win32_1_3_la_LIBADD = $(gtk_win32res_lo)
+libgtk_win32_1_3_la_DEPENDENCIES = $(gtk_def) $(gtk_win32res_lo)
 endif
-EXTRA_LTLIBRARIES = libgtk-x11-1.3.la libgtk-linux-fb-1.3.la
+EXTRA_LTLIBRARIES = libgtk-x11-1.3.la libgtk-linux-fb-1.3.la libgtk-win32-1.3.la
 
 
Index: gtk/gtkfilesel.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilesel.c,v
retrieving revision 1.85
diff -u -2 -r1.85 gtkfilesel.c
--- gtk/gtkfilesel.c	2001/09/19 00:49:51	1.85
+++ gtk/gtkfilesel.c	2001/10/09 23:58:16
@@ -45,4 +45,7 @@
 #include <pwd.h>
 #endif
+#if 1 /* def HAVE_WINSOCK_H */
+#include <winsock.h>		/* For gethostname */
+#endif
 
 #include "fnmatch.h"
Index: gtk/gtkmain.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmain.c,v
retrieving revision 1.177
diff -u -2 -r1.177 gtkmain.c
--- gtk/gtkmain.c	2001/10/03 19:48:55	1.177
+++ gtk/gtkmain.c	2001/10/09 23:58:17
@@ -40,4 +40,9 @@
 #include <unistd.h>
 #endif
+#ifdef G_OS_WIN32
+#define STRICT
+#include <windows.h>
+#undef STRICT
+#endif
 
 #include <pango/pango-utils.h>	/* For pango_split_file_list */
@@ -225,4 +230,57 @@
 }
 
+#ifdef G_OS_WIN32
+
+/* DllMain function needed to tuck away the DLL name */
+
+char _gtk_win32_dll_name[MAX_PATH];
+
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL,
+	 DWORD     fdwReason,
+	 LPVOID    lpvReserved)
+{
+  switch (fdwReason)
+    {
+    case DLL_PROCESS_ATTACH:
+      GetModuleFileName ((HMODULE) hinstDLL,
+			 _gtk_win32_dll_name,
+			 sizeof (_gtk_win32_dll_name));
+      break;
+    }
+
+  return TRUE;
+}
+
+static const gchar *
+gtk_win32_libdir (void)
+{
+  static char *gtk_libdir = NULL;
+  if (gtk_libdir == NULL)
+    gtk_libdir = g_win32_get_package_installation_subdirectory
+      (GETTEXT_PACKAGE, _gtk_win32_dll_name, "lib");
+
+  return gtk_libdir;
+}
+
+static const gchar *
+gtk_win32_localedir (void)
+{
+  static char *gtk_localedir = NULL;
+  if (gtk_localedir == NULL)
+    gtk_localedir = g_win32_get_package_installation_subdirectory
+      (GETTEXT_PACKAGE, _gtk_win32_dll_name, "lib\\locale");
+
+  return gtk_localedir;
+}
+
+#undef GTK_LIBDIR
+#define GTK_LIBDIR gtk_win32_libdir()
+
+#undef GTK_LOCALEDIR
+#define GTK_LOCALEDIR gtk_win32_localedir()
+
+#endif
+
 static gchar **
 get_module_path (void)
@@ -236,11 +294,6 @@
     default_dir = g_build_filename (exe_prefix, "lib", "gtk-2.0", "modules", NULL);
   else
-    {
-#ifndef G_OS_WIN32
-      default_dir = g_build_filename (GTK_LIBDIR, "gtk-2.0", "modules", NULL);
-#else
-      default_dir = g_build_filename (get_gtk_win32_directory (""), "modules", NULL);
-#endif
-    }
+    default_dir = g_build_filename (GTK_LIBDIR, "gtk-2.0", "modules", NULL);
+
   module_path = g_strconcat (module_path ? module_path : "",
 			     module_path ? G_SEARCHPATH_SEPARATOR_S : "",
@@ -523,17 +576,8 @@
 
 #ifdef ENABLE_NLS
-#  ifndef G_OS_WIN32
   bindtextdomain (GETTEXT_PACKAGE, GTK_LOCALEDIR);
 #    ifdef HAVE_BIND_TEXTDOMAIN_CODESET
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 #    endif
-#  else /* !G_OS_WIN32 */
-  {
-    bindtextdomain (GETTEXT_PACKAGE,
-		    g_win32_get_package_installation_subdirectory (GETTEXT_PACKAGE,
-								   g_strdup_printf ("gtk-win32-%d.%d.dll", GTK_MAJOR_VERSION, GTK_MINOR_VERSION),
-								   "locale"));
-  }
-#endif
 #endif  
 
Index: gtk/gtkrc.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkrc.c,v
retrieving revision 1.94
diff -u -2 -r1.94 gtkrc.c
--- gtk/gtkrc.c	2001/10/01 20:35:02	1.94
+++ gtk/gtkrc.c	2001/10/09 23:58:19
@@ -297,20 +297,51 @@
 
 #ifdef G_OS_WIN32
-gchar *
-get_gtk_win32_directory (gchar *subdir)
+
+/* No hardcoded pathnames, please. */
+
+extern char _gtk_win32_dll_name[];
+
+static const gchar *
+gtk_win32_libdir (void)
 {
-  static gchar *gtk_dll = NULL;
+  static char *gtk_libdir = NULL;
+  if (gtk_libdir == NULL)
+    gtk_libdir = g_win32_get_package_installation_subdirectory
+      (GETTEXT_PACKAGE, _gtk_win32_dll_name, "lib");
 
-  if (!gtk_dll)
-    gtk_dll = g_strdup_printf ("gtk-win32-%d.%d.dll", GTK_MAJOR_VERSION, GTK_MINOR_VERSION);
+  return gtk_libdir;
+}
 
-  if (subdir && strlen(subdir) > 0)
-    return g_win32_get_package_installation_subdirectory (GETTEXT_PACKAGE,
-							                gtk_dll,
-							                subdir);
-  else
-    return g_win32_get_package_installation_directory (GETTEXT_PACKAGE,
-							             gtk_dll);
+static const gchar *
+gtk_win32_sysconfdir (void)
+{
+  static char *gtk_sysconfdir = NULL;
+  if (gtk_sysconfdir == NULL)
+    gtk_sysconfdir = g_win32_get_package_installation_subdirectory
+      (GETTEXT_PACKAGE, _gtk_win32_dll_name, "etc");
+
+  return gtk_sysconfdir;
 }
+
+static const gchar *
+gtk_win32_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, _gtk_win32_dll_name);
+
+  return gtk_data_prefix;
+}
+
+#undef GTK_LIBDIR
+#define GTK_LIBDIR gtk_win32_libdir()
+
+#undef GTK_SYSCONFDIR
+#define GTK_SYSCONFDIR gtk_win32_sysconfdir()
+
+#undef GTK_DATA_PREFIX
+#define GTK_DATA_PREFIX gtk_win32_data_prefix()
+
 #endif /* G_OS_WIN32 */
  
@@ -320,5 +351,4 @@
   gchar *var, *path;
 
-#ifndef G_OS_WIN32
   var = getenv("GTK_EXE_PREFIX");
   if (var)
@@ -326,7 +356,4 @@
   else
     path = g_build_filename (GTK_LIBDIR, "gtk-2.0,", type, GTK_BINARY_VERSION, NULL);
-#else
-  path = g_build_filename (get_gtk_win32_directory (""), type, NULL);
-#endif
 
   return path;
@@ -359,9 +386,5 @@
 	result = g_strdup (im_module_file);
       else
-#ifndef G_OS_WIN32
 	result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtk.immodules", NULL);
-#else
-	result = g_build_filename (get_gtk_win32_directory ("gtk-2.0"), "gtk.immodules", NULL);
-#endif
     }
 
@@ -374,5 +397,4 @@
   gchar *var, *path;
 
-#ifndef G_OS_WIN32
   var = getenv("GTK_DATA_PREFIX");
   if (var)
@@ -380,7 +402,4 @@
   else
     path = g_build_filename (GTK_DATA_PREFIX, "share", "themes", NULL);
-#else
-  path = g_build_filename (get_gtk_win32_directory (""), "themes", NULL);
-#endif
 
   return path;
@@ -404,5 +423,4 @@
     return;
   
-#ifndef G_OS_WIN32
   var = getenv("GTK_EXE_PREFIX");
   if (var)
@@ -410,7 +428,4 @@
   else
     path = g_build_filename (GTK_LIBDIR, "gtk-2.0", GTK_VERSION, "engines", NULL);
-#else
-  path = g_build_filename (get_gtk_win32_directory ("gtk-2.0"), GTK_VERSION, "engines", NULL);
-#endif
   module_path[n++] = path;
 
@@ -453,9 +468,5 @@
   else
     {
-#ifndef G_OS_WIN32
       str = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtkrc", NULL);
-#else
-      str = g_build_filename (get_gtk_win32_directory (""), "gtkrc", NULL);
-#endif
 
       gtk_rc_add_default_file (str);
Index: gtk/maketypes.awk
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/maketypes.awk,v
retrieving revision 1.8
diff -u -2 -r1.8 maketypes.awk
--- gtk/maketypes.awk	2001/09/19 20:07:05	1.8
+++ gtk/maketypes.awk	2001/10/09 23:58:20
@@ -84,5 +84,5 @@
   if (gen_vars)
     {
-      printf ("GtkType %s = 0;\n", type_macro);
+      printf ("GTKTYPEBUILTINS_VAR GtkType %s = 0;\n", type_macro);
     }
 }






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