Import ocaml-bitstring.
Port from Daniel Dickman (didickman at gmail dot com) with a few tweaks by me. ok dcoppa@ The ocaml-bitstring project 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. Bitstring handles integers, strings, sub-bitstrings, big-, little- and native-endianness, signed and unsigned types, variable-width fields, and fields with arbitrary bit alignment.
This commit is contained in:
parent
d952928b21
commit
7c1f0c2975
30
devel/ocaml-bitstring/Makefile
Normal file
30
devel/ocaml-bitstring/Makefile
Normal file
@ -0,0 +1,30 @@
|
||||
# $OpenBSD: Makefile,v 1.1.1.1 2013/12/05 14:38:18 jca Exp $
|
||||
|
||||
COMMENT= Erlang-style bitstrings for OCaml
|
||||
|
||||
DISTNAME= ocaml-bitstring-2.0.4
|
||||
|
||||
CATEGORIES= devel
|
||||
|
||||
HOMEPAGE= https://bitstring.googlecode.com/
|
||||
|
||||
# LGPLv2+ with the OCaml linking exception (see COPYING.LIB)
|
||||
# GPLv2+ for programs (see COPYING)
|
||||
# examples and tests are public domain.
|
||||
PERMIT_PACKAGE_CDROM= Yes
|
||||
|
||||
MASTER_SITES= https://bitstring.googlecode.com/files/
|
||||
|
||||
MODULES= lang/ocaml
|
||||
BUILD_DEPENDS= sysutils/findlib
|
||||
|
||||
.include <bsd.port.arch.mk>
|
||||
.if ! ${PROPERTIES:Mocaml_native}
|
||||
MAKE_FLAGS+= NATIVE=
|
||||
.endif
|
||||
|
||||
USE_GMAKE= yes
|
||||
CONFIGURE_STYLE= gnu
|
||||
CONFIGURE_ENV= ac_cv_prog_CAMLP4OF=camlp4of
|
||||
|
||||
.include <bsd.port.mk>
|
2
devel/ocaml-bitstring/distinfo
Normal file
2
devel/ocaml-bitstring/distinfo
Normal file
@ -0,0 +1,2 @@
|
||||
SHA256 (ocaml-bitstring-2.0.4.tar.gz) = xWNQlqra8MTgFXs58uts1BwpMQXlq1DlzwwXTYX9V1U=
|
||||
SIZE (ocaml-bitstring-2.0.4.tar.gz) = 163346
|
112
devel/ocaml-bitstring/patches/patch-Makefile_in
Normal file
112
devel/ocaml-bitstring/patches/patch-Makefile_in
Normal file
@ -0,0 +1,112 @@
|
||||
$OpenBSD: patch-Makefile_in,v 1.1.1.1 2013/12/05 14:38:18 jca Exp $
|
||||
|
||||
- first hunk: Allow this to compile as per:
|
||||
https://code.google.com/p/bitstring/issues/detail?id=20
|
||||
- second hunk: don't attempt to build the cil tools
|
||||
https://groups.google.com/d/msg/bitstring/EIw9u0E_OQ0/rs7cwnvzgmsJ
|
||||
- other hunks: compile (and test) native output when NATIVE == "native"
|
||||
|
||||
--- Makefile.in.orig Tue May 14 17:42:32 2013
|
||||
+++ Makefile.in Thu Dec 5 00:58:55 2013
|
||||
@@ -32,6 +32,7 @@ BISECT_REPORT = @BISECT_REPORT@
|
||||
BYTESWAP_H = @BYTESWAP_H@
|
||||
|
||||
OCAMLLIB = @OCAMLLIB@
|
||||
+srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
pkg_cil = @OCAML_PKG_cil@
|
||||
@@ -66,7 +67,7 @@ export LD_LIBRARY_PATH
|
||||
SUBDIRS =
|
||||
ifneq ($(pkg_cil),no)
|
||||
ifneq ($(pkg_extlib),no)
|
||||
-SUBDIRS += cil-tools
|
||||
+#SUBDIRS += cil-tools
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -76,13 +77,18 @@ TESTS = $(patsubst %.ml,%,$(wildcard tests/*.ml))
|
||||
|
||||
BENCHMARKS = $(patsubst %.ml,%,$(wildcard benchmarks/*.ml))
|
||||
|
||||
+NATIVE ?= native
|
||||
+
|
||||
all: $(BYTESWAP_H) \
|
||||
bitstring.cma bitstring_persistent.cma \
|
||||
- bitstring.cmxa bitstring_persistent.cmxa \
|
||||
pa_bitstring.cmo \
|
||||
+ $(NATIVE) \
|
||||
bitstring-objinfo
|
||||
@for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
|
||||
|
||||
+native: $(BYTESWAP_H) \
|
||||
+ bitstring.cmxa bitstring_persistent.cmxa
|
||||
+
|
||||
bitstring.cma: bitstring_types.cmo bitstring_config.cmo \
|
||||
bitstring_c.o bitstring.cmo bitmatch.cmo
|
||||
$(OCAMLMKLIB) -o bitstring $^
|
||||
@@ -136,22 +142,34 @@ else
|
||||
PP = -pp 'camlp4o $(OCAMLLIB)/bisect/bisect.cma bitstring.cma bitstring_persistent.cma pa_bitstring.cmo'
|
||||
endif
|
||||
|
||||
-check: test
|
||||
+check: test test-native
|
||||
|
||||
-test: pa_bitstring.cmo \
|
||||
- bitstring.cma bitstring_persistent.cma \
|
||||
- bitstring.cmxa bitstring_persistent.cmxa \
|
||||
+test: all \
|
||||
tests/test.bmpp
|
||||
@for f in $(TESTS); do \
|
||||
- echo Building $$f; \
|
||||
+ echo "Building $$f (bytecode)"; \
|
||||
+ $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) -package unix $(OCAMLCLIBS) -I . bitstring.cma $$f.ml -o $$f.byte; \
|
||||
+ if [ $$? -ne 0 ]; then exit 1; fi; \
|
||||
+ echo "Running $$f (bytecode)"; \
|
||||
+ $$f.byte; \
|
||||
+ if [ $$? -ne 0 ]; then exit 1; fi; \
|
||||
+ done
|
||||
+ @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
|
||||
+
|
||||
+test-native: all \
|
||||
+ tests/test.bmpp
|
||||
+ifeq ($(NATIVE), native)
|
||||
+ @for f in $(TESTS); do \
|
||||
+ echo "Building $$f (native)"; \
|
||||
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(PP) -package unix $(OCAMLOPTLIBS) -I . bitstring.cmxa $$f.ml -o $$f.opt; \
|
||||
if [ $$? -ne 0 ]; then exit 1; fi; \
|
||||
- echo Running $$f; \
|
||||
+ echo "Running $$f (native)"; \
|
||||
$$f.opt; \
|
||||
if [ $$? -ne 0 ]; then exit 1; fi; \
|
||||
done
|
||||
- @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
|
||||
+endif
|
||||
|
||||
+
|
||||
tests/test.bmpp: create_test_pattern
|
||||
./$< $@.new
|
||||
mv $@.new $@
|
||||
@@ -271,10 +289,11 @@ endif
|
||||
# Install.
|
||||
|
||||
install:
|
||||
- ocamlfind install bitstring META *.mli *.cmx *.cma *.cmxa *.a *.so \
|
||||
+ ocamlfind install bitstring META *.mli *.cma *.a *.so \
|
||||
bitstring.cmi \
|
||||
bitstring_persistent.cmi \
|
||||
- pa_bitstring.cmo
|
||||
+ pa_bitstring.cmo \
|
||||
+ -optional *.cmx *.cmxa
|
||||
@for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
|
||||
|
||||
uninstall:
|
||||
@@ -337,6 +356,7 @@ check-manifest:
|
||||
exit $$rv
|
||||
|
||||
.PHONY: depend dist check-manifest dpkg doc \
|
||||
- print-examples print-tests examples test benchmarks
|
||||
+ print-examples print-tests examples test benchmarks native \
|
||||
+ test-native
|
||||
|
||||
.SUFFIXES: .cmo .cmi .cmx .ml .mli .mll
|
8
devel/ocaml-bitstring/pkg/DESCR
Normal file
8
devel/ocaml-bitstring/pkg/DESCR
Normal file
@ -0,0 +1,8 @@
|
||||
The ocaml-bitstring project 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.
|
||||
Bitstring handles integers, strings, sub-bitstrings, big-, little-
|
||||
and native-endianness, signed and unsigned types, variable-width
|
||||
fields, and fields with arbitrary bit alignment.
|
10
devel/ocaml-bitstring/pkg/PFRAG.native
Normal file
10
devel/ocaml-bitstring/pkg/PFRAG.native
Normal file
@ -0,0 +1,10 @@
|
||||
@comment $OpenBSD: PFRAG.native,v 1.1.1.1 2013/12/05 14:38:18 jca Exp $
|
||||
lib/ocaml/bitstring/bitmatch.cmx
|
||||
lib/ocaml/bitstring/bitstring.a
|
||||
lib/ocaml/bitstring/bitstring.cmx
|
||||
lib/ocaml/bitstring/bitstring.cmxa
|
||||
lib/ocaml/bitstring/bitstring_config.cmx
|
||||
lib/ocaml/bitstring/bitstring_persistent.a
|
||||
lib/ocaml/bitstring/bitstring_persistent.cmx
|
||||
lib/ocaml/bitstring/bitstring_persistent.cmxa
|
||||
lib/ocaml/bitstring/bitstring_types.cmx
|
3
devel/ocaml-bitstring/pkg/PFRAG.shared
Normal file
3
devel/ocaml-bitstring/pkg/PFRAG.shared
Normal file
@ -0,0 +1,3 @@
|
||||
@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2013/12/05 14:38:18 jca Exp $
|
||||
lib/ocaml/stublibs/dllbitstring.so
|
||||
@comment lib/ocaml/stublibs/dllbitstring.so.owner
|
13
devel/ocaml-bitstring/pkg/PLIST
Normal file
13
devel/ocaml-bitstring/pkg/PLIST
Normal file
@ -0,0 +1,13 @@
|
||||
@comment $OpenBSD: PLIST,v 1.1.1.1 2013/12/05 14:38:18 jca Exp $
|
||||
%%native%%
|
||||
%%SHARED%%
|
||||
lib/ocaml/bitstring/
|
||||
lib/ocaml/bitstring/META
|
||||
lib/ocaml/bitstring/bitstring.cma
|
||||
lib/ocaml/bitstring/bitstring.cmi
|
||||
lib/ocaml/bitstring/bitstring.mli
|
||||
lib/ocaml/bitstring/bitstring_persistent.cma
|
||||
lib/ocaml/bitstring/bitstring_persistent.cmi
|
||||
lib/ocaml/bitstring/bitstring_persistent.mli
|
||||
lib/ocaml/bitstring/libbitstring.a
|
||||
lib/ocaml/bitstring/pa_bitstring.cmo
|
Loading…
x
Reference in New Issue
Block a user