guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

05/10: gnu: Add ocaml-bitstring.


From: David Craven
Subject: 05/10: gnu: Add ocaml-bitstring.
Date: Wed, 4 Jan 2017 16:41:24 +0000 (UTC)

dvc pushed a commit to branch master
in repository guix.

commit 44c23cb8d800ed3480755347b2dfee6a3544d727
Author: Julien Lepiller <address@hidden>
Date:   Fri Dec 30 11:33:36 2016 +0100

    gnu: Add ocaml-bitstring.
    
    * 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.
    
    Signed-off-by: David Craven <address@hidden>
---
 gnu/local.mk                                       |    1 +
 gnu/packages/ocaml.scm                             |   67 ++++++++++++++++++++
 .../patches/ocaml-bitstring-fix-configure.patch    |   53 ++++++++++++++++
 3 files changed, 121 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index 7e8b7c5..8feb139 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -752,6 +752,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 a1c7bc7..b999ee9 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -25,6 +25,7 @@
 
 (define-module (gnu packages ocaml)
   #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages curl)
@@ -42,6 +43,7 @@
   #:use-module (gnu packages python)
   #:use-module (gnu packages tex)
   #:use-module (gnu packages texinfo)
+  #:use-module (gnu packages time)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
@@ -1002,3 +1004,68 @@ 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")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/xguerin/bitstring";
+                                  "/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"))))))))
+    (home-page "https://github.com/xguerin/bitstring";)
+    (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 0000000..c358bf3
--- /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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]