Add dh-ocaml's old ocamlinit.mk since ocaml itself cannot use dh_ocamlinit
authorStephane Glondu <steph@glondu.net>
Tue, 22 Sep 2009 22:07:29 +0000 (00:07 +0200)
committerStephane Glondu <steph@glondu.net>
Tue, 22 Sep 2009 22:07:49 +0000 (00:07 +0200)
debian/ocamlinit.mk [new file with mode: 0644]
debian/rules

diff --git a/debian/ocamlinit.mk b/debian/ocamlinit.mk
new file mode 100644 (file)
index 0000000..5db3412
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Description: Useful Makefile rules for OCaml related packages
+#
+# Copyright © 2009 Stéphane Glondu <steph@glondu.net>
+#
+# 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 Street, Fifth Floor, Boston, MA
+# 02110-1301 USA.
+#
+
+_ocaml_share_path ?= /usr/share/ocaml
+
+ifndef _ocaml_share_ocamlinit
+_ocaml_share_ocamlinit = 1
+
+include $(_ocaml_share_path)/ocamlvars.mk
+
+# list of .in files contained (non-recursively) in debian/ that requires
+# pre-build filling.
+# debian/rules writers might need to add stuff to this list:
+#  e.g.: OCAML_IN_FILES += debian/patches/foo  # (no .in extension)
+OCAML_IN_FILES ?= $(filter-out debian/control,$(patsubst %.in,%,$(wildcard debian/*.in)))
+
+# WARNING: there are currently duplications with ocamlvars.mk and
+# ocaml.mk, but hopefully they will be removed at some point in the
+# future
+
+OCAMLINIT_SED := \
+  -e 's%@OCamlABI@%$(OCAML_ABI)%g' \
+  -e 's%@OCamlStdlibDir@%$(OCAML_STDLIB_DIR)%g' \
+  -e 's%@OCamlDllDir@%$(OCAML_DLL_DIR)%g'
+ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
+  OCAMLINIT_SED += -e 's/^OPT: //' -e '/^BYTE: /d'
+else
+  OCAMLINIT_SED += -e '/^OPT: /d' -e 's/^BYTE: //'
+endif
+
+ocamlinit: ocamlinit-stamp
+ocamlinit-stamp:
+       for t in $(OCAML_IN_FILES); do \
+         sed $(OCAMLINIT_SED) $$t.in > $$t; \
+       done
+       touch $@
+
+ocamlinit-clean:
+       rm -f ocamlinit-stamp $(OCAML_IN_FILES)
+
+.PHONY: ocamlinit ocamlinit-clean
+
+endif
index 0ef05b6b4ba03d3c9d9ce022b92c607c6162308a..811cd4c1859af882e92aa0986d8368d2b9880284 100755 (executable)
@@ -17,14 +17,16 @@ DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
 OCAML_OPT_ARCH := $(findstring $(DEB_BUILD_ARCH),$(OCAML_NATIVE_ARCHS))
 OCAML_HAVE_OCAMLOPT := $(if $(OCAML_OPT_ARCH),yes,no)
 OCAML_OCAMLDOC_DESTDIR_HTML =
-include /usr/share/ocaml/ocamlinit.mk
+
+# dh_ocamlinit cannot be used for ocaml itself
+include debian/ocamlinit.mk
 
 MD5SUMSDIR = /var/lib/ocaml/md5sums
 INSTDIR = $(CURDIR)/debian/tmp/usr
 DISTDIR = $(PACKAGE)-$(OCAML_ABI)
 SRCTARBALL = $(PACKAGE)-source-$(OCAML_ABI).tar.bz2
 
-# Environment variable for dh_ocaml 
+# Environment variable for dh_ocaml
 OCAMLBYTEINFO = boot/ocamlrun debian/ocamlbyteinfo/ocamlbyteinfo
 OCAMLPLUGININFO = debian/ocamlbyteinfo/ocamlplugininfo
 OCAMLDUMPAPPROX = boot/ocamlrun tools/dumpapprox