From: Duncan C. <dun...@us...> - 2005-11-07 12:27:39
|
Update of /cvsroot/gtk2hs/gtk2hs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20673 Modified Files: ChangeLog configure.ac Makefile.am Log Message: Add experimental support for GHC's -split-objs feature. This considerably reduces the size of executables that use Gtk2Hs. The helloworld program shrinks from 2.7M to 250k (where as a simple console helloworld is 190k). However it only works on some platforms and it requires a more complex build system: configure.ac: add --enable-split-objs option (off by default). Substitute into mk/link-splitobjs.sh script and make it executable. mk/common.mk: add a slightly different .hs -> .o build rule when using -split-objs Makefile.am: add -split-objs to the HCFLAGS of the libs and set mk/link-splitobjs.sh as the linker command when we configure using --enable-split-objs. mk/link-splitobjs.sh.in: linker script to use when in --enable-split-objs mode. Index: configure.ac =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/configure.ac,v retrieving revision 1.71 retrieving revision 1.72 diff -u -d -r1.71 -r1.72 --- configure.ac 6 Nov 2005 20:46:10 -0000 1.71 +++ configure.ac 7 Nov 2005 12:27:31 -0000 1.72 @@ -194,6 +194,12 @@ HCFLAGS="$HCFLAGS -DWIN32" fi +AC_ARG_ENABLE(split-objs, + [ --enable-split-objs produce smaller executables (on supported platforms)], + [ENABLE_SPLITOBJS=$enableval],[ENABLE_SPLITOBJS=no]) +AC_MSG_RESULT($ENABLE_SPLITOBJS) +AM_CONDITIONAL(ENABLE_SPLITOBJS, test "$ENABLE_SPLITOBJS" = "yes") + dnl packager mode is for people building packages, eg for linux distros. dnl in packager mode you do not get any optional dependancies unless you dnl explicitly ask for them with --enable-PACKAGE @@ -739,6 +745,7 @@ tools/c2hs/toplevel/C2HSConfig.hs gtk2hs.spec mk/chsDepend + mk/link-splitobjs.sh docs/prologue.txt glib/glib.pkg @@ -773,7 +780,7 @@ cairo/cairo.package.conf cairo/cairo.cabal ], - [chmod a+x mk/chsDepend && chmod a+x install-sh]) + [chmod a+x mk/chsDepend mk/link-splitobjs.sh install-sh]) dnl ...and chat with the user echo "**************************************************" Index: Makefile.am =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/Makefile.am,v retrieving revision 1.119 retrieving revision 1.120 diff -u -d -r1.119 -r1.120 --- Makefile.am 30 Oct 2005 15:20:29 -0000 1.119 +++ Makefile.am 7 Nov 2005 12:27:31 -0000 1.120 @@ -317,6 +317,13 @@ -include $(libHSglib_a_CHSFILES:.chs=.dep) glib/libHSglib_a.deps endif +if ENABLE_SPLITOBJS +libHSglib_a_HCFLAGS += -split-objs +libHSglib_a_AR = $(srcdir)/mk/link-splitobjs.sh +else +libHSglib_a_AR = $(AR) $(ARFLAGS) +endif + # # gtk package # @@ -617,6 +624,13 @@ -include $(libHSgtk_a_CHSFILES_HS:.hs=.dep) gtk/libHSgtk_a.deps endif +if ENABLE_SPLITOBJS +libHSgtk_a_HCFLAGS += -split-objs +libHSgtk_a_AR = $(srcdir)/mk/link-splitobjs.sh +else +libHSgtk_a_AR = $(AR) $(ARFLAGS) +endif + # # mogul package # @@ -664,6 +678,13 @@ -include mogul/libHSmogul_a.deps endif +if ENABLE_SPLITOBJS +libHSmogul_a_HCFLAGS += -split-objs +libHSmogul_a_AR = $(srcdir)/mk/link-splitobjs.sh +else +libHSmogul_a_AR = $(AR) $(ARFLAGS) +endif + # # glade package # @@ -744,6 +765,13 @@ -include $(libHSglade_a_CHSFILES:.chs=.dep) glade/libHSglade_a.deps endif +if ENABLE_SPLITOBJS +libHSglade_a_HCFLAGS += -split-objs +libHSglade_a_AR = $(srcdir)/mk/link-splitobjs.sh +else +libHSglade_a_AR = $(AR) $(ARFLAGS) +endif + endif #ENABLE_LIBGLADE # @@ -848,6 +876,13 @@ -include $(libHSgconf_a_CHSFILES:.chs=.dep) gconf/libHSgconf_a.deps endif +if ENABLE_SPLITOBJS +libHSgconf_a_HCFLAGS += -split-objs +libHSgconf_a_AR = $(srcdir)/mk/link-splitobjs.sh +else +libHSgconf_a_AR = $(AR) $(ARFLAGS) +endif + endif #ENABLE_GCONF # @@ -941,6 +976,13 @@ -include $(libHSsourceview_a_CHSFILES:.chs=.dep) sourceview/libHSsourceview_a.deps endif +if ENABLE_SPLITOBJS +libHSsourceview_a_HCFLAGS += -split-objs +libHSsourceview_a_AR = $(srcdir)/mk/link-splitobjs.sh +else +libHSsourceview_a_AR = $(AR) $(ARFLAGS) +endif + endif #ENABLE_SOURCEVIEW # @@ -1022,6 +1064,13 @@ -include $(libHSmozembed_a_CHSFILES:.chs=.dep) mozembed/libHSmozembed_a.deps endif +if ENABLE_SPLITOBJS +libHSmozembed_a_HCFLAGS += -split-objs +libHSmozembed_a_AR = $(srcdir)/mk/link-splitobjs.sh +else +libHSmozembed_a_AR = $(AR) $(ARFLAGS) +endif + endif #ENABLE_MOZEMBED # @@ -1119,6 +1168,13 @@ -include $(libHScairo_a_CHSFILES:.chs=.dep) cairo/libHScairo_a.deps endif +if ENABLE_SPLITOBJS +libHScairo_a_HCFLAGS += -split-objs +libHScairo_a_AR = $(srcdir)/mk/link-splitobjs.sh +else +libHScairo_a_AR = $(AR) $(ARFLAGS) +endif + endif #ENABLE_CAIRO # Index: ChangeLog =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/ChangeLog,v retrieving revision 1.700 retrieving revision 1.701 diff -u -d -r1.700 -r1.701 --- ChangeLog 7 Nov 2005 11:33:39 -0000 1.700 +++ ChangeLog 7 Nov 2005 12:27:31 -0000 1.701 @@ -10,6 +10,19 @@ * TODO: remove some completed and old todo items. + * configure.ac: add --enable-split-objs option (off by default). + Substitute into mk/link-splitobjs.sh script and make it executable. + + * mk/common.mk: add a slightly different .hs -> .o build rule when + using -split-objs + + * Makefile.am: add -split-objs to the HCFLAGS of the libs and set + mk/link-splitobjs.sh as the linker command when we configure using + --enable-split-objs. + + * mk/link-splitobjs.sh.in: linker script to use when in + --enable-split-objs mode. + 2005-11-06 Axel Simon <A....@ke...> * configure.ac, gtk/gtk.pkg: Make compile with ghc 6.2 (no cabal) |