gdk-pixbuf selected loader included patch.



After spending 2 days in the trenches fighting a bloody war with automake
i can finally present a patch which lets you select what gdk-pixbuf
loaders to compile into gdk-pixbuf when --disable-modules is used.

This is of great importance for small statically linked programs using
gdk-pixbuf.

Can i check this in?

/ Alex

Index: configure.in
===================================================================
RCS file: /cvs/gnome/gtk+/configure.in,v
retrieving revision 1.190
diff -u -p -r1.190 configure.in
--- configure.in	2001/01/03 10:53:14	1.190
+++ configure.in	2001/01/04 17:15:11
@@ -879,6 +879,40 @@ AC_SUBST(LIBPNG)

 AM_CONDITIONAL(BUILD_DYNAMIC_MODULES, $dynworks)

+#
+# Allow building some or all gdk-pixbuf loaders included
+#
+AC_MSG_CHECKING(pixbuf loaders to build)
+
+AC_ARG_WITH(included_loaders, [ --with-included-loaders=LOADER1,LOADER2,... Build the specified loaders into gdk-pixbuf (only used if module loading disabled)])
+
+all_loaders="png,bmp,wbmp,gif,ico,jpeg,pnm,ras,tiff,xpm"
+included_loaders=""
+# If no loaders specified, include all
+if test "x$with_included_loaders" = x ; then
+  included_loaders="$all_loaders"
+else
+  included_loaders="$with_included_loaders"
+fi
+
+AC_MSG_RESULT($included_loaders)
+
+INCLUDED_LOADER_OBJ=
+INCLUDED_LOADER_DEFINE=
+
+IFS="${IFS= 	}"; gtk_save_ifs="$IFS"; IFS=","
+for loader in $included_loaders; do
+ if ! echo "$all_loaders" | grep "\(^\|\,\)$loader\(\$\|\,\)" > /dev/null; then
+   AC_MSG_ERROR([the specified loader $loader does not exist])
+ fi
+
+ INCLUDED_LOADER_OBJ="$INCLUDED_LOADER_OBJ libpixbufloader-static-$loader.la"
+ INCLUDED_LOADER_DEFINE="$INCLUDED_LOADER_DEFINE -DINCLUDE_$loader"
+done
+IFS="$gtk_save_ifs"
+AC_SUBST(INCLUDED_LOADER_OBJ)
+AC_SUBST(INCLUDED_LOADER_DEFINE)
+
 AC_HEADER_STDC
 AC_HEADER_DIRENT
 AC_HEADER_SYS_WAIT
Index: gdk-pixbuf/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/Makefile.am,v
retrieving revision 1.80
diff -u -p -r1.80 Makefile.am
--- gdk-pixbuf/Makefile.am	2001/01/02 16:15:34	1.80
+++ gdk-pixbuf/Makefile.am	2001/01/04 17:15:11
@@ -11,10 +11,12 @@ loaderdir = $(libdir)/gtk-2.0/$(GTK_VERS
 libpixbufloader_png_la_SOURCES = io-png.c
 libpixbufloader_png_la_LDFLAGS = -avoid-version -module
 libpixbufloader_png_la_LIBADD = $(LIBPNG)
+libpixbufloader_static_png_la_SOURCES = io-png.c

 #
 # The JPEG loader
 #
+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_LIBADD = $(LIBJPEG)
@@ -22,6 +24,7 @@ libpixbufloader_jpeg_la_LIBADD = $(LIBJP
 #
 # The XPM loader
 #
+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_LIBADD =
@@ -29,6 +32,7 @@ libpixbufloader_xpm_la_LIBADD =
 #
 # The GIF loader
 #
+libpixbufloader_static_gif_la_SOURCES = io-gif.c
 libpixbufloader_gif_la_SOURCES = io-gif.c
 libpixbufloader_gif_la_LDFLAGS = -avoid-version -module
 libpixbufloader_gif_la_LIBADD =
@@ -36,6 +40,7 @@ libpixbufloader_gif_la_LIBADD =
 #
 # The ICO loader
 #
+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_LIBADD =
@@ -43,6 +48,7 @@ libpixbufloader_ico_la_LIBADD =
 #
 # The RAS loader
 #
+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_LIBADD =
@@ -50,6 +56,7 @@ libpixbufloader_ras_la_LIBADD =
 #
 # The TIFF loader
 #
+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_LIBADD = $(LIBTIFF)
@@ -57,6 +64,7 @@ libpixbufloader_tiff_la_LIBADD = $(LIBTI
 #
 # The PNM loader
 #
+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_LIBADD =
@@ -64,6 +72,7 @@ libpixbufloader_pnm_la_LIBADD =
 #
 # The BMP loader
 #
+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_LIBADD =
@@ -71,6 +80,7 @@ libpixbufloader_bmp_la_LIBADD =
 #
 # The WBMP loader
 #
+libpixbufloader_static_wbmp_la_SOURCES = io-wbmp.c
 libpixbufloader_wbmp_la_SOURCES = io-wbmp.c
 libpixbufloader_wbmp_la_LDFLAGS = -avoid-version -module

@@ -116,22 +126,26 @@ loader_LTLIBRARIES = 	\


 extra_sources =
-
+builtin_objs =
 else
 loader_LTLIBRARIES =
+
+noinst_LTLIBRARIES =  	\
+	libpixbufloader-static-png.la \
+	libpixbufloader-static-jpeg.la \
+	libpixbufloader-static-gif.la  \
+	libpixbufloader-static-ico.la  \
+	libpixbufloader-static-ras.la  \
+	libpixbufloader-static-tiff.la \
+	libpixbufloader-static-xpm.la  \
+	libpixbufloader-static-pnm.la  \
+	libpixbufloader-static-bmp.la  \
+	libpixbufloader-static-wbmp.la
+
+builtin_objs = @INCLUDED_LOADER_OBJ@

-extra_sources = $(libpixbufloader_png_la_SOURCES) 	\
-		$(libpixbufloader_jpeg_la_SOURCES) 	\
-		$(libpixbufloader_xpm_la_SOURCES) 	\
-		$(libpixbufloader_gif_la_SOURCES) 	\
-		$(libpixbufloader_ico_la_SOURCES) 	\
-		$(libpixbufloader_ras_la_SOURCES) 	\
-		$(libpixbufloader_tiff_la_SOURCES) 	\
-		$(libpixbufloader_pnm_la_SOURCES) 	\
-		$(libpixbufloader_bmp_la_SOURCES)	\
-		$(libpixbufloader_wbmp_la_SOURCES)
+static_libs = $(STATIC_LIB_DEPS)

-builtin_libraries =
 endif

 noinst_PROGRAMS = test-gdk-pixbuf
@@ -141,6 +155,7 @@ DEPS = libgdk_pixbuf-1.3.la
 INCLUDES = -I$(top_srcdir) -I$(top_builddir) \
 	-I$(top_srcdir)/gdk-pixbuf \
 	-I$(top_builddir)/gdk-pixbuf \
+	@INCLUDED_LOADER_DEFINE@ \
 	$(GLIB_CFLAGS)
 AM_CPPFLAGS = "-DPIXBUF_LIBDIR=\"$(loaderdir)\""

@@ -169,14 +184,14 @@ libgdk_pixbuf_1_3_la_SOURCES = 	\
 	gdk-pixbuf-data.c	\
 	gdk-pixbuf-io.c		\
 	gdk-pixbuf-scale.c	\
-	gdk-pixbuf-util.c	\
-	$(extra_sources)
+	gdk-pixbuf-util.c

 libgdk_pixbuf_1_3_la_LDFLAGS = 				        \
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)    \
 	@LIBTOOL_EXPORT_OPTIONS@				\
 	$(GLIB_LIBS)
-libgdk_pixbuf_1_3_la_LIBADD = pixops/libpixops.la
+libgdk_pixbuf_1_3_la_LIBADD = pixops/libpixops.la $(builtin_objs) $(static_libs)
+libgdk_pixbuf_1_3_la_DEPENDENCIES = $(builtin_objs)

 libgdk_pixbufinclude_HEADERS =	\
 	gdk-pixbuf.h		\
Index: gdk-pixbuf/gdk-pixbuf-io.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/gdk-pixbuf-io.c,v
retrieving revision 1.49
diff -u -p -r1.49 gdk-pixbuf-io.c
--- gdk-pixbuf/gdk-pixbuf-io.c	2000/11/12 15:58:18	1.49
+++ gdk-pixbuf/gdk-pixbuf-io.c	2001/01/04 17:15:11
@@ -425,7 +425,8 @@ gdk_pixbuf_load_module (GdkPixbufModule
                         GError         **error)
 {
 	image_module->module = (void *) 1;
-
+
+#ifdef INCLUDE_png
 	if (strcmp (image_module->module_name, "png") == 0){
 		image_module->load           = mname (png,load);
 		image_module->begin_load     = mname (png,begin_load);
@@ -434,7 +435,9 @@ gdk_pixbuf_load_module (GdkPixbufModule
                 image_module->save           = mname (png,save);
 		return TRUE;
 	}
+#endif

+#ifdef INCLUDE_bmp
 	if (strcmp (image_module->module_name, "bmp") == 0){
 		image_module->load           = mname (bmp,load);
 		image_module->begin_load     = mname (bmp,begin_load);
@@ -442,7 +445,9 @@ gdk_pixbuf_load_module (GdkPixbufModule
 		image_module->stop_load      = mname (bmp,stop_load);
 		return TRUE;
 	}
+#endif

+#ifdef INCLUDE_wbmp
 	if (strcmp (image_module->module_name, "wbmp") == 0){
 		image_module->load           = mname (wbmp,load);
 		image_module->begin_load     = mname (wbmp,begin_load);
@@ -450,7 +455,9 @@ gdk_pixbuf_load_module (GdkPixbufModule
 		image_module->stop_load      = mname (wbmp,stop_load);
 		return TRUE;
 	}
+#endif

+#ifdef INCLUDE_gif
 	if (strcmp (image_module->module_name, "gif") == 0){
 		image_module->load           = mname (gif,load);
 		image_module->begin_load     = mname (gif,begin_load);
@@ -459,7 +466,9 @@ gdk_pixbuf_load_module (GdkPixbufModule
 		image_module->load_animation = mname (gif,load_animation);
 		return TRUE;
 	}
+#endif

+#ifdef INCLUDE_ico
 	if (strcmp (image_module->module_name, "ico") == 0){
 		image_module->load           = mname (ico,load);
 		image_module->begin_load     = mname (ico,begin_load);
@@ -467,7 +476,9 @@ gdk_pixbuf_load_module (GdkPixbufModule
 		image_module->stop_load      = mname (ico,stop_load);
 		return TRUE;
 	}
+#endif

+#ifdef INCLUDE_jpeg
 	if (strcmp (image_module->module_name, "jpeg") == 0){
 		image_module->load           = mname (jpeg,load);
 		image_module->begin_load     = mname (jpeg,begin_load);
@@ -476,6 +487,9 @@ gdk_pixbuf_load_module (GdkPixbufModule
                 image_module->save           = mname (jpeg,save);
 		return TRUE;
 	}
+#endif
+
+#ifdef INCLUDE_pnm
 	if (strcmp (image_module->module_name, "pnm") == 0){
 		image_module->load           = mname (pnm,load);
 		image_module->begin_load     = mname (pnm,begin_load);
@@ -483,6 +497,9 @@ gdk_pixbuf_load_module (GdkPixbufModule
 		image_module->stop_load      = mname (pnm,stop_load);
 		return TRUE;
 	}
+#endif
+
+#ifdef INCLUDE_ras
 	if (strcmp (image_module->module_name, "ras") == 0){
 		image_module->load           = mname (ras,load);
 		image_module->begin_load     = mname (ras,begin_load);
@@ -490,6 +507,9 @@ gdk_pixbuf_load_module (GdkPixbufModule
 		image_module->stop_load      = mname (ras,stop_load);
 		return TRUE;
 	}
+#endif
+
+#ifdef INCLUDE_tiff
 	if (strcmp (image_module->module_name, "tiff") == 0){
 		image_module->load           = mname (tiff,load);
 		image_module->begin_load     = mname (tiff,begin_load);
@@ -497,11 +517,15 @@ gdk_pixbuf_load_module (GdkPixbufModule
 		image_module->stop_load      = mname (tiff,stop_load);
 		return TRUE;
 	}
+#endif
+
+#ifdef INCLUDE_xpm
 	if (strcmp (image_module->module_name, "xpm") == 0){
 		image_module->load           = mname (xpm,load);
 		image_module->load_xpm_data  = mname (xpm,load_xpm_data);
 		return TRUE;
 	}
+#endif

         g_set_error (error,
                      GDK_PIXBUF_ERROR,






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