[Pkg-ocaml-maint-commits] [ocamlbuild] 02/02: Fix logic for bytecode vs native builds

Ximin Luo infinity0 at debian.org
Fri Sep 30 10:38:48 UTC 2016


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository ocamlbuild.

commit 7141320a1511e75341a5d8457fa40a902e79a77f
Author: Ximin Luo <infinity0 at debian.org>
Date:   Fri Sep 30 12:38:20 2016 +0200

    Fix logic for bytecode vs native builds
---
 debian/control |  3 +--
 debian/rules   | 29 ++++++++++++-----------------
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/debian/control b/debian/control
index b6e47f6..8736a50 100644
--- a/debian/control
+++ b/debian/control
@@ -11,8 +11,7 @@ Vcs-Browser: https://anonscm.debian.org/cgit/pkg-ocaml-maint/packages/ocamlbuild
 
 Package: ocamlbuild
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends},
- ocaml-base-nox | ocaml-base | ocaml-nox | ocaml
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${F:OCamlRun}
 # FIXME: ask if the below is really the best solution
 Replaces: libfindlib-ocaml (<< 1.6.2+), ocaml-nox (<< 4.02.3+)
 Description: Build tool for building OCaml library and programs
diff --git a/debian/rules b/debian/rules
index be64919..162d2ce 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,36 +4,31 @@
 #export DH_VERBOSE = 1
 
 
-# see FEATURE AREAS in dpkg-buildflags(1)
-#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-
-# see ENVIRONMENT in dpkg-buildflags(1)
-# package maintainers to append CFLAGS
-#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
-# package maintainers to append LDFLAGS
-#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
-
-
 %:
 	dh $@
 
+# see https://pkg-ocaml-maint.alioth.debian.org/ocaml_packaging_policy.txt
+OCAMLABI = $(shell ocamlc -version)
+# to test a bytecode build on an architecture with ocamlopt, set this to "yes"
+BYTECODE = $(shell [ -x /usr/bin/ocamlopt ] || echo yes)
+OCAMLRUN = $(if $(BYTECODE),ocaml-base-nox-$(OCAMLABI))
+OCAML_NATIVE = $(if $(BYTECODE),false,true)
+
 OCAMLBUILD_CFG = \
  OCAMLBUILD_PREFIX=/usr \
  OCAMLBUILD_BINDIR=/usr/bin \
  OCAMLBUILD_LIBDIR=/usr/lib/ocaml
 
 override_dh_auto_configure:
-	if [ -x /usr/bin/ocamlopt ]; then \
-	  $(MAKE) $(OCAMLBUILD_CFG) OCAML_NATIVE=true configure; \
-	else \
-	  $(MAKE) $(OCAMLBUILD_CFG) OCAML_NATIVE=false configure; \
-	fi
+	$(MAKE) $(OCAMLBUILD_CFG) OCAML_NATIVE=$(OCAML_NATIVE) configure
 
 override_dh_auto_install:
 	dh_auto_install -- CHECK_IF_PREINSTALLED=false
-	cd debian/ocamlbuild/usr/bin && mv ocamlbuild.byte ocamlbuild
-	cd debian/ocamlbuild/usr/bin && test ! -f ocamlbuild.native || mv ocamlbuild.native ocamlbuild.opt
+	cd debian/ocamlbuild/usr/bin && rm ocamlbuild.byte ocamlbuild.native
 
 override_dh_auto_clean:
 	dh_auto_clean
 	find . -name '*.cmti' -delete
+
+override_dh_gencontrol:
+	dh_gencontrol -- -VF:OCamlRun="$(OCAMLRUN)"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/ocamlbuild.git



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