Applied patch #6515 : Allow dlls to be built on w32 platforms
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 20 May 2008 14:01:09 +0000 (14:01 +0000)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 20 May 2008 14:01:09 +0000 (14:01 +0000)
configure.ac
src/ui/gui/ChangeLog
src/ui/gui/automake.mk
src/ui/gui/psppire-keypad.c

index fafa7ccd50068efba0dfef4546db11e9c0bc9fce..8f3c96c4dd8b8b5d9e3707874aa4527c7aaedddc 100644 (file)
@@ -11,6 +11,7 @@ AC_GNU_SOURCE
 AC_PROG_CC
 gl_EARLY
 AM_PROG_CC_C_O
+AC_LIBTOOL_WIN32_DLL
 AC_LIBTOOL_DLOPEN
 AC_PROG_LIBTOOL
 PKG_PROG_PKG_CONFIG
index 3cc945cc53f9855a4d1a9158c84cda43b178c420..88a42f1ffa5e6a192938dae1154a3811d3ba7080 100644 (file)
@@ -1,3 +1,13 @@
+2008-05-20  John Darrington <john@darrington.wattle.id.au>
+
+       * automake.mk: Added the -no-undefined flag so that dlls can be built
+       on w32 platforms.  Abstracted the dependencies of glade-register.c
+       into a new shared library libpsppwidgets.so, which can be either
+       linked directly by psppire or by libpsppire.so
+
+       * psppire-keypad.c: Changed snprintf to g_snprintf so as not to use
+       gnulib.
+
 2008-05-15  Ben Pfaff  <blp@gnu.org>
 
        * automake.mk: Rename install-data-hook to yelp-check and mark it
index a405e87a61f27bbe510eb5f13c65b33d1c2a3b6c..651f5905ee818bfbc50b5f4f97b130b7eb27658d 100644 (file)
@@ -1,7 +1,5 @@
 ## Process this file with automake to produce Makefile.in  -*- makefile -*-
 
-
-
 bin_PROGRAMS += src/ui/gui/psppire 
 
 src_ui_gui_psppire_CFLAGS = $(GTK_CFLAGS) $(GLADE_CFLAGS) -Wall \
@@ -9,8 +7,8 @@ src_ui_gui_psppire_CFLAGS = $(GTK_CFLAGS) $(GLADE_CFLAGS) -Wall \
 
 
 src_ui_gui_psppire_LDFLAGS = \
-       $(PG_LDFLAGS) \
-       -export-dynamic
+       $(PG_LDFLAGS)
+
 
 
 if RELOCATABLE_VIA_LD
@@ -20,15 +18,40 @@ src_ui_gui_psppire_LDFLAGS += -rpath $(pkglibdir)
 endif
 
 
-pkglib_LTLIBRARIES = src/ui/gui/libpsppire.la
+# The library libpsppire contains a single function to register our custom widgets with libglade.
+# This library is dynamically loaded by libglade.   On w32 platforms, dynamic libraries simply 
+# can't be created unless all of the symbols can be resolved at link time.  Thus, all the custom 
+# widgets have to be available.  
+# But they can't appear in the library AND the binary, otherwise glib complains about them already
+# existing (and its a waste of space).  So we have a seperate shared library (statically loaded) 
+# libpsppwidgets which contains our custom widgets.
+
+pkglib_LTLIBRARIES = src/ui/gui/libpsppwidgets.la src/ui/gui/libpsppire.la 
+
+src_ui_gui_libpsppwidgets_la_CFLAGS = $(GTK_CFLAGS)
+src_ui_gui_libpsppwidgets_la_LDFLAGS = -no-undefined
+src_ui_gui_libpsppwidgets_la_LIBADD = $(GTK_LIBS)
+
+src_ui_gui_libpsppwidgets_la_SOURCES = \
+       src/ui/gui/psppire-dialog.c \
+       src/ui/gui/psppire-keypad.c \
+       src/ui/gui/psppire-selector.c \
+       src/ui/gui/psppire-buttonbox.c \
+       src/ui/gui/psppire-hbuttonbox.c \
+       src/ui/gui/psppire-vbuttonbox.c \
+       src/ui/gui/psppire-acr.c 
+
 
 src_ui_gui_libpsppire_la_CFLAGS = $(GLADE_CFLAGS) 
+src_ui_gui_libpsppire_la_LDFLAGS = -no-undefined
+src_ui_gui_libpsppire_la_LIBADD = $(GLADE_LIBS) src/ui/gui/libpsppwidgets.la
 
 src_ui_gui_libpsppire_la_SOURCES = \
        src/ui/gui/glade-register.c
 
 src_ui_gui_psppire_LDADD = \
        -dlopen src/ui/gui/libpsppire.la \
+       src/ui/gui/libpsppwidgets.la \
        lib/gtksheet/libgtksheet.a \
        src/language/liblanguage.a \
        src/ui/libuicommon.a \
@@ -124,13 +147,9 @@ src_ui_gui_psppire_SOURCES = \
         src/ui/gui/oneway-anova-dialog.h \
        src/ui/gui/output-viewer.c \
        src/ui/gui/output-viewer.h \
-       src/ui/gui/psppire-acr.c \
        src/ui/gui/psppire-acr.h \
-       src/ui/gui/psppire-buttonbox.c \
        src/ui/gui/psppire-buttonbox.h \
-       src/ui/gui/psppire-hbuttonbox.c \
        src/ui/gui/psppire-hbuttonbox.h \
-       src/ui/gui/psppire-vbuttonbox.c \
        src/ui/gui/psppire-vbuttonbox.h \
        src/ui/gui/psppire-case-file.c \
        src/ui/gui/psppire-case-file.h \
@@ -138,13 +157,10 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/psppire-data-editor.h \
        src/ui/gui/psppire-data-store.c \
        src/ui/gui/psppire-data-store.h \
-       src/ui/gui/psppire-dialog.c \
        src/ui/gui/psppire-dialog.h \
        src/ui/gui/psppire-dict.c \
        src/ui/gui/psppire-dict.h \
-       src/ui/gui/psppire-keypad.c \
        src/ui/gui/psppire-keypad.h \
-       src/ui/gui/psppire-selector.c \
        src/ui/gui/psppire-selector.h \
        src/ui/gui/psppire-var-ptr.c \
        src/ui/gui/psppire-var-ptr.h \
index 19b8cabf4ebee05b24ef8fe82041120da35d3e8a..23ddccb550aa1c5648c0099f93f8ce8612028883 100644 (file)
@@ -339,7 +339,7 @@ psppire_keypad_init (PsppireKeypad *kp)
     {
       int j = i - 1;
       char buf[5];
-      snprintf (buf, 5, "%d", i);
+      g_snprintf (buf, 5, "%d", i);
       kp->digit[i] = gtk_button_new_with_label (buf);
 
       if ( i == 0 )