[ostree/wip/embed-glib] Support building with embedded glib



commit d0c832682cb76bab5a3672f869f4aa7199f940ff
Author: Colin Walters <walters verbum org>
Date:   Thu Jun 7 17:21:55 2012 -0400

    Support building with embedded glib

 Makefile-daemon.am                       |    4 +-
 Makefile-libostree.am                    |    4 +-
 Makefile-ostadmin.am                     |    4 +-
 Makefile-ostree.am                       |    4 +-
 Makefile-otutil.am                       |    4 +-
 Makefile-triggers.am                     |    4 +-
 Makefile.am                              |   30 ++++++++++++++++++++++
 configure.ac                             |   15 ++++++++---
 embedded-dependencies/Makefile.am        |   40 ++++++++++++++++++++++++++++++
 embedded-dependencies/Makefile.bootstrap |    2 +
 embedded-dependencies/README             |   19 ++++++++++++++
 11 files changed, 114 insertions(+), 16 deletions(-)
---
diff --git a/Makefile-daemon.am b/Makefile-daemon.am
index 3b0a2b3..caa97f2 100644
--- a/Makefile-daemon.am
+++ b/Makefile-daemon.am
@@ -24,5 +24,5 @@ ostreed_SOURCES = src/daemon/ostreed.c \
 	src/daemon/ot-daemon.c \
 	$(NULL)
 
-ostreed_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/daemon -DLOCALEDIR=\"$(datadir)/locale\" $(OT_DEP_GIO_UNIX_CFLAGS)
-ostreed_LDADD = libotutil.la libostree.la $(OT_DEP_GIO_UNIX_LIBS)
+ostreed_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/daemon -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS)
+ostreed_LDADD = libotutil.la libostree.la $(OT_INTERNAL_GIO_UNIX_LIBS)
diff --git a/Makefile-libostree.am b/Makefile-libostree.am
index af5a9af..2d2b3b2 100644
--- a/Makefile-libostree.am
+++ b/Makefile-libostree.am
@@ -46,9 +46,9 @@ libostree_la_SOURCES += src/libostree/ostree-libarchive-input-stream.h \
 	$(NULL)
 endif
 
-libostree_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -DLOCALEDIR=\"$(datadir)/locale\" $(OT_DEP_GIO_UNIX_CFLAGS)
+libostree_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS)
 libostree_la_LDFLAGS = -avoid-version -Bsymbolic-functions
-libostree_la_LIBADD = libotutil.la $(OT_DEP_GIO_UNIX_LIBS)
+libostree_la_LIBADD = libotutil.la $(OT_INTERNAL_GIO_UNIX_LIBS)
 
 if USE_LIBARCHIVE
 libostree_la_CFLAGS += $(OT_DEP_LIBARCHIVE_CFLAGS)
diff --git a/Makefile-ostadmin.am b/Makefile-ostadmin.am
index 6872a21..f0e0112 100644
--- a/Makefile-ostadmin.am
+++ b/Makefile-ostadmin.am
@@ -25,5 +25,5 @@ ostadmin_SOURCES = src/ostadmin/main.c \
 	src/ostadmin/ot-admin-main.c \
 	$(NULL)
 
-ostadmin_CFLAGS =  $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/ostadmin -DLOCALEDIR=\"$(datadir)/locale\" $(OT_DEP_GIO_UNIX_CFLAGS)
-ostadmin_LDADD = libotutil.la libostree.la $(OT_DEP_GIO_UNIX_LIBS)
+ostadmin_CFLAGS =  $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/ostadmin -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS)
+ostadmin_LDADD = libotutil.la libostree.la $(OT_INTERNAL_GIO_UNIX_LIBS)
diff --git a/Makefile-ostree.am b/Makefile-ostree.am
index 8024974..628d9a1 100644
--- a/Makefile-ostree.am
+++ b/Makefile-ostree.am
@@ -46,8 +46,8 @@ ostree_SOURCES = src/ostree/main.c \
 ostree_bin_shared_cflags = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/ostree  -DLOCALEDIR=\"$(datadir)/locale\"
 ostree_bin_shared_ldadd = libotutil.la libostree.la
 
-ostree_CFLAGS = $(ostree_bin_shared_cflags) $(OT_DEP_GIO_UNIX_CFLAGS)
-ostree_LDADD = $(ostree_bin_shared_ldadd) $(OT_DEP_GIO_UNIX_LIBS)
+ostree_CFLAGS = $(ostree_bin_shared_cflags) $(OT_INTERNAL_GIO_UNIX_CFLAGS)
+ostree_LDADD = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_GIO_UNIX_LIBS)
 
 if USE_LIBSOUP_GNOME
 bin_PROGRAMS += ostree-pull
diff --git a/Makefile-otutil.am b/Makefile-otutil.am
index fec972a..cf7c50e 100644
--- a/Makefile-otutil.am
+++ b/Makefile-otutil.am
@@ -39,5 +39,5 @@ libotutil_la_SOURCES = \
 	src/libotutil/otutil.c \
 	src/libotutil/otutil.h \
 	$(NULL)
-libotutil_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -DLOCALEDIR=\"$(datadir)/locale\" $(OT_DEP_GIO_UNIX_CFLAGS)
-libotutil_la_LIBADD = $(OT_DEP_GIO_UNIX_LIBS)
+libotutil_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS)
+libotutil_la_LIBADD = $(OT_INTERNAL_GIO_UNIX_LIBS)
diff --git a/Makefile-triggers.am b/Makefile-triggers.am
index 7721601..e4b3d91 100644
--- a/Makefile-triggers.am
+++ b/Makefile-triggers.am
@@ -35,5 +35,5 @@ EXTRA_DIST += $(triggers_SCRIPTS)
 bin_PROGRAMS += ostree-run-triggers
 
 ostree_run_triggers_SOURCES = src/triggers/ostree-run-triggers.c
-ostree_run_triggers_CFLAGS = $(OT_DEP_GIO_UNIX_CFLAGS)
-ostree_run_triggers_LDFLAGS = $(OT_DEP_GIO_UNIX_LIBS)
+ostree_run_triggers_CFLAGS = $(OT_INTERNAL_GIO_UNIX_CFLAGS)
+ostree_run_triggers_LDFLAGS = $(OT_INTERNAL_GIO_UNIX_LIBS)
diff --git a/Makefile.am b/Makefile.am
index ed10d5c..c6198d7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,6 +20,12 @@ AM_CPPFLAGS = -DDATADIR='"$(datadir)"' -DLIBEXECDIR='"$(libexecdir)"' \
 	-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_28
 AM_CFLAGS = $(WARN_CFLAGS)
 
+if BUILD_EMBEDDED_GLIB
+SUBDIRS = embedded-dependencies .
+else
+SUBDIRS = .
+endif
+
 NULL = 
 BUILT_SOURCES =
 MANPAGES =
@@ -34,6 +40,24 @@ noinst_PROGRAMS =
 privlibdir = $(pkglibdir)
 privlib_LTLIBRARIES =
 
+if BUILD_EMBEDDED_GLIB
+OT_INTERNAL_GIO_UNIX_CFLAGS = \
+	-I$(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/include/glib-2.0 \
+	-I$(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/include/gio-unix-2.0 \
+	-I$(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/lib/glib-2.0/include \
+	$(NULL)
+OT_INTERNAL_GIO_UNIX_LIBS = \
+	$(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/lib/libglib-2.0.so \
+	$(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/lib/libgthread-2.0.so \
+	$(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/lib/libgmodule-2.0.so \
+	$(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/lib/libgobject-2.0.so \
+	$(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/lib/libgio-2.0.so \
+	$(NULL)
+else
+OT_INTERNAL_GIO_UNIX_CFLAGS = $(OT_DEP_GIO_UNIX_CFLAGS)
+OT_INTERNAL_GIO_UNIX_LIBS = $(OT_DEP_GIO_UNIX_LIBS)
+endif
+
 include Makefile-daemon.am
 include Makefile-otutil.am
 include Makefile-libostree.am
@@ -83,3 +107,9 @@ endif
 
 release-tag:
 	git tag -m "Release $(VERSION)" v$(VERSION)
+
+release-tarball-embedded:
+	git archive --format=tar --prefix=ostree-embeddeps-$(VERSION)/ v$(VERSION) > ostree-embeddeps-$(VERSION).tar.tmp
+	tar --append --transform='s,^embedded-dependencies/,ostree-embeddeps-$(VERSION)/embedded-dependencies/,' --file=ostree-$(VERSION).tar.tmp embedded-dependencies/glib
+	mv ostree-embeddeps-$(VERSION).tar{.tmp,}
+	gzip ostree-embeddeps-$(VERSION).tar 
diff --git a/configure.ac b/configure.ac
index dd75a07..c21fa28 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,12 +26,18 @@ AC_CHECK_HEADER([attr/xattr.h],,[AC_MSG_ERROR([You must have attr/xattr.h from l
 
 PKG_PROG_PKG_CONFIG
 
-GIO_DEPENDENCY="gio-unix-2.0 >= 2.28"
+AC_ARG_ENABLE(embedded-glib,
+	    AS_HELP_STRING([--enable-embedded-glib], [Use embedded GLib copy]),,)
+AM_CONDITIONAL(BUILD_EMBEDDED_GLIB, test x$enable_embedded_glib = xyes)
+if test x$enable_embedded_glib = xyes; then
+  echo "NOTICE: Embedded glib enabled"
+else
+  GIO_DEPENDENCY="gio-unix-2.0 >= 2.28"
+  PKG_CHECK_MODULES(OT_DEP_GIO_UNIX, $GIO_DEPENDENCY)
+fi
 SOUP_DEPENDENCY="libsoup-2.4 >= 2.39.1"
 LIBARCHIVE_DEPENDENCY="libarchive >= 2.8.0"
 
-PKG_CHECK_MODULES(OT_DEP_GIO_UNIX, $GIO_DEPENDENCY)
-
 AC_ARG_ENABLE(documentation,
               AC_HELP_STRING([--enable-documentation],
                              [build documentation]),,
@@ -44,7 +50,6 @@ if test x$enable_documentation = xyes; then
 fi
 AM_CONDITIONAL(BUILD_DOCUMENTATION, test x$enable_documentation = xyes)
 
-
 AC_ARG_WITH(soup-gnome,
 	    AS_HELP_STRING([--without-soup-gnome], [Do not use libsoup-gnome (implies no pull support)]),
 	    :, with_soup_gnome=maybe)
@@ -86,6 +91,7 @@ AM_CONDITIONAL(USE_LIBARCHIVE, test $with_libarchive != no)
 
 AC_CONFIG_FILES([
 Makefile
+embedded-dependencies/Makefile
 ])
 AC_OUTPUT
 
@@ -94,6 +100,7 @@ echo "
     ===============
 
 
+    embedded GLib: $enable_embedded_glib
     libsoup (retrieve remote HTTP repositories): $with_soup_gnome
     libarchive (parse tar files directly): $with_libarchive
 "
diff --git a/embedded-dependencies/Makefile.am b/embedded-dependencies/Makefile.am
new file mode 100644
index 0000000..b6c60c4
--- /dev/null
+++ b/embedded-dependencies/Makefile.am
@@ -0,0 +1,40 @@
+# Import GLib into local tree
+#
+# Copyright (C) 2012 Colin Walters <walters verbum org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+build-glib/gio/libgio-2.0.la:
+	mkdir -p build-glib
+	(srcdir=$$(cd $(srcdir) && pwd); \
+	 cd build-glib; \
+         $${srcdir}/glib/autogen.sh --prefix=/EMBEDGLIB --disable-introspection --disable-man --disable-gtk-doc && \
+	 $(MAKE))
+
+install-glib/EMBEDGLIB/include/glib-2.0/glib.h: build-glib/gio/libgio-2.0.la
+	(top_srcdir=$$(cd $(top_srcdir) && pwd); \
+	 builddir=$$(pwd); \
+	 cd build-glib && \
+         rm -rf install-glib && \
+	 $(MAKE) install DESTDIR=$${builddir}/install-glib)
+
+all-local: install-glib/EMBEDGLIB/include/glib-2.0/glib.h
+
+install-exec-local: 
+	echo `pwd`
+	$(MKDIR_P) $(DESTDIR)/$(pkglibdir)
+	install install-glib/EMBEDGLIB/lib/*.so $(DESTDIR)/$(pkglibdir)
+
diff --git a/embedded-dependencies/Makefile.bootstrap b/embedded-dependencies/Makefile.bootstrap
new file mode 100644
index 0000000..95ca2a9
--- /dev/null
+++ b/embedded-dependencies/Makefile.bootstrap
@@ -0,0 +1,2 @@
+embedded-glib-download:
+	test -d glib || git clone --depth=1 git://git.gnome.org/glib -b glib-2-32 glib
diff --git a/embedded-dependencies/README b/embedded-dependencies/README
new file mode 100644
index 0000000..010f239
--- /dev/null
+++ b/embedded-dependencies/README
@@ -0,0 +1,19 @@
+To support building on older systems, this infrastructure allows
+bundling libraries.  At the moment, this is just GLib.
+
+The intent of this system is that a "ostree-embeddeps.tar.gz" is
+created, which can be used as input to an RPM or Debian package, which
+can then be installed on older operating systems.
+
+To create one, use:
+
+$ cd embedded-dependencies
+$ make -f Makefile.bootstrap embedded-glib-download
+$ cd ..
+$ make release-tarballe-embedded
+
+To build it:
+
+$ ./configure --enable-embedded-glib ...
+
+as usual.



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