[Pkg-ocaml-maint-commits] r4403 - in /trunk/packages/ocaml/trunk/debian/cdbs: ocaml-vars.mk ocaml.mk ocamldoc-api-ref-config
gildor at users.alioth.debian.org
gildor at users.alioth.debian.org
Fri Sep 7 21:09:52 UTC 2007
Author: gildor
Date: Fri Sep 7 21:09:52 2007
New Revision: 4403
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/?sc=1&rev=4403
Log:
* Some enhancement to ocamldoc generation -- need to be tested
Added:
trunk/packages/ocaml/trunk/debian/cdbs/ocamldoc-api-ref-config (contents, props changed)
- copied, changed from r4300, trunk/packages/ocaml/trunk/debian/cdbs/ocaml-docbase-template.txt
Modified:
trunk/packages/ocaml/trunk/debian/cdbs/ocaml-vars.mk
trunk/packages/ocaml/trunk/debian/cdbs/ocaml.mk
Modified: trunk/packages/ocaml/trunk/debian/cdbs/ocaml-vars.mk
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/ocaml/trunk/debian/cdbs/ocaml-vars.mk?rev=4403&op=diff
==============================================================================
--- trunk/packages/ocaml/trunk/debian/cdbs/ocaml-vars.mk (original)
+++ trunk/packages/ocaml/trunk/debian/cdbs/ocaml-vars.mk Fri Sep 7 21:09:52 2007
@@ -82,11 +82,22 @@
# 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/*.
+# will be shipped in $(OCAML_OCAMLDOC_DESTDIR_HTML).
# Typical usage is OCAML_OCAMLDOC_PACKAGES = $(OCAML_LIBDEV_PACKAGES).
# For debian/rules writers
OCAML_OCAMLDOC_PACKAGES =
#OCAML_OCAMLDOC_PACKAGES = $(OCAML_LIBDEV_PACKAGES) # more "aggressive" default
+
+# space separated list of packages for which a pkg.doc-base.ocamldoc-apiref is
+# required. This file contains is the debian doc-base description of file which
+# should be located in the directory $(OCAML_OCAMLDOC_DESTDIR_HTML)
+# For debian/rules writers
+OCAML_OCAMLDOC_PACKAGES_DOCBASE =
+
+# ocamlfind flags which must be used in order to generate
+# correctly the ocamldoc documentation
+# For debian/rules writers
+OCAML_OCAMLDOC_OCAMLFIND_FLAGS =
# generic (i.e. non backend specific) flags to be passed to ocamldoc
# For debian/rules writers
@@ -104,7 +115,7 @@
# can use "$(cdbs_curpkg)" stem there, it will be expanded to the current
# package name by CDBS
# For debian/rules writers
-OCAML_OCAMLDOC_DESTDIR_HTML = usr/share/doc/$(cdbs_curpkg)/html/api
+OCAML_OCAMLDOC_DESTDIR_HTML = $(shell ocamldoc-api-ref-config --html-directory $(cdbs_curpkg))
endif
Modified: trunk/packages/ocaml/trunk/debian/cdbs/ocaml.mk
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/ocaml/trunk/debian/cdbs/ocaml.mk?rev=4403&op=diff
==============================================================================
--- trunk/packages/ocaml/trunk/debian/cdbs/ocaml.mk (original)
+++ trunk/packages/ocaml/trunk/debian/cdbs/ocaml.mk Fri Sep 7 21:09:52 2007
@@ -44,25 +44,35 @@
# post-install hook to invoke ocamldoc on OCAML_OCAMLDOC_PACKAGES packages
$(patsubst %,binary-install/%,$(DEB_PACKAGES))::
- @if (echo $(OCAML_OCAMLDOC_PACKAGES) | egrep '( |^)$(cdbs_curpkg)( |$$)' > /dev/null) ; then \
+ @OCAMLDOC="ocamldoc $(OCAML_OCAMLDOC_FLAGS)"; \
+ if test -n "$(OCAML_OCAMLDOC_OCAMLFIND_FLAGS)" ; then \
+ if ! test -x "/usr/bin/ocamlfind"; then \
+ echo "OCamlfind flags set and no ocamlfind to be found" >&2; \
+ exit 1; \
+ fi; \
+ OCAMLDOC="ocamlfind $$OCAMLDOC $(OCAML_OCAMLDOC_OCAMLFIND_FLAGS)"; \
+ fi; \
+ OCAML_OCAMLDOC_INCLUDE=`for i in $(OCAML_OCAMLDOC_PACKAGES); do \
+ find debian/$$i/$(OCAML_STDLIB_DIR)/ -type d -exec echo -I \{} \; ; \
+ done`; \
+ if (echo $(OCAML_OCAMLDOC_PACKAGES) | egrep '( |^)$(cdbs_curpkg)( |$$)' > /dev/null) ; then \
echo 'mkdir -p debian/$(cdbs_curpkg)/$(OCAML_OCAMLDOC_DESTDIR_HTML)' ; \
mkdir -p debian/$(cdbs_curpkg)/$(OCAML_OCAMLDOC_DESTDIR_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 $(OCAML_OCAMLDOC_FLAGS_HTML) \
+ | xargs $$OCAMLDOC -html $(OCAML_OCAMLDOC_FLAGS_HTML) \
-d debian/$(cdbs_curpkg)/$(OCAML_OCAMLDOC_DESTDIR_HTML) \
|| true ; \
fi
# post-build hook to create doc-base entries for OCAML_OCAMLDOC_PACKAGES packages
$(patsubst %,build/%,$(DEB_PACKAGES))::
- @if (echo $(OCAML_OCAMLDOC_PACKAGES) | egrep '( |^)$(cdbs_curpkg)( |$$)' > /dev/null) ; then \
- sed -e 's/@PACKAGE@/$(cdbs_curpkg)/g' \
- $(_cdbs_class_path)/ocaml-docbase-template.txt$(_cdbs_makefile_suffix) \
- > debian/$(cdbs_curpkg).doc-base.ocamldoc-apiref ; \
+ @if (echo $(OCAML_OCAMLDOC_PACKAGES) $(OCAML_OCAMLDOC_PACKAGES_DOCBASE) \
+ | egrep '( |^)$(cdbs_curpkg)( |$$)' > /dev/null) ; then \
+ ocamldoc-api-ref-config --doc-base-generate $(cdbs_curpkg)
fi
+
clean::
rm -f debian/*.doc-base.ocamldoc-apiref
Copied: trunk/packages/ocaml/trunk/debian/cdbs/ocamldoc-api-ref-config (from r4300, trunk/packages/ocaml/trunk/debian/cdbs/ocaml-docbase-template.txt)
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/ocaml/trunk/debian/cdbs/ocamldoc-api-ref-config?rev=4403&op=diff
==============================================================================
--- trunk/packages/ocaml/trunk/debian/cdbs/ocaml-docbase-template.txt (original)
+++ trunk/packages/ocaml/trunk/debian/cdbs/ocamldoc-api-ref-config Fri Sep 7 21:09:52 2007
@@ -1,8 +1,104 @@
-Document: @PACKAGE at -ocamldoc-api-reference
-Title: @PACKAGE@ OCamldoc API Reference
-Abstract: API reference manual for @PACKAGE@ (generated via OCamldoc)
+#!/bin/sh
+# ocamldoc-api-ref-config: configuration and generation of .doc-base.ocamldoc-apiref
+# Copyright (C) 2006 Sylvain Le Gall <gildor at debian.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2, or (at
+# your option) any later version.
+#
+# This program 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+set -e
+set -x
+
+print_usage ()
+{
+ PRG=`basename $0`
+ cat <<EOF
+$PRG -- Written by Sylvain Le Gall
+"This program is under GPL v2"
+
+Usage:
+$PRG [options] package*
+
+Options:
+--html-directory Output the directory name where the generated ocamldoc
+ generated file should go
+--doc-base-generate Generate debian/PACKAGE.doc-base.ocamldoc-apiref
+
+EOF
+}
+
+error_usage ()
+{
+ print_usage >&2
+ echo $* >&2
+ exit 1
+}
+
+html_directory ()
+{
+ echo "/usr/share/doc/$1/html/api"
+}
+
+doc_base_generate ()
+{
+ if ! test -d "debian"; then
+ echo "Cannot find debian directory for generation" >&2
+ exit 1
+ fi
+ PKG="$1"
+ PKG_DIR=`html_directory $PKG`
+ FILE="debian/$PKG.doc-base.ocamldoc-apiref"
+ echo $FILE
+ cat > $FILE <<EOF
+Document: $PKG-ocamldoc-api-reference
+Title: $PKG OCamldoc API Reference
+Abstract: API reference manual for $PKG (generated via OCamldoc)
Section: Applications/Programming
Format: HTML
-Index: /usr/share/doc/@PACKAGE@/html/api/index.html
-Files: /usr/share/doc/@PACKAGE@/html/api/*
+Index: $PKG_DIR/index.html
+Files: $PKG_DIR/*
+EOF
+}
+
+ACTION=true
+PACKAGE_IDX=1
+
+while test $# -gt 0; do
+ case "$1" in
+ --html-directory)
+ ACTION="html_directory"
+ ;;
+ --doc-base-generate)
+ ACTION="doc_base_generate"
+ ;;
+ --help|-help|-?)
+ print_usage
+ exit 0
+ ;;
+ -*)
+ error_usage "Unknown option $1"
+ ;;
+ *)
+ PACKAGE[$PACKAGE_IDX]=$1
+ PACKAGE_IDX=$(($PACKAGE_IDX + 1))
+ ;;
+ esac
+ shift
+done
+
+for i in `seq $(($PACKAGE_IDX - 1))`; do
+ $ACTION ${PACKAGE[$i]}
+done
+
Propchange: trunk/packages/ocaml/trunk/debian/cdbs/ocamldoc-api-ref-config
------------------------------------------------------------------------------
svn:executable = *
More information about the Pkg-ocaml-maint-commits
mailing list