Skip to content

Commit

Permalink
import bin-prot-2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
avsm committed Oct 26, 2011
1 parent 1909ea1 commit 616a43b
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 0 deletions.
31 changes: 31 additions & 0 deletions net/bin-prot/Makefile
@@ -0,0 +1,31 @@
# $OpenBSD$

COMMENT= OCaml library to generate binary protocols
CATEGORIES= net

V= 2.0.3
DISTNAME= bin-prot-${V}
MASTER_SITES= http://www.janestreet.com/ocaml/

MAINTAINER= Anil Madhavapeddy <avsm@openbsd.org>
HOMEPAGE= http://ocaml.janestreet.com/?q=node/13

# LGPL+linking exception
PERMIT_PACKAGE_FTP= Yes
PERMIT_PACKAGE_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes

MODULES= lang/ocaml
NO_REGRESS= Yes
CONFIGURE_STYLE=simple
USE_GMAKE= Yes
NO_REGRESS= Yes

BUILD_DEPENDS+= ${RUN_DEPENDS}
RUN_DEPENDS+= sysutils/findlib devel/type-conv

pre-install:
${INSTALL_DATA_DIR} ${PREFIX}/lib/ocaml/site-lib/bin-prot

.include <bsd.port.mk>
5 changes: 5 additions & 0 deletions net/bin-prot/distinfo
@@ -0,0 +1,5 @@
MD5 (bin-prot-2.0.3.tar.gz) = lQq0vcp/W3Vw5NYhbv8jXQ==
RMD160 (bin-prot-2.0.3.tar.gz) = /gIiGyDyuxdqKl5vKTyQZHD5Rc4=
SHA1 (bin-prot-2.0.3.tar.gz) = V0Rza165NnYzxfwSTVMfbZ1m7l4=
SHA256 (bin-prot-2.0.3.tar.gz) = 4wp/JerUAS93GSAbN869HQ/xqDnbW4THL/ofF1Mf7PU=
SIZE (bin-prot-2.0.3.tar.gz) = 109427
42 changes: 42 additions & 0 deletions net/bin-prot/patches/patch-lib_common_stubs_h
@@ -0,0 +1,42 @@
$OpenBSD$
--- lib/common_stubs.h.orig Thu Sep 1 18:40:11 2011
+++ lib/common_stubs.h Wed Oct 26 22:34:21 2011
@@ -31,7 +31,6 @@
#include <sys/types.h>

#include <string.h>
-#include <arpa/inet.h>

#include <caml/config.h>
#include <caml/memory.h>
@@ -47,6 +46,14 @@
#include "int64_emul.h"
#endif

+#if defined(__OpenBSD__)
+#define le16toh(x) htole16(x)
+#define le32toh(x) htole32(x)
+#define le64toh(x) htole64(x)
+#define be16toh(x) htobe16(x)
+#define be32toh(x) htobe32(x)
+#define be64toh(x) htobe64(x)
+#endif /* defined(__OpenBSD__) */


/* Endianness- and alignment-independent integer marshalling functions */
@@ -63,13 +70,13 @@
#include <byteswap.h>
#endif /* __linux__ */

-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/endian.h>
#define __BYTE_ORDER_BYTE_ORDER
#define bswap_16 bswap16
#define bswap_32 bswap32
#define bswap_64 bswap64
-#endif /* defined(__FreeBSD__) || defined(__NetBSD__) */
+#endif /* defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) */


#if _BYTE_ORDER == _LITTLE_ENDIAN
33 changes: 33 additions & 0 deletions net/bin-prot/pkg/DESCR
@@ -0,0 +1,33 @@
This library contains functionality for reading and writing
OCaml-values in a type-safe binary protocol. It is extremely
efficient, typically supporting type-safe marshalling and unmarshalling
of even highly structured values at speeds sufficient to saturate
a gigabit connection. The protocol is also heavily optimized for
size, making it ideal for long-term storage of large amounts of
data.

The library is highly dependable and safe to use: a rigorous test
suite has to date guaranteed that this library has never exhibited
a bug in production systems in several years of use. "Bin_prot" has
been successfully employed in mission-critical financial applications,
storing many terabytes of structured data derived from thousands
of type definitions, and typically processing millions of messages
a day in realtime for low-latency applications that must not crash.

Since version two this library should work with all CPU architectures
currently supported by OCaml, no matter the word size (32 or 64
bit), endianness (2), or alignment requirements. It provides users
with a convenient and safe way of performing I/O on any extensionally
defined OCaml type (see later sections for details). Functions,
objects, first-class modules, as well as values whose type is bound
through a polymorphic record field are hence not supported. This
is hardly ever a limitation in practice.

As of now, there is no support for cyclic or shared values. Cyclic
values will lead to non-termination whereas shared values, besides
requiring more space when encoded, may lead to a substantial increase
in memory footprint when they are read back. It would not be trivial
to support these kinds of values in a type-safe way without noticably
sacrificing performance. If these kinds of values are needed, the
user may want to use the as of today still unsafe marshalling
functions provided by OCaml.
5 changes: 5 additions & 0 deletions net/bin-prot/pkg/PFRAG.native
@@ -0,0 +1,5 @@
@comment $OpenBSD$
lib/ocaml/site-lib/bin_prot/bin_prot.a
lib/ocaml/site-lib/bin_prot/bin_prot.cmxa
lib/ocaml/site-lib/bin_prot/pa_bin_prot.a
lib/ocaml/site-lib/bin_prot/pa_bin_prot.cmxa
2 changes: 2 additions & 0 deletions net/bin-prot/pkg/PFRAG.shared
@@ -0,0 +1,2 @@
@comment $OpenBSD$
lib/ocaml/site-lib/bin_prot/dllbin_prot.so
11 changes: 11 additions & 0 deletions net/bin-prot/pkg/PLIST
@@ -0,0 +1,11 @@
@comment $OpenBSD$
%%SHARED%%
lib/ocaml/site-lib/bin-prot/
lib/ocaml/site-lib/bin_prot/
lib/ocaml/site-lib/bin_prot/META
lib/ocaml/site-lib/bin_prot/bin_prot.cma
lib/ocaml/site-lib/bin_prot/bin_prot.cmi
lib/ocaml/site-lib/bin_prot/libbin_prot.a
lib/ocaml/site-lib/bin_prot/pa_bin_prot.cma
lib/ocaml/site-lib/bin_prot/pa_bin_prot.cmi
lib/ocaml/site-lib/bin_prot/pa_bin_prot.mli

0 comments on commit 616a43b

Please sign in to comment.