[caribou] Add documentation support



commit 89b918dfbb11f8ccc3162eb84097c39baccac9cc
Author: Daiki Ueno <ueno unixuser org>
Date:   Wed Oct 31 12:15:26 2012 +0900

    Add documentation support
    
    Add Valadoc documentation support in the build system.
    The template is borrowed from Folks.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=687244

 Makefile.am      |    8 ++++
 configure.ac     |   21 +++++++++++
 docs/Makefile.am |   99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 128 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 6196fc2..a507570 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,11 @@
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 
 SUBDIRS = caribou bin data po libcaribou modules tools
+
+if HAVE_VALADOC
+SUBDIRS += docs
+endif
+
+DISTCHECK_CONFIGURE_FLAGS = \
+	--enable-docs \
+	$(NULL)
diff --git a/configure.ac b/configure.ac
index 33727fe..bc0fb83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,6 +27,7 @@ PYGOBJECT_REQUIRED=2.90.3
 GTK_REQUIRED=3.0.0
 CLUTTER_REQUIRED=1.5.11
 GDK_REQUIRED=3.0.0
+VALADOC_REQUIRED=0.3.1
 
 PKG_CHECK_MODULES(CARIBOU, [
   pygobject-3.0 >= $PYGOBJECT_REQUIRED,
@@ -104,6 +105,25 @@ IT_PROG_INTLTOOL([0.35.0])
 dnl == GObject introspection ==
 GOBJECT_INTROSPECTION_REQUIRE([0.10.7])
 
+dnl == Documentation ==
+AC_ARG_ENABLE([docs],
+              AS_HELP_STRING([--enable-docs],[Enable documentation generation]),
+              [enable_docs=$enableval], [enable_docs=no])
+AM_CONDITIONAL([ENABLE_DOCS], [test x$enable_docs = xyes])
+
+have_valadoc=no
+AS_IF([test x$enable_docs = xyes], [
+  # make sure the library is new enough and the program exists
+  PKG_CHECK_MODULES([VALADOC], [valadoc-1.0 >= $VALADOC_REQUIRED])
+  AC_PATH_PROG([VALADOC], [valadoc], [:])
+  AS_IF([test "$VALADOC" != :], have_valadoc=yes)
+])
+AM_CONDITIONAL([HAVE_VALADOC], [test x$have_valadoc = xyes])
+
+AS_IF([test "x$enable_docs" = "xyes" -a "x$have_valadoc" != "xyes"], [
+    AC_MSG_ERROR([Doc building requested but valadoc not installed.])
+])
+
 dnl == generate makefiles ==
 AC_OUTPUT([
 Makefile
@@ -128,4 +148,5 @@ modules/Makefile
 modules/gtk3/Makefile
 modules/gtk2/Makefile
 tools/Makefile
+docs/Makefile
 ])
diff --git a/docs/Makefile.am b/docs/Makefile.am
new file mode 100644
index 0000000..4f4fe6d
--- /dev/null
+++ b/docs/Makefile.am
@@ -0,0 +1,99 @@
+distclean_dirs = \
+	caribou \
+	gtk-doc \
+	$(NULL)
+
+phony_deps = \
+	caribou-doc \
+	caribou-gtk-doc \
+	$(NULL)
+
+upload_docs = \
+	upload-docs-c-caribou \
+	upload-docs-vala-caribou \
+	$(NULL)
+
+cariboudocdir=$(datadir)/devhelp/references/caribou
+caribouimgdir=$(datadir)/devhelp/references/caribou/img
+
+caribougtkdocdir=$(datadir)/gtk-doc/html/caribou
+
+common_doc_files = \
+	*.css \
+	*.png \
+	*.js \
+	index.htm \
+	*.html \
+	$(NULL)
+
+cariboudoc_DATA = \
+	caribou/caribou/caribou.devhelp2 \
+	$(addprefix caribou/caribou/,$(common_doc_files)) \
+	$(NULL)
+
+caribougtkdoc_DATA = gtk-doc/caribou/html/*
+
+caribouimg_DATA = \
+	caribou/caribou/img/*.png \
+	$(NULL)
+
+$(cariboudoc_DATA) $(caribouimg_DATA): caribou-doc
+$(caribougtkdoc_DATA): caribou-gtk-doc
+
+valadoc_flags = \
+	--force \
+	--package-version $(PACKAGE_VERSION) \
+	--no-protected \
+	$(NULL)
+
+# caribou documentation
+caribou_doc_files_blacklist = \
+	$(NULL)
+# this expands the list of files, so we can filter out elements
+caribou_doc_files_all = \
+	$(wildcard $(top_srcdir)/libcaribou/*.vala) \
+	$(NULL)
+# FIXME: sort the files manually to work around the native doclet portion of
+# bgo#662784
+caribou_doc_files = \
+	$(sort \
+	$(filter-out $(caribou_doc_files_blacklist),$(caribou_doc_files_all)))
+caribou_doc_deps = \
+	x11 \
+	xtst \
+	gdk-3.0 \
+	gio-2.0 \
+	gee-1.0 \
+	libxklavier \
+	external-libs \
+	gdk-x11-3.0 \
+	libxml-2.0 \
+	$(NULL)
+valadoc_flags_caribou = \
+	$(valadoc_flags) \
+	-X $(top_srcdir)/libcaribou/caribou.h \
+	$(addprefix --pkg=,$(caribou_doc_deps)) \
+	--vapidir=$(top_srcdir)/libcaribou \
+	$(caribou_doc_files) \
+	$(NULL)
+
+caribou-doc: $(caribou_doc_files)
+	$(AM_V_GEN)$(VALADOC) \
+		-o caribou/ \
+		--doclet=devhelp \
+		$(valadoc_flags_caribou) \
+		$(NULL)
+
+caribou-gtk-doc: $(caribou_doc_files)
+	$(AM_V_GEN)$(VALADOC) \
+		-X -l -X $(top_builddir)/libcaribou/.libs/libcaribou.so \
+		-o gtk-doc/caribou \
+		--doclet=gtkdoc \
+		$(valadoc_flags_caribou) \
+		$(NULL)
+
+.PHONY: $(phony_deps)
+
+distclean-local: distclean-docs
+distclean-docs:
+	rm -rf $(distclean_dirs)



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