# NOTE: This RPM will generate 'W: unstripped-binary-or-object' warnings from # rpmlint. You can't strip OCaml binaries, so these need to be ignored. %global srcname ocamlfuse %global debug_package %{nil} %global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) %define commit 08f90ac0b976b94022a7ecac992da9f88e6cd78b %define shortcommit %(c=%{commit}; echo ${c:0:7}) Name: ocaml-%{srcname} Version: 2.7.2 Release: 0.3.git%{shortcommit}%{?dist} Summary: OCaml bindings for FUSE License: GPLv2 URL: https://github.com/astrada/ocamlfuse Source0: https://github.com/astrada/ocamlfuse/archive/%{commit}.tar.gz BuildRequires: fuse-devel BuildRequires: ocaml >= 4.02.3 BuildRequires: ocaml-camlidl-devel BuildRequires: ocaml-dune BuildRequires: ocaml-dune-devel BuildRequires: ocaml-findlib BuildRequires: ocaml-odoc Requires: fuse >= 2.7 Requires: ocaml >= 4.02.3 Requires: ocaml-camlidl >= 1.05 %description This is a binding to FUSE for the OCaml programming language, enabling you to write multithreaded filesystems in the OCaml language. It has been designed with simplicity as a goal, as you can see by looking at example/fusexmp.ml. Efficiency has also been a separate goal. The Bigarray library is used for read and writes, allowing the library to do zero-copy in OCaml land. %package doc Summary: Documentation for %{name} Requires: %{name} = %{version}-%{release} %description doc The %{name}-doc package contains documentation for %{name}. %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} Requires: fuse-devel%{?_isa} Requires: ocaml%{?_isa} Requires: ocaml-camlidl-devel%{?_isa} Requires: ocaml-dune Requires: ocaml-dune-devel%{?_isa} %description devel The %{name}-devel package contains libraries and signature files for developing applications that use %{name}. %prep %autosetup -n %{srcname}-%{commit} %build dune build -p ocamlfuse %{?_smp_mflags} @install @doc # Relink stublibs with Fedora linker flags for lib in $(find _build/default -name \*.so); do cd $(dirname $lib) l=$(basename $lib) ocamlmklib -g -ldopt "%{build_ldflags}" -o ${l:3:-3} $(ar t ${l/%%so/a}) cd - done %install # This should technically be _libdir/ocaml/ocaml-ocamlfuse, but OCaml libraries # are written to look for ocamlfuse. %{__install} -p -d -m 0755 %{buildroot}%{_libdir}/ocaml/%{srcname} %{__install} -p -d -m 0755 %{buildroot}%{_docdir} dune install --destdir=%{buildroot} --prefix=%{_prefix} --libdir=%{_libdir}/ocaml #--mandir=%{_mandir} #mv %{buildroot}%{_prefix}/doc/%{srcname} %{buildroot}%{_docdir}/%{name} #rm %{buildroot}%{_docdir}/%{name}/LICENSE find %{buildroot} -type f -empty -delete find %{buildroot} -type d -empty -delete # We do not want the dune markers find _build/default/_doc/_html -name .dune-keep -delete # We install the documentation with the doc macro rm -fr %{buildroot}%{_prefix}/doc %check dune runtest %files %license LICENSE %doc example README.md %{_libdir}/ocaml/%{srcname}/*.cma %{_libdir}/ocaml/%{srcname}/*.cmi %{_libdir}/ocaml/%{srcname}/*.cmxs %{_libdir}/ocaml/%{srcname}/META %{_libdir}/ocaml/stublibs/dllfuse_stubs.so %exclude %{_libdir}/ocaml/%{srcname}/*.ml %exclude %{_libdir}/ocaml/%{srcname}/dune-package %exclude %{_libdir}/ocaml/%{srcname}/opam %files doc %doc _build/default/_doc/* %files devel %{_libdir}/ocaml/%{srcname}/*.a %{_libdir}/ocaml/%{srcname}/*.cmt %{_libdir}/ocaml/%{srcname}/*.cmti %{_libdir}/ocaml/%{srcname}/*.cmx %{_libdir}/ocaml/%{srcname}/*.cmxa %{_libdir}/ocaml/%{srcname}/*.mli %exclude %{_libdir}/ocaml/%{srcname}/*.ml %exclude %{_libdir}/ocaml/%{srcname}/dune-package %exclude %{_libdir}/ocaml/%{srcname}/opam %changelog * Thu May 13 2021 Joel Goguen - 2.7.2-0.3.git08f90ac - Initial package