Build Problem

Marcus Brinkmann marcus.brinkmann at ruhr-uni-bochum.de
Fri Dec 1 12:55:54 CET 2006


Hi,

I checked in a change to GPGME to build all libraries directly from
the sources, instead of going through a static lib.  Automake is smart
enough to not build source files twice if the CFLAGS/CPPFLAGS are
identical, which we can achieve without too much trouble.

Can you please test the below patch, or, even better, SVN repository
revision 1192?

Thanks,
Marcus

2006-12-01  Marcus Brinkmann  <marcus at g10code.de>

        * Makefile.am (libgpgme_real_la_SOURCES): Rename to main_sources.
        (libgpgme_la_SOURCES, libgpgme_pthread_la_SOURCES,
        libgpgme_glib_la_SOURCES, libgpgme_pth_la_SOURCES): Add
        $(main_sources).
        (libgpgme_la_DEPENDENCIES, libgpgme_la_LIBADD,
        libgpgme_pthread_la_DEPENDENCIES, libgpgme_pthread_la_LIBADD,
        libgpgme_pth_la_DEPENDENCIES, libgpgme_pth_la_LIBADD,
        libgpgme_glib_la_DEPENDENCIES, libgpgme_glib_la_LIBADD): Remove
        libgpgme-real.la.
        (noinst_LTLIBRARIES): Removed.
        (libgpgme_glib_la_CFLAGS, libgpgme_pth_la_CFLAGS): Removed.
        (AM_CFLAGS): New variable.


Index: gpgme/Makefile.am
===================================================================
--- gpgme/Makefile.am	(revision 1191)
+++ gpgme/Makefile.am	(working copy)
@@ -45,7 +45,6 @@
 ltlib_gpgme_extra =
 endif
 
-noinst_LTLIBRARIES = libgpgme-real.la
 lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_extra) \
 	$(ltlib_gpgme_pthread) $(ltlib_gpgme_pth)
 
@@ -77,7 +76,12 @@
 gpgsm_components =
 endif
 
-libgpgme_real_la_SOURCES =						\
+# These are the source files common to all library versions.  We used
+# to build a non-installed library for that, but that does not work
+# correctly on all platforms (in particular, one can not specify the
+# right linking order with libtool, as the non-installed version has
+# unresolved symbols to the thread module.
+main_sources =								\
 	gpgme.h util.h conversion.c get-env.c context.h ops.h		\
 	data.h data.c data-fd.c data-stream.c data-mem.c data-user.c	\
 	data-compat.c							\
@@ -92,18 +96,22 @@
 	$(gpgsm_components) sema.h priv-io.h $(system_components)	\
 	debug.c debug.h gpgme.c version.c error.c
 
-libgpgme_la_SOURCES = ath.h ath.c $(system_components_not_extra)
-libgpgme_pthread_la_SOURCES = \
+libgpgme_la_SOURCES = $(main_sources)					\
+	ath.h ath.c $(system_components_not_extra) 
+libgpgme_pthread_la_SOURCES = $(main_sources)				\
 	ath.h ath-pthread.c $(system_components_not_extra)
-libgpgme_pth_la_SOURCES = ath.h ath-pth.c $(system_components_not_extra)
+libgpgme_pth_la_SOURCES = $(main_sources)				\
+	ath.h ath-pth.c $(system_components_not_extra)
 
 if BUILD_W32_GLIB
-libgpgme_glib_la_SOURCES = ath.h ath.c w32-glib-io.c
+libgpgme_glib_la_SOURCES = $(main_sources) ath.h ath.c w32-glib-io.c
 endif
 
-AM_CPPFLAGS = $(assuan_cppflags) @GPG_ERROR_CFLAGS@
+# We use a global CFLAGS and CPPFLAGS setting for all library
+# versions, because then every object file is only compiled once.
+AM_CPPFLAGS = $(assuan_cppflags) @GPG_ERROR_CFLAGS@ @PTH_CPPFLAGS@
+AM_CFLAGS = @PTH_CFLAGS@ @GLIB_CFLAGS@
 
-
 if HAVE_W32_SYSTEM
 
 LTRCCOMPILE = $(LIBTOOL) --mode=compile $(RC) \
@@ -141,36 +149,33 @@
 libgpgme_la_LDFLAGS = $(gpgme_res_ldflag) $(no_undefined) $(export_symbols) \
 	$(libgpgme_version_script_cmd) -version-info \
 	@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
-libgpgme_la_DEPENDENCIES = libgpgme-real.la $(assuan_libobjs) \
+libgpgme_la_DEPENDENCIES = $(assuan_libobjs) \
 	@LTLIBOBJS@ $(srcdir)/libgpgme.vers $(gpgme_deps)
-libgpgme_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \
+libgpgme_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \
 	@GPG_ERROR_LIBS@ @NETLIBS@
 
 libgpgme_pthread_la_LDFLAGS = $(libgpgme_version_script_cmd) -version-info \
 	@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
-libgpgme_pthread_la_DEPENDENCIES = libgpgme-real.la $(assuan_libobjs) \
+libgpgme_pthread_la_DEPENDENCIES = $(assuan_libobjs) \
 	@LTLIBOBJS@ $(srcdir)/libgpgme.vers
-libgpgme_pthread_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \
+libgpgme_pthread_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \
 	-lpthread @GPG_ERROR_LIBS@ @NETLIBS@
 
-libgpgme_pth_la_CFLAGS = $(AM_CFLAGS) @PTH_CFLAGS@
-libgpgme_pth_la_CPPFLAGS = $(AM_CPPFLAGS) @PTH_CPPFLAGS@
 libgpgme_pth_la_LDFLAGS = @PTH_LDFLAGS@ \
 	$(libgpgme_version_script_cmd) -version-info \
 	@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
-libgpgme_pth_la_DEPENDENCIES = libgpgme-real.la $(assuan_libobjs) \
+libgpgme_pth_la_DEPENDENCIES = $(assuan_libobjs) \
 	@LTLIBOBJS@ $(srcdir)/libgpgme.vers
-libgpgme_pth_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \
+libgpgme_pth_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \
 	@PTH_LIBS@ @GPG_ERROR_LIBS@ @NETLIBS@
 
 if BUILD_W32_GLIB
 libgpgme_glib_la_LDFLAGS = $(gpgme_res_ldflag) $(no_undefined) \
 	$(export_symbols) $(libgpgme_version_script_cmd) -version-info \
 	@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
-libgpgme_glib_la_CFLAGS = $(AM_CFLAGS) @GLIB_CFLAGS@
-libgpgme_glib_la_DEPENDENCIES = libgpgme-real.la $(assuan_libobjs) \
+libgpgme_glib_la_DEPENDENCIES = $(assuan_libobjs) \
 	@LTLIBOBJS@ $(srcdir)/libgpgme.vers $(gpgme_deps)
-libgpgme_glib_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \
+libgpgme_glib_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \
 	@GPG_ERROR_LIBS@ @GLIB_LIBS@ @NETLIBS@
 endif
 




More information about the Gnupg-devel mailing list