From 63db817bac0382f3f43947b8233bf4585ede0e0b Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Tue, 20 Dec 2011 15:42:44 +0200 Subject: [PATCH] Split support for libsoup-gnome https://bugzilla.gnome.org/show_bug.cgi?id=595065 Original patch by Romain Perier. --- Makefile.am | 12 +++++++++-- configure.ac | 35 ++++++++++++++++++++----------- libsoup/Makefile.am | 60 +++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 77 insertions(+), 30 deletions(-) diff --git a/Makefile.am b/Makefile.am index c8fa95c..fc09778 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,11 @@ ## Process this file with automake to produce Makefile.in ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} -SUBDIRS = libsoup po tests examples docs +SUBDIRS = libsoup + +if BUILD_LIBSOUP +SUBDIRS += po tests docs +endif EXTRA_DIST = \ data/effective_tld_names.dat \ @@ -18,7 +22,11 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libsoup-2.4.pc +pkgconfig_DATA = + +if BUILD_LIBSOUP +pkgconfig_DATA += libsoup-2.4.pc +endif if BUILD_LIBSOUP_GNOME pkgconfig_DATA += libsoup-gnome-2.4.pc diff --git a/configure.ac b/configure.ac index 96bb378..0153f10 100644 --- a/configure.ac +++ b/configure.ac @@ -77,23 +77,30 @@ LT_INIT([win32-dll]) dnl *********************** dnl *** Checks for glib *** dnl *********************** +PKG_PROG_PKG_CONFIG +enable_ssl=no +AC_ARG_WITH(libsoup-system, + AS_HELP_STRING([--with-libsoup-system], [Use libsoup system library to build(default=no)]), + [with_libsoup_system=$withval], [with_libsoup_system=no]) +if test "$with_libsoup_system" = "no"; then + GLIB_REQUIRED=2.38.0 + AM_PATH_GLIB_2_0($GLIB_REQUIRED,,,gobject gio) + if test "$GLIB_LIBS" = ""; then + AC_MSG_ERROR(GLIB $GLIB_REQUIRED or later is required to build libsoup) + fi + GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_38" -GLIB_REQUIRED=2.38.0 -AM_PATH_GLIB_2_0($GLIB_REQUIRED,,,gobject gio) -if test "$GLIB_LIBS" = ""; then - AC_MSG_ERROR(GLIB $GLIB_REQUIRED or later is required to build libsoup) -fi -GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_38" + GLIB_MAKEFILE='$(top_srcdir)/Makefile.glib' + AC_SUBST(GLIB_MAKEFILE) -GLIB_MAKEFILE='$(top_srcdir)/Makefile.glib' -AC_SUBST(GLIB_MAKEFILE) + PKG_CHECK_MODULES(XML, libxml-2.0) + AC_SUBST(XML_CFLAGS) + AC_SUBST(XML_LIBS) +fi +AM_CONDITIONAL(BUILD_LIBSOUP, test $with_libsoup_system = no) GLIB_TESTS -PKG_CHECK_MODULES(XML, libxml-2.0) -AC_SUBST(XML_CFLAGS) -AC_SUBST(XML_LIBS) - PKG_CHECK_MODULES(SQLITE, sqlite3) AC_SUBST(SQLITE_CFLAGS) AC_SUBST(SQLITE_LIBS) @@ -141,6 +148,10 @@ AM_CONDITIONAL(BUILD_LIBSOUP_GNOME, test $with_gnome != no) if test $with_gnome != no; then AC_DEFINE(HAVE_GNOME, 1, [Defined if GNOME support is enabled]) + + if test $with_libsoup_system != no; then + PKG_CHECK_MODULES(LIBSOUP, libsoup-$SOUP_API_VERSION = $VERSION) + fi fi AC_SUBST(HAVE_GNOME) diff --git a/libsoup/Makefile.am b/libsoup/Makefile.am index 60920bd..26c5616 100644 --- a/libsoup/Makefile.am +++ b/libsoup/Makefile.am @@ -1,14 +1,19 @@ ## Process this file with automake to produce Makefile.in EXTRA_DIST = - +BUILT_SOURCES = include $(GLIB_MAKEFILE) if OS_WIN32 LIBWS2_32 = -lws2_32 endif -AM_CPPFLAGS = \ +AM_CPPFLAGS = +lib_LTLIBRARIES = +CLEANFILES = + +if BUILD_LIBSOUP +AM_CPPFLAGS += \ -DG_LOG_DOMAIN=\"libsoup\" \ -DLOCALEDIR=\"$(localedir)\" \ -I$(top_srcdir) \ @@ -76,7 +81,7 @@ libsoupinclude_HEADERS = \ nodist_libsoupinclude_HEADERS = \ soup-version.h -lib_LTLIBRARIES = libsoup-2.4.la +lib_LTLIBRARIES += libsoup-2.4.la libsoup_2_4_la_LDFLAGS = \ -version-info $(SOUP_CURRENT):$(SOUP_REVISION):$(SOUP_AGE) \ @@ -184,18 +189,23 @@ libsoup_2_4_la_SOURCES = \ soup-version.c \ soup-xmlrpc.c -# TLD rules -EXTRA_DIST += tld-parser.py - +BUILT_SOURCES += tld_data.inc TLD_DATA_FILE=$(top_srcdir)/data/effective_tld_names.dat tld_data.inc: tld-parser.py $(TLD_DATA_FILE) - $(srcdir)/tld-parser.py $(TLD_DATA_FILE) tld_data.inc + $(AM_V_GEN) python $(srcdir)/tld-parser.py $(TLD_DATA_FILE) tld_data.inc + +# TLD rules +EXTRA_DIST += tld-parser.py + +endif if BUILD_LIBSOUP_GNOME libsoupgnomeincludedir = $(includedir)/libsoup-gnome-2.4/libsoup +AM_CPPFLAGS += $(LIBSOUP_CFLAGS) + libsoupgnomeinclude_HEADERS = \ soup-cookie-jar-sqlite.h\ soup-gnome.h \ @@ -203,17 +213,26 @@ libsoupgnomeinclude_HEADERS = \ lib_LTLIBRARIES += libsoup-gnome-2.4.la +if BUILD_LIBSOUP +libsoup_gnome_2_4_la_LDFLAGS = $(libsoup_2_4_la_LDFLAGS) +else libsoup_gnome_2_4_la_LDFLAGS = \ -version-info $(SOUP_CURRENT):$(SOUP_REVISION):$(SOUP_AGE) \ -no-undefined \ -export-symbols $(srcdir)/libsoup-gnome-2.4.sym +endif EXTRA_DIST += libsoup-gnome-2.4.sym libsoup_gnome_2_4_la_LIBADD = \ - libsoup-2.4.la \ $(GLIB_LIBS) +if BUILD_LIBSOUP +libsoup_gnome_2_4_la_LIBADD += libsoup-2.4.la +else +libsoup_gnome_2_4_la_LIBADD += $(LIBSOUP_LIBS) +endif + libsoup_gnome_2_4_la_SOURCES = \ soup-cookie-jar-sqlite.c \ soup-gnome-features.c \ @@ -225,9 +244,8 @@ libsoup_gnome_2_4_la_SOURCES = \ endif GLIB_GENERATED = soup-enum-types.c soup-enum-types.h -BUILT_SOURCES = \ - $(GLIB_GENERATED) \ - tld_data.inc +BUILT_SOURCES += \ + $(GLIB_GENERATED) soup_enum_types_sources = $(libsoupinclude_HEADERS) $(libsoupgnomeinclude_HEADERS) soup_enum_types_MKENUMS_C_FLAGS = --fhead "\#define LIBSOUP_USE_UNSTABLE_REQUEST_API" @@ -242,6 +260,8 @@ INTROSPECTION_COMPILER_ARGS = --includedir=. if HAVE_INTROSPECTION +if BUILD_LIBSOUP + # Core library gi_soup_files = \ $(filter-out soup.h soup-enum-types.% soup-proxy-resolver.h,\ @@ -263,20 +283,28 @@ Soup_2_4_gir_FILES = \ INTROSPECTION_GIRS += Soup-2.4.gir +endif + if BUILD_LIBSOUP_GNOME +if BUILD_LIBSOUP +SOUP_GIR = Soup-2.4.gir +else +SOUP_GIR = +endif + # GNOME extensions gi_soup_gnome_files = $(filter-out soup-gnome.h,\ $(libsoupgnomeinclude_HEADERS) \ $(filter-out %.h, $(libsoup_gnome_2_4_la_SOURCES))) -SoupGNOME-2.4.gir: libsoup-gnome-2.4.la Soup-2.4.gir +SoupGNOME-2.4.gir: libsoup-gnome-2.4.la $(SOUP_GIR) +SoupGNOME_2_4_gir_INCLUDES = Soup-2.4 SoupGNOME_2_4_gir_SCANNERFLAGS = \ --identifier-prefix=Soup \ --symbol-prefix=soup \ - --c-include "libsoup/soup-gnome.h" \ - --include-uninstalled=$(builddir)/Soup-2.4.gir + --c-include "libsoup/soup-gnome.h" SoupGNOME_2_4_gir_CFLAGS = $(AM_CPPFLAGS) -SoupGNOME_2_4_gir_LIBS = libsoup-gnome-2.4.la libsoup-2.4.la +SoupGNOME_2_4_gir_LIBS = libsoup-gnome-2.4.la SoupGNOME_2_4_gir_FILES = $(addprefix $(srcdir)/,$(gi_soup_gnome_files)) SoupGNOME_2_4_gir_EXPORT_PACKAGES = libsoup-gnome-2.4 @@ -290,6 +318,6 @@ gir_DATA = $(INTROSPECTION_GIRS) typelibdir = $(libdir)/girepository-1.0 typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) -CLEANFILES = $(gir_DATA) $(typelib_DATA) $(BUILT_SOURCES) +CLEANFILES += $(gir_DATA) $(typelib_DATA) $(BUILT_SOURCES) endif -- 1.9.0