Improve the support to use built-but-not-installed-yet gtk



Dear Sirs,

Recently I'm trying to build cairo and gtk+ related
libraries before installation, inspired by the post
by Travis Griggs:
  http://lists.cairographics.org/archives/cairo/2009-September/018204.html

GLib and Gtk+ include "uninstalled" pkg-config files
that we can use built-but-not-installed-yet binaries
via autotools. The configure using AM_PATH_GLIB_2_0()
and AM_PATH_GTK_2_0() instead of raw PKG_CHECK_MODULES()
is easy to find the uninstalled libraries.

However, the structure of the header file locations
of Gtk+ is slightly different between uninstalled
source tree and installed tree. For example, taking
Gtk+ configured for X11 backend, the structure of
properly installed header files is:

  ${prefix}/include/gtk-2.0/gdk/*.h
  ${prefix}/include/gtk-2.0/gdk-pixbuf/*.h
  ${prefix}/include/gtk-2.0/gdk-pixbuf-xlib/*.h
  ${prefix}/include/gtk-2.0/gtk/*.h

On the other hand, the structure of uninstalled header
files in working directory is:

  gtk+-2.x.y/gdk/*.h
  gtk+-2.x.y/gdk/x11/gdkx.h
  gtk+-2.x.y/gdk-pixbuf/*.h
  gtk+-2.x.y/contrib/gdk-pixbuf-xlib/*.h
  gtk+-2.x.y/gtk/*.h

But, the CFLAGS obtained by uninstalled pkg-config
files will be

  gdk-2.0-uninstalled.pc
    -I${pc_top_builddir}/${pcfiledir}/../gtk+-2.x.y/gdk  \
    -I${pc_top_builddir}/${pcfiledir}/../gtk+-2.x.y      \
    -I${pc_top_builddir}/${pcfiledir}

  gdk-pixbuf-2.0-uninstalled.pc
    -I${pc_top_builddir}/${pcfiledir}/../gtk+-2.x.y      \
    -I${pc_top_builddir}/${pcfiledir}

so it does not cover all header file locations. More
directories (e.g. contrib/gdk-pixbuf-xlib) should be added.
But, adding the directories is not sufficient. Gtk+ client
source file with "#include <gdk/gdkx.h>" cannot be preprocessed
correctly. It's easy to preprocess "#include <gdkx.h>",
but the appropriate directory for "#include <gdk/gdkx.h>"
does not exit in building directory.

I tried to make a symlink from backend-dependent public
header file (in this case, gdkx.h) from gtk+-2.x.y/gdk/x11
to backend-independent directory gtk+-2.x.y/gdk.
Following is a patch to do such.

===========================================================
diff --git a/gdk/Makefile.am b/gdk/Makefile.am
index 9dc9d6e..3564da0 100644
--- a/gdk/Makefile.am
+++ b/gdk/Makefile.am
@@ -230,6 +230,24 @@ EXTRA_DIST += $(gdk_built_sources)
 EXTRA_HEADERS =
 
 #
+# Rule to copy libgdkinclude_HEADERS from subdirectories
+#
+.PHONY: setup-pc-uninstalled-headers clean-pc-uninstalled-headers
+setup-pc-uninstalled-headers:
+	for h in `$(MAKE) --silent -C $(gdktarget) dump_libgdkinclude_HEADERS` ; do \
+	  if test -r $(srcdir)/$(gdktarget)/$$h ; then \
+	    $(LN_S) $(srcdir)/$(gdktarget)/$$h . ; \
+	  fi ; \
+	done
+
+clean-pc-uninstalled-headers:
+	for h in `$(MAKE) --silent -C $(gdktarget) dump_libgdkinclude_HEADERS` ; do \
+	  rm -f $$h ; \
+	done
+
+clean-recursive: clean-pc-uninstalled-headers
+
+#
 # Rule to install gdkconfig.h header file
 #
 configexecincludedir = $(libdir)/gtk-2.0/include
@@ -248,6 +266,7 @@ endif
 
 #note: not gdkconfig.h
 BUILT_SOURCES = \
+	setup-pc-uninstalled-headers		\
 	$(gdk_built_sources)			\
 	gdkconfig.h
 
diff --git a/gdk/directfb/Makefile.am b/gdk/directfb/Makefile.am
index 867f470..8b32be4 100644
--- a/gdk/directfb/Makefile.am
+++ b/gdk/directfb/Makefile.am
@@ -54,6 +54,8 @@ libgdkinclude_HEADERS =		\
 	gdkdirectfb.h 		\
 	gdkprivate-directfb.h
 
+dump_libgdkinclude_HEADERS:
+	@echo $(libgdkinclude_HEADERS)
 
 EXTRA_DIST += AUTHORS README TODO 
 
diff --git a/gdk/quartz/Makefile.am b/gdk/quartz/Makefile.am
index 2c3e621..7b48cef 100644
--- a/gdk/quartz/Makefile.am
+++ b/gdk/quartz/Makefile.am
@@ -57,5 +57,8 @@ libgdk_quartz_la_SOURCES =    	\
 libgdkinclude_HEADERS = 	\
 	gdkquartz.h
 
+dump_libgdkinclude_HEADERS:
+	@echo $(libgdkinclude_HEADERS)
+
 
 -include $(top_srcdir)/git.mk
diff --git a/gdk/win32/Makefile.am b/gdk/win32/Makefile.am
index 17d048e..b8d9eda 100644
--- a/gdk/win32/Makefile.am
+++ b/gdk/win32/Makefile.am
@@ -64,4 +64,7 @@ libgdk_win32_la_SOURCES = \
 libgdkinclude_HEADERS =		\
 	gdkwin32.h
 
+dump_libgdkinclude_HEADERS:
+	@echo $(libgdkinclude_HEADERS)
+
 -include $(top_srcdir)/git.mk
diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am
index 5d41ec8..8bd74db 100644
--- a/gdk/x11/Makefile.am
+++ b/gdk/x11/Makefile.am
@@ -69,6 +69,8 @@ endif
 libgdkinclude_HEADERS = 	\
 	gdkx.h
 
+dump_libgdkinclude_HEADERS:
+	@echo $(libgdkinclude_HEADERS)
 
 noinst_PROGRAMS = checksettings
 checksettings_LDADD = libgdk-x11.la $(GLIB_LIBS) $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la 
===========================================================

However, it's ugly to execute make in subdirectory to obtain
the public header file list in the directory (this is because
I didn't want to keep the consistency of the list of public
header file in gdk/Makefile.am and gdk/x11/Makefile.am).
Anybody has good idea to solve "#include <gdk/gdkx.h>" issue?

Regards,
mpsuzuki


P.S.

Followings are extra improvement.

==========================================================================
* Generate uninstalled pkg-config files for backend-dependent target.

Most uninstalled pkg-config files are generated by configure script,
but backend-dependent pkg-config files are generated during the
building.

diff --git a/Makefile.am b/Makefile.am
index 38f245b..c75dd44 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -160,6 +160,7 @@ gdk-$(GDKTARGET)-2.0-uninstalled.pc: gdk-2.0-uninstalled.pc
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA= gdk-pixbuf-2.0.pc gdk-$(GDKTARGET)-2.0.pc gtk+-$(GDKTARGET)-2.0.pc gail.pc
+noinst_DATA = gdk-$(GDKTARGET)-2.0-uninstalled.pc gtk+-$(GDKTARGET)-2.0-uninstalled.pc
 
 if OS_UNIX
 pkgconfig_DATA += gtk+-unix-print-2.0.pc

==========================================================================
* Put gtktypebuiltins.h in the dependency chain.

Yet I've not checked in detail, gtktypebuiltins.h is slipped to
built by implicit rules when building Gtk+ with uninstalled
GLib/Atk/Pango.

diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 62d5352..b0dca59 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -863,7 +863,7 @@ gtktypebuiltins.c: @REBUILD@ $(gtk_public_h_sources) gtktypebuiltins.c.template
 	&& cp xgen-gtbc gtktypebuiltins.c  \
 	&& rm -f xgen-gtbc
 
-gtktypefuncs.c: @REBUILD@ $(top_srcdir)/gtk/*.h $(top_srcdir)/gdk/*.h Makefile
+gtktypefuncs.c: @REBUILD@ $(top_srcdir)/gtk/*.h $(top_srcdir)/gdk/*.h Makefile gtktypebuiltins.h
 	echo '#include <gtk/gtk.h>' > xgen-gtfsrc.c && \
 	  ${CPP} $(DEFS) $(INCLUDES) -DGTK_ENABLE_BROKEN $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) xgen-gtfsrc.c | \
 	  grep -o '\bg[td]k_[a-zA-Z0-9_]*_get_type\b' | \


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