--- /dev/null
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit findlib eutils
+
+DESCRIPTION="OCaml code generator plugin for the Cap'n Proto serialization framework"
+HOMEPAGE="https://github.com/pelzlpj/capnp-ocaml"
+SRC_URI="https://github.com/pelzlpj/capnp-ocaml/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="BSD-2"
+SLOT="0/${PV}"
+KEYWORDS="~amd64"
+IUSE=""
+
+RDEPEND="
+ dev-lang/ocaml:=[ocamlopt]
+ dev-ml/core_kernel:=
+ dev-ml/camlp4:=
+ dev-ml/ocaml-extunix:=
+ dev-ml/ocplib-endian:=
+ dev-ml/res:=
+ dev-ml/ocaml-uint:=
+"
+DEPEND="${RDEPEND}
+ dev-util/omake
+"
+
+src_prepare() {
+ epatch "${FILESDIR}/mi.patch"
+}
+
+src_compile() {
+ PREFIX="${EPREFIX}/usr" omake --force-dotomake || die
+}
+
+src_install() {
+ findlib_src_preinst
+ DESTDIR="${D}" PREFIX="${EPREFIX}/usr" omake --force-dotomake install || die
+ dodoc README.adoc CHANGELOG.adoc
+}
--- /dev/null
+Index: capnp-ocaml-2.1.1/src/compiler/OMakefile
+===================================================================
+--- capnp-ocaml-2.1.1.orig/src/compiler/OMakefile
++++ capnp-ocaml-2.1.1/src/compiler/OMakefile
+@@ -24,7 +24,8 @@ else
+
+ includes.ml: make_includes.ml ../runtime/common-inc.ml \
+ ../runtime/reader-inc.ml ../runtime/builder-inc.ml
+- ocaml $(TOPLEVEL_INCLUDE) make_includes.ml
++ ocamlfind ocamlopt -o make_includes -package core_kernel -linkpkg make_includes.ml
++ ./make_includes
+
+
+ PROGRAM = capnpc-ocaml
+Index: capnp-ocaml-2.1.1/src/compiler/make_includes.ml
+===================================================================
+--- capnp-ocaml-2.1.1.orig/src/compiler/make_includes.ml
++++ capnp-ocaml-2.1.1/src/compiler/make_includes.ml
+@@ -1,12 +1,7 @@
+-#!/usr/bin/env ocaml
+-
+ (* Generate ocaml code containing the content of a couple of files, formatted
+ as a list of lines. This is used to perform an ocaml source inclusion,
+ providing functor-like capability without the performance hit. *)
+
+-#use "topfind"
+-#require "core_kernel"
+-
+ open Core_kernel
+
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>ml@gentoo.org</email>
+ <name>Gentoo ML Project</name>
+</maintainer>
+</pkgmetadata>