From a5b5bd1d18f32c29e704acae24c3e1945666afb9 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Fri, 30 Dec 2016 11:17:17 +0100 Subject: [PATCH] gnu: Add ocaml-bisect. * gnu/packages/ocaml.scm (ocaml-bisect): New variable. * gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch: New file. * gnu/local.mk (dist_patch_DATA): Add patch. Signed-off-by: David Craven --- gnu/local.mk | 1 + gnu/packages/ocaml.scm | 42 ++++++ ...sect-fix-camlp4-in-another-directory.patch | 125 ++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch diff --git a/gnu/local.mk b/gnu/local.mk index 860d16d910..7e8b7c5033 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -751,6 +751,7 @@ dist_patch_DATA = \ %D%/packages/patches/nvi-assume-preserve-path.patch \ %D%/packages/patches/nvi-dbpagesize-binpower.patch \ %D%/packages/patches/nvi-db4.patch \ + %D%/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch \ %D%/packages/patches/ocaml-CVE-2015-8869.patch \ %D%/packages/patches/ocaml-Add-a-.file-directive.patch \ %D%/packages/patches/ocaml-findlib-make-install.patch \ diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm index 0a362b1f92..a1c7bc7155 100644 --- a/gnu/packages/ocaml.scm +++ b/gnu/packages/ocaml.scm @@ -960,3 +960,45 @@ (define-public ocaml-stringext ;; the only mention of a license in this project is in its `opam' file ;; where it says `mit'. (license license:expat))) + + +(define-public ocaml-bisect + (package + (name "ocaml-bisect") + (version "1.3") + (source (origin + (method url-fetch) + (uri (ocaml-forge-uri "bisect" version 1051)) + (sha256 + (base32 + "0kcg2rh0qlkfpbv3nhcb75n62b04gbrz0zasq15ynln91zd5qrg0")) + (patches + (search-patches + "ocaml-bisect-fix-camlp4-in-another-directory.patch")))) + (build-system ocaml-build-system) + (native-inputs + `(("camlp4" ,camlp4) + ("libxml2" ,libxml2) + ("which" ,which))) + (propagated-inputs + `(("camlp4" ,camlp4))) + (arguments + `(#:test-target "tests" + #:make-flags + (list "all" (string-append "CAMLP4_LIBDIR=" + (assoc-ref %build-inputs "camlp4") + "/lib/ocaml/site-lib/camlp4")) + #:phases + (modify-phases %standard-phases + (replace 'configure + (lambda* (#:key outputs #:allow-other-keys) + (zero? (system* "./configure" "-prefix" + (assoc-ref outputs "out")))))))) + (home-page "http://bisect.x9c.fr") + (synopsis "Code coverage tool for the OCaml language") + (description "Bisect is a code coverage tool for the OCaml language. It is +a camlp4-based tool that allows to instrument your application before running +tests. After application execution, it is possible to generate a report in HTML +format that is the replica of the application source code annotated with code +coverage information.") + (license license:gpl3+))) diff --git a/gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch b/gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch new file mode 100644 index 0000000000..2056b42356 --- /dev/null +++ b/gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch @@ -0,0 +1,125 @@ +From 26cac62fe0154cf65c06faaee10805531e9dade8 Mon Sep 17 00:00:00 2001 +From: Julien Lepiller +Date: Wed, 14 Dec 2016 14:14:59 +0100 +Subject: [PATCH] fix camlp4 in another directory + +--- + Makefile | 11 ++++++----- + configure | 13 ++++++++++++- + myocamlbuild.ml | 2 +- + 3 files changed, 19 insertions(+), 7 deletions(-) + +diff --git a/Makefile b/Makefile +index 4a8ce17..d94a6d5 100644 +--- a/Makefile ++++ b/Makefile +@@ -25,7 +25,7 @@ PATH_BUILD=$(PATH_BASE)/_build + PATH_OCAMLDOC=$(PATH_BASE)/ocamldoc + PATH_SRC=$(PATH_BASE)/src + PATH_TESTS=$(PATH_BASE)/tests +-PATH_INSTALL=$(PATH_OCAML_PREFIX)/lib/ocaml/bisect ++PATH_INSTALL=$(PREFIX)/lib/ocaml/bisect + + + # DEFINITIONS +@@ -33,7 +33,8 @@ PATH_INSTALL=$(PATH_OCAML_PREFIX)/lib/ocaml/bisect + PROJECT_NAME=bisect + OCAMLBUILD=$(PATH_OCAML_PREFIX)/bin/ocamlbuild + OCAMLBUILD_ENV=WARNINGS=$(WARNINGS) PATH_OCAML_PREFIX=$(PATH_OCAML_PREFIX) +-OCAMLBUILD_FLAGS=-classic-display -no-links ++CAMLP4_INCLUDE=$(shell test -z $(CAMLP4_LIBDIR) || echo "-cflags -I,$(CAMLP4_LIBDIR)") ++OCAMLBUILD_FLAGS=-classic-display -no-links $(CAMLP4_INCLUDE) + MODULES_ODOCL=$(PROJECT_NAME).odocl + MODULES_MLPACK=$(PROJECT_NAME).mlpack + MODULES_MLPACK_PP=$(PROJECT_NAME)_pp.mlpack +@@ -80,11 +81,11 @@ veryclean: clean + rm -f $(PATH_OCAMLDOC)/*.html $(PATH_OCAMLDOC)/*.css + + install: FORCE +- cp $(PATH_BUILD)/src/report/report.byte $(PATH_OCAML_PREFIX)/bin/bisect-report; \ ++ cp $(PATH_BUILD)/src/report/report.byte $(PREFIX)/bin/bisect-report; \ + if [ "$(PPX)" = "TRUE" ]; then \ +- cp $(PATH_BUILD)/src/syntax/bisect_ppx.byte $(PATH_OCAML_PREFIX)/bin; \ ++ cp $(PATH_BUILD)/src/syntax/bisect_ppx.byte $(PREFIX)/bin; \ + fi; \ +- (test -x $(PATH_OCAML_PREFIX)/bin/ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PATH_OCAML_PREFIX)/bin/bisect-report.opt || true); \ ++ (test -x $(PATH_OCAML_PREFIX)/bin/ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PREFIX)/bin/bisect-report.opt || true); \ + if [ -x "$(PATH_OCAMLFIND)" ]; then \ + $(PATH_OCAMLFIND) query $(PROJECT_NAME) && $(PATH_OCAMLFIND) remove $(PROJECT_NAME) || true; \ + $(PATH_OCAMLFIND) install $(PROJECT_NAME) META -optional \ +diff --git a/configure b/configure +index bb7ebf4..61a3095 100755 +--- a/configure ++++ b/configure +@@ -21,7 +21,9 @@ + # default values + ocamlbuild=`which ocamlbuild || echo '/usr/local/bin/ocamlbuild'` + bin_path=`dirname $ocamlbuild` ++prefix='' + ocaml_prefix=`dirname $bin_path` ++camlp4_prefix=`dirname $(dirname $(which camlp4of))` + ocamlfind=`which ocamlfind 2> /dev/null || echo ''` + native_dynlink='TRUE' + devel='FALSE' +@@ -32,8 +34,12 @@ ppx='FALSE' + while [ $# -gt 0 ] + do + case "$1" in ++ -prefix) ++ prefix="$2"; shift;; + -ocaml-prefix) + ocaml_prefix="$2"; shift;; ++ -camlp4-prefix) ++ camlp4_prefix="$2"; shift;; + -ocamlfind) + ocamlfind="$2"; shift;; + -no-native-dynlink) +@@ -45,7 +51,7 @@ do + -ppx) + ppx='TRUE';; + *) +- echo "usage: $0 [-ocaml-prefix ] [-ocamlfind ] [-no-native-dynlink] [-devel]"; ++ echo "usage: $0 [-prefix ] [-ocaml-prefix ] [-ocamlfind ] [-no-native-dynlink] [-devel]"; + exit 1;; + esac + shift +@@ -57,6 +63,9 @@ if [ "$no_camlp4" = "TRUE" -a "$ppx" = "FALSE" ]; then + exit 1 + fi + ++# prefix default value ++test -z $prefix && prefix=$ocaml_prefix ++ + # make options + make_quiet=`make -f - < Makefile.config + echo "PATH_OCAML_PREFIX=$ocaml_prefix" >> Makefile.config ++echo "PATH_CAMLP4_PREFIX=$camlp4_prefix" >> Makefile.config + echo "PATH_OCAMLFIND=$ocamlfind" >> Makefile.config + echo "NATIVE_DYNLINK=$native_dynlink" >> Makefile.config + echo "WARNINGS=$devel" >> Makefile.config + echo "NO_CAMLP4=$no_camlp4" >> Makefile.config + echo "PPX=$ppx" >> Makefile.config + echo "MAKE_QUIET=$make_quiet" >> Makefile.config ++echo "PREFIX=$prefix" >> Makefile.config + echo "" >> Makefile.config + echo 'Makefile.config successfully created' +diff --git a/myocamlbuild.ml b/myocamlbuild.ml +index 8aa25fd..09a7d48 100644 +--- a/myocamlbuild.ml ++++ b/myocamlbuild.ml +@@ -70,7 +70,7 @@ let () = + | After_rules -> + let camlp4of = + try +- let path_bin = Filename.concat (Sys.getenv "PATH_OCAML_PREFIX") "bin" in ++ let path_bin = Filename.concat (Sys.getenv "PATH_CAMLP4_PREFIX") "bin" in + Filename.concat path_bin "camlp4of" + with _ -> "camlp4of" in + flag ["ocaml"; "compile"; "pp_camlp4of"] (S[A"-pp"; A camlp4of]); +-- +2.7.4 +