[Pkg-ocaml-maint-commits] [SCM] dh-ocaml packaging branch, master, updated. debian/0.1-16-g9fea41f

Stephane Glondu steph at glondu.net
Tue Feb 17 10:34:19 UTC 2009


The following commit has been merged in the master branch:
commit 9fea41f1ebada4f619383d5823f35bc09e718ce1
Author: Stephane Glondu <steph at glondu.net>
Date:   Tue Feb 17 07:27:42 2009 +0100

    Various changes in Makefile snippets
    
     * fix inverted meaning of OCAML_HAVE_OCAMLOPT
     * use ?= more often
     * remove CDBS references when they are not needed
     * add OCAML_OPT_ARCH variable

diff --git a/share/ocamlinit.mk b/share/ocamlinit.mk
index 1f517e7..0dea2fd 100644
--- a/share/ocamlinit.mk
+++ b/share/ocamlinit.mk
@@ -1,5 +1,5 @@
 #
-# Description: Useful CDBS rules for OCaml related packages
+# Description: Useful Makefile rules for OCaml related packages
 #
 # Copyright © 2009 Stéphane Glondu <steph at glondu.net>
 #
@@ -19,14 +19,12 @@
 # 02110-1301 USA.
 #
 
-_cdbs_scripts_path ?= /usr/lib/cdbs
-_cdbs_rules_path ?= /usr/share/cdbs/1/rules
-_cdbs_class_path ?= /usr/share/cdbs/1/class
+_ocaml_share_path ?= /usr/share/ocaml
 
-ifndef _cdbs_rules_ocamlinit
-_cdbs_rules_ocamlinit = 1
+ifndef _ocaml_share_ocamlinit
+_ocaml_share_ocamlinit = 1
 
-include $(_cdbs_class_path)/ocaml-vars.mk$(_cdbs_makefile_suffix)
+include $(_ocaml_share_path)/ocamlvars.mk
 
 # list of .in files contained (non-recursively) in debian/ that requires
 # pre-build filling.
@@ -43,11 +41,12 @@ OCAMLINIT_SED := -e 's%^ \+%%' \
   -e 's%@OCamlStdlibDir@%$(OCAML_STDLIB_DIR)%' \
   -e 's%@OCamlDllDir@%$(OCAML_DLL_DIR)%'
 ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
-  OCAMLINIT_SED += -e '/^OPT: /d'
-else
   OCAMLINIT_SED += -e 's/^OPT: //'
+else
+  OCAMLINIT_SED += -e '/^OPT: /d'
 endif
 
+ocamlinit: ocamlinit-stamp
 ocamlinit-stamp:
 	for t in $(OCAML_IN_FILES); do \
 	  sed $(OCAMLINIT_SED) $$t.in > $$t; \
@@ -57,6 +56,6 @@ ocamlinit-stamp:
 ocamlinit-clean:
 	rm -f $(OCAML_IN_FILES)
 
-.PHONY: ocamlinit-clean
+.PHONY: ocamlinit ocamlinit-clean
 
 endif
diff --git a/share/ocamlvars.mk b/share/ocamlvars.mk
index d480ae1..8c02558 100644
--- a/share/ocamlvars.mk
+++ b/share/ocamlvars.mk
@@ -2,6 +2,7 @@
 # Description: Useful CDBS variables for OCaml related packages
 #
 # Copyright © 2006-2007 Stefano Zacchiroli <zack at debian.org>
+#           © 2009      Stéphane Glondu <steph at 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
@@ -18,44 +19,50 @@
 #
 # $Id: ocaml-vars.mk 4643 2007-10-18 00:21:51Z gildor $
 
-_cdbs_scripts_path ?= /usr/lib/cdbs
-_cdbs_rules_path ?= /usr/share/cdbs/1/rules
-_cdbs_class_path ?= /usr/share/cdbs/1/class
+_ocaml_share_path ?= /usr/share/ocaml
 
-ifndef _cdbs_class_ocaml_vars
-_cdbs_class_ocaml_vars = 1
+ifndef _ocaml_share_vars
+_ocaml_share_vars = 1
 
 # current OCaml ABI version (e.g. 3.10.0).
 # Used internally by ocaml.mk (substituted for @OCamlABI@ in $(OCAML_IN_FILES)
 # below), may be useful to debian/rules writers as well
-OCAML_ABI := $(shell /usr/bin/ocamlc -version)
+OCAML_ABI ?= $(shell /usr/bin/ocamlc -version)
 
 # OCaml standard library location.
 # Used internally by ocaml.mk (substituted for @OCamlStdlibDir@ in
 # $(OCAML_IN_FILES) below), may be useful to debian/rules writers as well
-OCAML_STDLIB_DIR := $(shell /usr/bin/ocamlc -where)
+OCAML_STDLIB_DIR ?= $(shell /usr/bin/ocamlc -where)
 
 # OCaml stublibs (i.e. DLLs) location.
 # Used internally by ocaml.mk (substituted for @OCamlDllDir@) in
 # $(OCAML_IN_FILES) below), may be useful to debian/rules writers as well
-OCAML_DLL_DIR := $(OCAML_STDLIB_DIR)/stublibs
+OCAML_DLL_DIR ?= $(OCAML_STDLIB_DIR)/stublibs
 
 # list of .in files contained (non-recursively) in debian/ that requires
 # pre-build filling.
 # Used internally by ocaml.mk.
 # 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)))
+OCAML_IN_FILES ?= $(filter-out debian/control,$(patsubst %.in,%,$(wildcard debian/*.in)))
 
 # 'yes' if native code compilation is available on the build architecture, 'no' otherwise.
 # For debian/rules writers.
-OCAML_HAVE_OCAMLOPT := $(shell if test -x /usr/bin/ocamlopt ; then echo "yes" ; else echo "no" ; fi)
+OCAML_HAVE_OCAMLOPT ?= $(shell if test -x /usr/bin/ocamlopt ; then echo "yes" ; else echo "no" ; fi)
 
 # space separated list of Debian architectures supporting OCaml native code
 # compilation.
 # Used internally by ocaml.mk and substituted in debian/control.in for the
 # @OCamlNativeArchs@ marker; may be useful to debian/rules writers as well
-OCAML_NATIVE_ARCHS := $(shell cat $(OCAML_STDLIB_DIR)/native-archs)
+OCAML_NATIVE_ARCHS ?= $(shell cat $(OCAML_STDLIB_DIR)/native-archs)
+
+# OCAML_OPT_ARCH will (should?) be non-empty on native architectures
+# This allows to use directly the if function of make
+# ...should we enforce coherence with OCAML_HAVE_OCAMLOPT?
+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_BUILD_ARCH      ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
+OCAML_OPT_ARCH      ?= $(findstring $(DEB_BUILD_ARCH),$(OCAML_NATIVE_ARCHS))
 
 # comma separated list of members of the OCaml team.
 # Substituted in debian/control.in for the @OCamlTeam@ marker
@@ -72,11 +79,11 @@ OCAML_TEAM += Sylvain Le Gall <gildor at debian.org>
 # space separated list of packages matching the naming convention for OCaml
 # development libraries, i.e. libXXX-ocaml-dev.
 # For debian/rules writers
-OCAML_LIBDEV_PACKAGES := $(filter lib%-ocaml-dev,$(DEB_PACKAGES))
+OCAML_LIBDEV_PACKAGES ?= $(filter lib%-ocaml-dev,$(DEB_PACKAGES))
 
 # as above, but keep packages matching the convention for OCaml runtime
 # libraries, i.e. libXX-ocaml
-OCAML_LIB_PACKAGES := $(filter lib%-ocaml,$(DEB_PACKAGES))
+OCAML_LIB_PACKAGES ?= $(filter lib%-ocaml,$(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
@@ -87,7 +94,7 @@ OCAML_LIB_PACKAGES := $(filter lib%-ocaml,$(DEB_PACKAGES))
 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 
+# 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
@@ -114,7 +121,6 @@ OCAML_OCAMLDOC_FLAGS_MAN = -man-mini
 # 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 = $(shell $(_cdbs_class_path)/ocamldoc-api-ref-config --html-directory $(cdbs_curpkg))
+OCAML_OCAMLDOC_DESTDIR_HTML ?= $(shell $(_ocaml_share_path)/ocamldoc-api-ref-config --html-directory $(cdbs_curpkg))
 
 endif
-

-- 
dh-ocaml packaging



More information about the Pkg-ocaml-maint-commits mailing list