diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..22f6409 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/mtime-*.tbz diff --git a/README.md b/README.md index 080b11b..dcba3db 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ # ocaml-mtime -The ocaml-mtime package +[Mtime](https://erratique.ch/software/mtime) has platform independent support +for monotonic wall-clock time in pure OCaml. This time increases +monotonically and is not subject to operating system calendar time +adjustments. The library has types to represent nanosecond precision +timestamps and time spans. + +The additional `Mtime_clock` library provide access to a system monotonic +clock. + +Mtime has no dependencies. `Mtime_clock` depends on your system library. diff --git a/ocaml-mtime.spec b/ocaml-mtime.spec new file mode 100644 index 0000000..ebe7f55 --- /dev/null +++ b/ocaml-mtime.spec @@ -0,0 +1,102 @@ +%ifnarch %{ocaml_native_compiler} +%global debug_package %{nil} +%endif + +%global srcname mtime + +Name: ocaml-%{srcname} +Version: 1.3.0 +Release: 1%{?dist} +Summary: Monotonic wall-clock time for OCaml + +License: ISC +URL: https://erratique.ch/software/mtime +Source0: %{url}/releases/%{srcname}-%{version}.tbz + +BuildRequires: ocaml >= 4.03.0 +BuildRequires: ocaml-findlib +BuildRequires: ocaml-ocamlbuild +BuildRequires: ocaml-topkg-devel + +%description +Mtime has platform independent support for monotonic wall-clock time in +pure OCaml. This time increases monotonically and is not subject to +operating system calendar time adjustments. The library has types to +represent nanosecond precision timestamps and time spans. + +The additional Mtime_clock library provide access to a system +monotonic clock. + +Mtime has no dependencies. Mtime_clock depends on your system library. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The %{name}-devel package contains libraries and signature +files for developing applications that use %{name}. + +%prep +%autosetup -n %{srcname}-%{version} + +%build +ocaml pkg/pkg.ml build --with-js_of_ocaml false + +# Relink with Fedora linker flags +cd _build +ocamlopt -shared -linkall -cclib '%{build_ldflags} -lm' -I src src/mtime.cmxa \ + -g -o src/mtime.cmxs +ocamlfind ocamlopt -shared -linkall -cclib '%{build_ldflags}' -package \ + compiler-libs.toplevel -I src src/mtime_top.cmxa -g -o src/mtime_top.cmxs +ocamlmklib -ldopt '%{build_ldflags}' -o src-os/mtime_clock_stubs -g \ + src-os/mtime_clock_stubs.o +ocamlopt -shared -linkall -cclib '%{build_ldflags}' src-os/libmtime_clock_stubs.a -I src-os src-os/mtime_clock.cmxa -o src-os/mtime_clock.cmxs +cd - + +%install +mkdir -p %{buildroot}%{_libdir}/ocaml/%{srcname}/os +cp -p _build/src/*.{a,cma,cmi,cmt,cmti,cmx,cmxa,cmxs,mli} _build/pkg/META \ + _build/opam %{buildroot}%{_libdir}/ocaml/%{srcname} +cp -p _build/src-os/*.{a,cma,cmi,cmt,cmti,cmx,cmxa,cmxs,mli} \ + %{buildroot}%{_libdir}/ocaml/%{srcname}/os +mkdir -p %{buildroot}%{_libdir}/ocaml/stublibs +cp -p _build/src-os/*.so %{buildroot}%{_libdir}/ocaml/stublibs + +# The tests depend on js_of_ocaml, which we currently do not have in Fedora. +# If we bring that package back (we used to have it, long ago), then enable the +# tests. +# +#%%check +#ocaml pkg/pkg.ml test + +%files +%doc CHANGES.md README.md +%license LICENSE.md +%dir %{_libdir}/ocaml/%{srcname}/ +%dir %{_libdir}/ocaml/%{srcname}/os/ +%{_libdir}/ocaml/%{srcname}/META +%{_libdir}/ocaml/%{srcname}/{,*/}*.cma +%{_libdir}/ocaml/%{srcname}/{,*/}*.cmi +%ifarch %{ocaml_native_compiler} +%{_libdir}/ocaml/%{srcname}/{,*/}*.cmxs +%endif +%{_libdir}/ocaml/stublibs/*.so + +%files devel +%if %{with docs} +%doc _build/default/_doc/* +%endif +%{_libdir}/ocaml/%{srcname}/opam +%ifarch %{ocaml_native_compiler} +%{_libdir}/ocaml/%{srcname}/{,*/}*.a +%{_libdir}/ocaml/%{srcname}/{,*/}*.cmx +%{_libdir}/ocaml/%{srcname}/{,*/}*.cmxa +%endif +%{_libdir}/ocaml/%{srcname}/{,*/}*.cmt +%{_libdir}/ocaml/%{srcname}/{,*/}*.cmti +%{_libdir}/ocaml/%{srcname}/{,*/}*.mli + +%changelog +* Wed Dec 1 2021 Jerry James - 1.3.0-1 +- Initial RPM diff --git a/sources b/sources new file mode 100644 index 0000000..ef61710 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (mtime-1.3.0.tbz) = 5b998ef803020de4771525adaa448623d348fa079800e72ba2ba78ff2d76a7d89da6200fe8bbc435d1355ad2c571c029398150d618912e58b5765fcf2210a5d0