~ubuntu-branches/debian/sid/ocaml/sid

« back to all changes in this revision

Viewing changes to debian/cdbs/ocaml.mk

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Zacchiroli
  • Date: 2009-02-22 08:49:13 UTC
  • mfrom: (12.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090222084913-3i0uw2bhd0lgw0ok
* Uploading to unstable
* debian/control: bump dh-ocaml to (>= 0.4) to avoid buggy ocamlinit.mk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# Description: CDBS class for OCaml related packages
3
 
#
4
 
# Copyright © 2006-2007 Stefano Zacchiroli <zack@debian.org>
5
 
#
6
 
# This program is free software; you can redistribute it and/or modify it under
7
 
# the terms of the GNU General Public License as published by the Free Software
8
 
# Foundation; either version 2, or (at your option) any later version.
9
 
#
10
 
# This program is distributed in the hope that it will be useful, but WITHOUT
11
 
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
 
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
13
 
# details.
14
 
#
15
 
# You should have received a copy of the GNU General Public License along with
16
 
# this program; if not, write to the Free Software Foundation, Inc., 51
17
 
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
 
#
19
 
# $Id: ocaml.mk 4944 2007-12-28 14:50:46Z zack $
20
 
 
21
 
_cdbs_scripts_path ?= /usr/lib/cdbs
22
 
_cdbs_rules_path ?= /usr/share/cdbs/1/rules
23
 
_cdbs_class_path ?= /usr/share/cdbs/1/class
24
 
 
25
 
ifndef _cdbs_class_ocaml
26
 
_cdbs_class_ocaml = 1
27
 
 
28
 
# needed by debian/control:: rule below
29
 
include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)
30
 
 
31
 
# to ensure invocations and tests on /usr/bin/ocaml* are meaningful
32
 
CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), ocaml-nox
33
 
 
34
 
# import OCAML_* make variables
35
 
include $(_cdbs_class_path)/ocaml-vars.mk$(_cdbs_makefile_suffix)
36
 
 
37
 
ifdef _cdbs_rules_debhelper
38
 
 
39
 
# ensure dpkg-gencontrol will fill F:OCamlABI fields with the proper value
40
 
DEB_DH_GENCONTROL_ARGS += -- -VF:OCamlABI="$(OCAML_ABI)"
41
 
DEB_DH_GENCONTROL_ARGS +=    -VF:OCamlNativeArchs="$(OCAML_NATIVE_ARCHS)"
42
 
 
43
 
endif
44
 
 
45
 
# post-install hook to invoke ocamldoc on OCAML_OCAMLDOC_PACKAGES packages
46
 
$(patsubst %,binary-install/%,$(DEB_PACKAGES))::
47
 
        @OCAMLDOC="ocamldoc $(OCAML_OCAMLDOC_FLAGS)"; \
48
 
        if test -n "$(OCAML_OCAMLDOC_OCAMLFIND_FLAGS)" ; then \
49
 
                if ! test -x "/usr/bin/ocamlfind"; then \
50
 
                        echo "OCamlfind flags set and no ocamlfind to be found" >&2; \
51
 
                        exit 1; \
52
 
                fi; \
53
 
                OCAMLDOC="ocamlfind $$OCAMLDOC $(OCAML_OCAMLDOC_OCAMLFIND_FLAGS)"; \
54
 
        fi; \
55
 
        OCAML_OCAMLDOC_INCLUDE=`for i in $(OCAML_OCAMLDOC_PACKAGES); do \
56
 
                                        find debian/$$i/$(OCAML_STDLIB_DIR)/ -type d -exec echo -I \{} \; ; \
57
 
                                done`; \
58
 
        if (echo $(OCAML_OCAMLDOC_PACKAGES) | egrep '( |^)$(cdbs_curpkg)( |$$)' > /dev/null) ; then \
59
 
                echo 'mkdir -p debian/$(cdbs_curpkg)/$(OCAML_OCAMLDOC_DESTDIR_HTML)' ; \
60
 
                mkdir -p debian/$(cdbs_curpkg)/$(OCAML_OCAMLDOC_DESTDIR_HTML) ; \
61
 
                echo 'invoking ocamldoc on debian/$(cdbs_curpkg)$(OCAML_STDLIB_DIR)/ ...' ; \
62
 
                find debian/$(cdbs_curpkg)$(OCAML_STDLIB_DIR)/ \
63
 
                        -type f -name '*.mli' -or -name '*.ml' \
64
 
                | xargs $$OCAMLDOC $$OCAML_OCAMLDOC_INCLUDE \
65
 
                        -html $(OCAML_OCAMLDOC_FLAGS_HTML) \
66
 
                        -d debian/$(cdbs_curpkg)/$(OCAML_OCAMLDOC_DESTDIR_HTML) \
67
 
                || true ; \
68
 
        fi
69
 
 
70
 
# post-build hook to create doc-base entries for OCAML_OCAMLDOC_PACKAGES packages
71
 
$(patsubst %,build/%,$(DEB_PACKAGES))::
72
 
        @if (echo $(OCAML_OCAMLDOC_PACKAGES) $(OCAML_OCAMLDOC_PACKAGES_DOCBASE) \
73
 
          | egrep '( |^)$(cdbs_curpkg)( |$$)' > /dev/null) ; then \
74
 
                $(_cdbs_class_path)/ocamldoc-api-ref-config --doc-base-generate $(cdbs_curpkg) ; \
75
 
        fi
76
 
 
77
 
clean::
78
 
        rm -f debian/*.doc-base.ocamldoc-apiref
79
 
 
80
 
# generate .in files counterpars before building, substituting @OCamlABI@
81
 
# markers with the proper value; clean stamps after building
82
 
pre-build:: ocamlinit
83
 
ocamlinit: ocamlinit-stamp
84
 
ocamlinit-stamp:
85
 
        for f in $(OCAML_IN_FILES) ; do \
86
 
                sed \
87
 
                        -e 's,@OCamlABI@,$(OCAML_ABI),g' \
88
 
                        -e 's,@OCamlStdlibDir@,$(OCAML_STDLIB_DIR),g' \
89
 
                        -e 's,@OCamlDllDir@,$(OCAML_DLL_DIR),g' \
90
 
                        $$f.in > $$f ; \
91
 
        done
92
 
        touch $@
93
 
clean::
94
 
        rm -f ocamlinit-stamp $(OCAML_IN_FILES)
95
 
 
96
 
# avoid dpatch breaking upon clean if debian/patches/*.in files are in use
97
 
deapply-dpatches: ocamlinit
98
 
 
99
 
# update debian/control substituting @OCamlNativeArchs@
100
 
# XXX ASSUMPTION: debian/control has already been generated, i.e. this rule is
101
 
# executed after the debian/control:: rule in builcore.mk
102
 
ifneq ($(DEB_AUTO_UPDATE_DEBIAN_CONTROL),)
103
 
debian/control::
104
 
        if test -f debian/control && test -f debian/control.in ; then \
105
 
                sed -i \
106
 
                        -e "s/@OCamlNativeArchs@/$(OCAML_NATIVE_ARCHS)/g" \
107
 
                        -e "s/@OCamlTeam@/$(OCAML_TEAM)/g" \
108
 
                        $@ ; \
109
 
        fi
110
 
endif
111
 
 
112
 
endif
113