--- /dev/null
+DIST mtime-0.8.4.tbz 11705 SHA256 b0a1eb1fb2d30e413ab24f5261e099881cadbac5af440f53f2544e3a9846b5a9 SHA512 fc08df2abc3500d18db3c4bb9a67336b902483da24056fac2c9f0b4c93ac8860c29a59b47c1ade62f6f5b51ac32c7d16e31d5c9f8cb51900accf73ddeaf6d307 WHIRLPOOL 543168a929e4eaf158cd05420f9139664a4289c5ae1e69bf9081f842d97b08182c99dc3ac82b242afca4067f69b1efc53fb11c116056162871f59b988be2a8d5
--- /dev/null
+Index: mtime-0.8.4/myocamlbuild.ml
+===================================================================
+--- mtime-0.8.4.orig/myocamlbuild.ml
++++ mtime-0.8.4/myocamlbuild.ml
+@@ -34,7 +34,7 @@ let () =
+ flag ["library"; "ocaml"; "byte"; "record_mtime_os_stubs"]
+ (S ([A "-dllib"; A "-lmtime_stubs"] @ system_support_lib));
+ flag ["library"; "ocaml"; (* byte and native *) "record_mtime_os_stubs"]
+- (S ([A "-cclib"; A "-lmtime_stubs"] @ system_support_lib));
++ (S ([A "-cclib"; A "-Lsrc-os"; A "-cclib"; A "-lmtime_stubs"] @ system_support_lib));
+
+ ocaml_lib ~tag_name:"use_mtime_os" ~dir:"src-os" "src-os/mtime";
+ flag ["link"; "ocaml"; "use_mtime_os"] (S [A "-ccopt"; A "-Lsrc-os"]);
--- /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>
--- /dev/null
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils
+
+DESCRIPTION="OCaml module to access monotonic wall-clock time"
+HOMEPAGE="http://erratique.ch/software/mtime https://github.com/dbuenzli/mtime"
+SRC_URI="http://erratique.ch/software/mtime/releases/${P}.tbz"
+
+LICENSE="ISC"
+SLOT="0/${PV}"
+KEYWORDS="~amd64"
+IUSE="javascript test"
+
+RDEPEND="dev-lang/ocaml:=[ocamlopt]
+ javascript? ( dev-ml/js_of_ocaml:= )
+"
+DEPEND="${RDEPEND}
+ dev-ml/opam
+ dev-ml/topkg
+ dev-ml/ocamlbuild
+ dev-ml/findlib"
+
+src_prepare() {
+ epatch "${FILESDIR}/firstinstall.patch"
+}
+
+src_compile() {
+ ocaml pkg/pkg.ml build \
+ --with-js_of_ocaml $(usex javascript true false) \
+ --tests $(usex test true false) \
+ || die
+}
+
+src_test() {
+ ocaml pkg/pkg.ml test || die
+}
+
+src_install() {
+ opam-installer -i \
+ --prefix="${ED}/usr" \
+ --libdir="${D}/$(ocamlc -where)" \
+ --docdir="${ED}/usr/share/doc/${PF}" \
+ ${PN}.install || die
+ dodoc CHANGES.md README.md
+}