[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 16/96] gnu: Add ocaml-bitstring
From: |
Julien Lepiller |
Subject: |
[PATCH 16/96] gnu: Add ocaml-bitstring |
Date: |
Tue, 3 Jan 2017 20:10:57 +0100 |
* gnu/packages/ocaml.scm (ocaml-bitstring): New variable.
* gnu/packages/patches/ocaml-bitstring-fix-configure.patch: New file.
* gnu/local.mk (dist_patch_DATA): New patch.
---
gnu/local.mk | 1 +
gnu/packages/ocaml.scm | 62 ++++++++++++++++++++++
.../patches/ocaml-bitstring-fix-configure.patch | 53 ++++++++++++++++++
3 files changed, 116 insertions(+)
create mode 100644 gnu/packages/patches/ocaml-bitstring-fix-configure.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index cc46b4749..3e8517117 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -751,6 +751,7 @@ dist_patch_DATA =
\
%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-bitstring-fix-configure.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 f3f76eb1d..9814e10d2 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -32,6 +32,7 @@
#:use-module (guix build-system gnu)
#:use-module (guix build-system ocaml)
#:use-module (gnu packages)
+ #:use-module (gnu packages autotools)
#:use-module (gnu packages gcc)
#:use-module (gnu packages gnome)
#:use-module (gnu packages gtk)
@@ -49,6 +50,7 @@
#:use-module (gnu packages m4)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages ncurses)
+ #:use-module (gnu packages time)
#:use-module (gnu packages version-control)
#:use-module (gnu packages xml)
#:use-module (gnu packages curl))
@@ -965,3 +967,63 @@ 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+)))
+
+(define-public ocaml-bitstring
+ (package
+ (name "ocaml-bitstring")
+ (version "2.1.0")
+ (home-page "https://github.com/xguerin/bitstring/")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append home-page "archive/v" version ".tar.gz"))
+ (sha256
+ (base32
+ "0miw4banfpmx4kxrckpqr57b1fcmsqdmspyjx6gqjd4kghm4l7xj"))
+ (patches (search-patches
"ocaml-bitstring-fix-configure.patch"))))
+ (build-system ocaml-build-system)
+ (native-inputs `(("camlp4" ,camlp4)
+ ("time" ,time)
+ ("autoconf" ,autoconf)
+ ("automake" ,automake)
+ ("bisect" ,ocaml-bisect)))
+ (propagated-inputs `(("camlp4" ,camlp4)))
+ (arguments `(#:configure-flags
+ (list "CAMLP4OF=camlp4of" "--enable-coverage")
+ #:make-flags
+ (list (string-append "BISECTLIB="
+ (assoc-ref %build-inputs "bisect")
+ "/lib/ocaml/site-lib")
+ (string-append "OCAMLCFLAGS=-g -I "
+ (assoc-ref %build-inputs "camlp4")
+ "/lib/ocaml/site-lib/camlp4 -I "
+ "$(BISECTLIB)/bisect")
+ (string-append "OCAMLOPTFLAGS=-g -I "
+ (assoc-ref %build-inputs "camlp4")
+ "/lib/ocaml/site-lib/camlp4 -I "
+ "$(BISECTLIB)/bisect"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'configure 'fix-configure
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "Makefile.in"
+ (("@abs_top_builddir@") (string-append
"@abs_top_builddir@:" (getenv "LIBRARY_PATH"))))
+ (substitute* "configure"
+ (("-/bin/sh") (string-append "-" (assoc-ref inputs
"bash")
+ "/bin/sh")))))
+ (add-after 'install 'link-lib
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (stubs (string-append out
+ "/lib/ocaml/site-lib/stubslibs"))
+ (lib (string-append out
+ "/lib/ocaml/site-lib/bitstring")))
+ (mkdir-p stubs)
+ (symlink (string-append lib "/dllbitstring.so")
+ (string-append stubs
"/dllbitstring.so"))))))))
+ (synopsis "Bitstrings and bitstring matching for OCaml")
+ (description "Adds Erlang-style bitstrings and matching over bitstrings as
+a syntax extension and library for OCaml. You can use this module to both
parse
+and generate binary formats, files and protocols. Bitstring handling is added
+as primitives to the language, making it exceptionally simple to use and very
+powerful.")
+ (license license:isc)))
diff --git a/gnu/packages/patches/ocaml-bitstring-fix-configure.patch
b/gnu/packages/patches/ocaml-bitstring-fix-configure.patch
new file mode 100644
index 000000000..c358bf3d6
--- /dev/null
+++ b/gnu/packages/patches/ocaml-bitstring-fix-configure.patch
@@ -0,0 +1,53 @@
+From 0aaddfceeea3e89df196ab1846da54d09713a512 Mon Sep 17 00:00:00 2001
+From: Julien Lepiller <address@hidden>
+Date: Thu, 15 Dec 2016 21:17:31 +0100
+Subject: [PATCH] fix configure
+
+---
+ Makefile.in | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index d040f4c..85e0b38 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -32,6 +32,7 @@ BISECT_REPORT = @BISECT_REPORT@
+ BYTESWAP_H = @BYTESWAP_H@
+
+ OCAMLLIB = @OCAMLLIB@
++BISECTLIB = $(shell if test -z $${BISECTLIB}; then echo $(OCAMLLIB); else
echo $${BISECTLIB}; fi)
+ top_srcdir = @top_srcdir@
+
+ pkg_cil = @OCAML_PKG_cil@
+@@ -47,9 +48,9 @@ OCAMLOPTPACKAGES = $(OCAMLCPACKAGES)
+ OCAMLOPTLIBS = -linkpkg
+
+ ifneq ($(enable_coverage),no)
+-OCAMLCFLAGS += -I +bisect -pp 'camlp4o $(OCAMLLIB)/bisect/instrument.cma'
++OCAMLCFLAGS += -I +bisect -pp 'camlp4o $(BISECTLIB)/bisect/instrument.cma'
+ OCAMLCLIBS += -I +bisect bisect.cma
+-OCAMLOPTFLAGS += -I +bisect -pp 'camlp4o $(OCAMLLIB)/bisect/instrument.cma'
++OCAMLOPTFLAGS += -I +bisect -pp 'camlp4o $(BISECTLIB)/bisect/instrument.cma'
+ OCAMLOPTLIBS += -I +bisect bisect.cmxa
+ endif
+
+@@ -110,7 +111,7 @@ bitstring_persistent.cmi: bitstring_persistent.mli
+ -I +camlp4 -pp camlp4of -c $<
+
+ pa_bitstring.cmo: pa_bitstring.ml bitstring.cma bitstring_persistent.cma
+- $(OCAMLFIND) ocamlc bitstring.cma -I +camlp4 dynlink.cma camlp4lib.cma \
++ $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) bitstring.cma -I +camlp4 dynlink.cma
camlp4lib.cma \
+ -pp camlp4of -c $< -o $@
+
+ bitstring-objinfo: bitstring_objinfo.cmo bitstring.cma
bitstring_persistent.cma
+@@ -133,7 +134,7 @@ byteswap.h: byteswap.in.h
+ ifeq ($(enable_coverage),no)
+ PP = -pp 'camlp4o bitstring.cma bitstring_persistent.cma pa_bitstring.cmo'
+ else
+-PP = -pp 'camlp4o $(OCAMLLIB)/bisect/bisect.cma bitstring.cma
bitstring_persistent.cma pa_bitstring.cmo'
++PP = -pp 'camlp4o $(BISECTLIB)/bisect/bisect.cma bitstring.cma
bitstring_persistent.cma pa_bitstring.cmo'
+ endif
+
+ check: test
+--
+2.11.0
--
2.11.0
- [PATCH 09/96] gnu: Add camlzip, (continued)
- [PATCH 11/96] gnu: Add ocaml-zarith., Julien Lepiller, 2017/01/03
- [PATCH 12/96] gnu: Add ocaml-frontc, Julien Lepiller, 2017/01/03
- [PATCH 13/96] gnu: Add ocaml-qtest, Julien Lepiller, 2017/01/03
- [PATCH 14/96] gnu: Add ocaml-stringext, Julien Lepiller, 2017/01/03
- [PATCH 15/96] gnu: Add ocaml-bisect, Julien Lepiller, 2017/01/03
- [PATCH 17/96] gnu: Add ocaml-result, Julien Lepiller, 2017/01/03
- [PATCH 16/96] gnu: Add ocaml-bitstring,
Julien Lepiller <=
- [PATCH 18/96] gnu: Add ocaml-topkg, Julien Lepiller, 2017/01/03
- [PATCH 19/96] gnu: Add ocaml-rresult, Julien Lepiller, 2017/01/03
- [PATCH 20/96] gnu: Add ocaml-mtime, Julien Lepiller, 2017/01/03
- [PATCH 21/96] gnu: Add ocaml-cmdliner, Julien Lepiller, 2017/01/03
- [PATCH 22/96] gnu: Add ocaml-fmt, Julien Lepiller, 2017/01/03
- [PATCH 23/96] gnu: Add ocaml-astring, Julien Lepiller, 2017/01/03
- [PATCH 24/96] gnu: Add ocaml-alcotest, Julien Lepiller, 2017/01/03
- [PATCH 25/96] gnu: Add ocaml-ppx-tools, Julien Lepiller, 2017/01/03
- [PATCH 26/96] gnu: Add ocaml-react, Julien Lepiller, 2017/01/03
- [PATCH 27/96] gnu: Add ocaml-ssl, Julien Lepiller, 2017/01/03