* CDBS class
authorStefano Zacchiroli <zack@debian.org>
Sat, 25 Aug 2007 18:29:47 +0000 (18:29 +0000)
committerStefano Zacchiroli <zack@debian.org>
Sat, 25 Aug 2007 18:29:47 +0000 (18:29 +0000)
  - add support for automatic ocamldoc HTML documentation generation

debian/cdbs/ocaml-vars.mk
debian/cdbs/ocaml.mk
debian/changelog

index 67255b2bfa2edd398182c802555df3dac50b19f0..d889c9c9f358a294e28c8a6efd874326e85e6a22 100644 (file)
@@ -16,7 +16,7 @@
 # this program; if not, write to the Free Software Foundation, Inc., 51
 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #
-# $Id: ocaml-vars.mk 3889 2007-07-04 10:48:53Z zack $
+# $Id: ocaml-vars.mk 4191 2007-08-25 18:29:47Z zack $
 
 _cdbs_scripts_path ?= /usr/lib/cdbs
 _cdbs_rules_path ?= /usr/share/cdbs/1/rules
@@ -70,5 +70,23 @@ OCAML_TEAM += Sven Luther <luther@debian.org>,
 OCAML_TEAM += Sylvain Le Gall <gildor@debian.org>
 # no trailing "," (comma) on the last name
 
+# space separated list of packages matching the naming convention for OCaml
+# libraries, i.e. libXXX-ocaml-dev.
+# For debian/rules writers
+OCAML_DEV_PACKAGES := $(filter lib%-ocaml-dev,$(DEB_PACKAGES))
+
+# space separated list of packages on which ocamldoc usage is required. For
+# each package listed here will have ocamldoc invoked on all *.ml/*.mli files
+# installed under $(OCAML_STDLIB_DIR) to generated html documentation which
+# will be shipped in /usr/share/doc/PACKAGE/html/*.
+# Typical usage is OCAML_OCAMLDOC_PACKAGES = $(OCAML_DEV_PACKAGES).
+# For debian/rules writers
+OCAML_OCAMLDOC_PACKAGES =
+#OCAML_OCAMLDOC_PACKAGES = $(OCAML_DEV_PACKAGES)       # more "aggressive" default
+
+# flags to be passed to ocamldoc (in addition to -html and -d DESTDIR).
+# For debian/rules writers
+OCAML_OCAMLDOC_FLAGS = -stars
+
 endif
 
index ad65fd0178ac75bf93e349352acc53187e46ad3d..3de0323cc020d7d6058de2b33a9c192012f25129 100644 (file)
@@ -16,7 +16,7 @@
 # this program; if not, write to the Free Software Foundation, Inc., 51
 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #
-# $Id: ocaml.mk 3889 2007-07-04 10:48:53Z zack $
+# $Id: ocaml.mk 4191 2007-08-25 18:29:47Z zack $
 
 _cdbs_scripts_path ?= /usr/lib/cdbs
 _cdbs_rules_path ?= /usr/share/cdbs/1/rules
@@ -34,12 +34,26 @@ CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), ocaml-nox
 # import OCAML_* make variables
 include $(_cdbs_class_path)/ocaml-vars.mk$(_cdbs_makefile_suffix)
 
-# ensure dpkg-gencontrol will fill F:OCamlABI fields with the proper value
 ifdef _cdbs_rules_debhelper
+
+# ensure dpkg-gencontrol will fill F:OCamlABI fields with the proper value
 DEB_DH_GENCONTROL_ARGS += -- -VF:OCamlABI="$(OCAML_ABI)"
 DEB_DH_GENCONTROL_ARGS +=    -VF:OCamlNativeArchs="$(OCAML_NATIVE_ARCHS)"
+
 endif
 
+# post-install hooks for invoking ocamldoc on OCAML_OCAMLDOC_PACKAGES packages
+$(patsubst %,install/%,$(DEB_PACKAGES))::
+       @if (echo $(OCAML_OCAMLDOC_PACKAGES) | grep -w '$(cdbs_curpkg)' > /dev/null) ; then \
+               echo 'mkdir -p debian/$(cdbs_curpkg)/usr/share/doc/$(cdbs_curpkg)/html' ; \
+               mkdir -p debian/$(cdbs_curpkg)/usr/share/doc/$(cdbs_curpkg)/html ; \
+               echo 'invoking ocamldoc on debian/$(cdbs_curpkg)$(OCAML_STDLIB_DIR)/ ...' ; \
+               find debian/$(cdbs_curpkg)$(OCAML_STDLIB_DIR)/ \
+                       -type f -name '*.mli' -or -name '*.ml' \
+               | xargs ocamldoc $(OCAML_OCAMLDOC_FLAGS) -html \
+                       -d debian/$(cdbs_curpkg)/usr/share/doc/$(cdbs_curpkg)/html ; \
+       fi
+
 # generate .in files counterpars before building, substituting @OCamlABI@
 # markers with the proper value; clean stamps after building
 pre-build:: ocamlinit
index f09489b823b9a5fd450c05c2385bfaa2c163304e..d37e4b5fda6115bf26f6662b2f8153901e2b9f86 100644 (file)
@@ -3,8 +3,10 @@ ocaml (3.10.0-6) UNRELEASED; urgency=low
   [ Stefano Zacchiroli ]
   * debian/ocaml-nox.dirs.in
     - avoid creating empty /usr/include/ocaml/* directory (closes: #439017)
+  * CDBS class
+    - add support for automatic ocamldoc HTML documentation generation
 
- -- Stefano Zacchiroli <zack@debian.org>  Tue, 21 Aug 2007 18:55:16 +0200
+ -- Stefano Zacchiroli <zack@debian.org>  Sat, 25 Aug 2007 20:28:29 +0200
 
 ocaml (3.10.0-5) experimental; urgency=low