Blob Blame History Raw
Name:           ocaml-dune
Version:        1.11.0
Release:        2%{?dist}
Summary:        A composable build system for OCaml

%global libname %(echo %{name} | sed -e 's/^ocaml-//')

# Dune itself is MIT, and there are bundled libs that are LGPLv2 with exceptions and ISC.
License:        MIT and LGPLv2 with exceptions and ISC

URL:            https://dune.build
Source0:        https://github.com/ocaml/%{libname}/archive/%{version}/%{libname}-%{version}.tar.gz

# See: https://github.com/ocaml/dune/issues/2527
Patch1:         15c04b09a8c06871635d5fd98c3a37089bbde6d9.patch

BuildRequires:  ocaml >= 4.02.3
BuildRequires:  ocaml-findlib-devel

# Depend on /usr/bin/sphinx-build for python version invariance.
BuildRequires:  /usr/bin/sphinx-build
BuildRequires:  python3-sphinx_rtd_theme

# Required by tests.
BuildRequires:  git
BuildRequires:  ocaml-menhir
BuildRequires:  ocaml-result-devel

# Dune has vendored deps (ugh):
# I'm not clear on how to unbundle them.
# It seems to be unsupported upstream; the bootstrap process for dune
# doesn't seem to be able to detect libraries installed systemwide.
# https://github.com/ocaml/dune/issues/220
Provides:      bundled(ocaml-opam-file-format) = 2.0.0
Provides:      bundled(ocaml-cmdliner) = 1.0.2
Provides:      bundled(ocaml-re) = 1.7.1

Provides:      dune = %{version}-%{release}

Provides:      jbuilder = %{version}-%{release}
Obsoletes:     jbuilder < 1.0.1-3

%description
Dune is a build system designed for OCaml/Reason projects only. It focuses
on providing the user with a consistent experience and takes care of most of
the low-level details of OCaml compilation. All you have to do is provide a
description of your project and Dune will do the rest.

The scheme it implements is inspired from the one used inside Jane Street and
adapted to the open source world. It has matured over a long time and is used
daily by hundred of developers, which means that it is highly tested and
productive.

%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}.

%package        doc
Summary:        HTML documentation for %{name}
Requires:       %{name} = %{version}-%{release}

BuildArch:      noarch

%description    doc
HTML documentation for dune, a composable build system for OCaml.

%prep
# Restore autosetup once we have fixed this upstream issue:
# https://github.com/ocaml/dune/issues/2527
#autosetup -n %{libname}-%{version} -p1
%setup -n %{libname}-%{version}
%ifarch %{arm}
%patch1 -p1
%endif

%build
# The dune build script figures out if the native code compiler is available
# and uses it if it is, otherwise it uses the bytecode compiler. Thus I think
# we just need to "make" here.
%make_build release
%make_build doc

%install
# Dune's makefile has a "make install" target. Tragically, it uses opam-install(er)
# to install itself. Even more tragically, opam now requires dune to build.
# Therefore as a workaround we can just manually install things ourselves--
# Dune is *mostly* just a binary, making this easy.
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_mandir}/man1
mkdir -p %{buildroot}%{_mandir}/man5

cp -av _boot/default/bin/main/main_dune.exe %{buildroot}%{_bindir}/dune
ln -sfvbn dune %{buildroot}%{_bindir}/jbuilder
cp -av _boot/default/doc/*.1 %{buildroot}%{_mandir}/man1/
cp -av _boot/default/doc/*.5 %{buildroot}%{_mandir}/man5/

# Dune also has libraries now, which need to be installed via the standard way.
mkdir -p %{buildroot}%{_libdir}/ocaml/%{libname}/
cp -aLr _boot/install/default/lib/%{libname}/* %{buildroot}%{_libdir}/ocaml/%{libname}/

# Remove *.ml files from installation.
# This is a little annoying. ocaml/dune has a bunch of subdirectories that actually contain code.
# But the "_wp" subdirectory *itself* contains subdirectories with compiled code.
# So I've special-cased that one.
rm -fv %{buildroot}%{_libdir}/ocaml/%{libname}/*/*.ml
rm -fv %{buildroot}%{_libdir}/ocaml/%{libname}/_wp/*/*.ml

# Install documentation by way of pkgdocdir.
mkdir -p %{buildroot}%{_pkgdocdir}/
cp -ar README.md CHANGES.md doc/_build/* %{buildroot}%{_pkgdocdir}/

%check
# Do not run the unit tests which assume opam is installed.

%{buildroot}%{_bindir}/dune --version

%files
%license LICENSE.md
%doc %{_pkgdocdir}/README.md
%doc %{_pkgdocdir}/CHANGES.md
%{_bindir}/jbuilder
%{_bindir}/dune
%{_mandir}/man*/dune*
%dir %{_pkgdocdir}
%{_libdir}/ocaml/%{libname}
%ifarch %{ocaml_native_compiler}
%exclude %{_libdir}/ocaml/%{libname}/*/*.a
%exclude %{_libdir}/ocaml/%{libname}/*/*.cmxa
%exclude %{_libdir}/ocaml/%{libname}/*/*.cmx
%exclude %{_libdir}/ocaml/%{libname}/_wp/*/*.a
%exclude %{_libdir}/ocaml/%{libname}/_wp/*/*.cmxa
%exclude %{_libdir}/ocaml/%{libname}/_wp/*/*.cmx
%endif
%exclude %{_libdir}/ocaml/%{libname}/*/*.mli
%exclude %{_libdir}/ocaml/%{libname}/_wp/*/*.mli

%files devel
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/%{libname}/*/*.a
%{_libdir}/ocaml/%{libname}/*/*.cmxa
%{_libdir}/ocaml/%{libname}/*/*.cmx
%{_libdir}/ocaml/%{libname}/_wp/*/*.a
%{_libdir}/ocaml/%{libname}/_wp/*/*.cmxa
%{_libdir}/ocaml/%{libname}/_wp/*/*.cmx
%endif
%{_libdir}/ocaml/%{libname}/*/*.mli
# There do not seem to be headers in the _wp subdirectory.
#{_libdir}/ocaml/{libname}/_wp/*/*.mli

%files doc
%exclude %{_pkgdocdir}/README.md
%exclude %{_pkgdocdir}/CHANGES.md
%doc %{_pkgdocdir}/*

%changelog
* Fri Aug 09 2019 Richard W.M. Jones <rjones@redhat.com> - 1.11.0-2
- Work around nodynlink issue on armv7.
  https://github.com/ocaml/dune/issues/2527

* Thu Aug 08 2019 Richard W.M. Jones <rjones@redhat.com> - 1.11.0-1
- New version 1.11.0 (also required for camomile 1.0.2).

* Tue Aug 06 2019 Ben Rosser <rosser.bjr@gmail.com> - 1.10.0-5
- Install dune libraries. Add new ocaml-dune subpackage (rhbz#1737414).

* Wed Jul 31 2019 Richard W.M. Jones <rjones@redhat.com> - 1.10.0-4
- OCaml 4.08.1 (rc2) rebuild.

* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Thu Jun 27 2019 Richard W.M. Jones <rjones@redhat.com> - 1.10.0-2
- OCaml 4.08.0 (final) rebuild.

* Sun Jun 16 2019 Andy Li <andy@onthewings.net> - 1.10.0-1
- Updated to latest upstream release (#1715394).

* Thu May 16 2019 Andy Li <andy@onthewings.net> - 1.9.3-1
- Updated to latest upstream release (#1705660).

* Tue Apr 30 2019 Richard W.M. Jones <rjones@redhat.com> - 1.9.1-2
- OCaml 4.08.0 (beta 3) rebuild.

* Thu Apr 11 2019 Andy Li <andy@onthewings.net> - 1.9.1-1
- Updated to latest upstream release (#1698732).

* Wed Apr 10 2019 Andy Li <andy@onthewings.net> - 1.9.0-1
- Updated to latest upstream release (#1698022).

* Wed Mar 13 2019 Andy Li <andy@onthewings.net> - 1.8.2-1
- Updated to latest upstream release (#1686836).
- Add missing dependency on sphinx_rtd_theme.

* Fri Mar 08 2019 Andy Li <andy@onthewings.net> - 1.8.0-1
- Updated to latest upstream release (#1686466).

* Fri Mar 01 2019 Andy Li <andy@onthewings.net> - 1.7.3-1
- Renamed source package from jbuilder to ocaml-dune.
- Updated URLs and license according to upstream changes.
- Updated to latest upstream release (#1600105).
- Removed 1113.patch which has been applied upstream in eariler version.
- Removed rpm check section since the upstream tests depend on opam.

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Tue Aug 07 2018 Ben Rosser <rosser.bjr@gmail.com> - 1.0.1-1
- Updated to latest upstream release.
- Manpages have been renamed to 'dune'. A 'dune' binary is now provided as well.

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-0.12.beta20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Wed May 02 2018 Ben Rosser <rosser.bjr@gmail.com> - 1.0-0.11.beta20
- Updated to latest upstream release (#1537836).

* Tue Mar 06 2018 Ben Rosser <rosser.bjr@gmail.com> - 1.0-0.10.beta18
- Updated to latest upstream release (#1537836).

* Mon Feb 12 2018 Ben Rosser <rosser.bjr@gmail.com> - 1.0-0.9.beta17
- Update to upstream re-release of beta 17.

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-0.8.beta17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Tue Jan 30 2018 Ben Rosser <rosser.bjr@gmail.com> - 1.0-0.7.beta18
- Fix build failure on ppc64 by always using bytecode ocaml compiler to bootstrap.

* Wed Jan 24 2018 Ben Rosser <rosser.bjr@gmail.com> 1.0-0.6.beta17
- Update to latest upstream release, beta17 (#1537836).
- Remove unit tests that require external deps (that themselves require jbuilder).

* Tue Nov 14 2017 Ben Rosser <rosser.bjr@gmail.com> 1.0-0.5.beta16
- Update to latest upstream release, beta16 (#1509749).
- Add pre_tag version suffix to source flie name to avoid confusion.

* Mon Oct 23 2017 Ben Rosser <rosser.bjr@gmail.com> 1.0-0.4.beta14
- Update to latest upstream release, beta14 (#1504414).

* Mon Aug 28 2017 Ben Rosser <rosser.bjr@gmail.com> 1.0-0.3.beta12
- Update to latest upstream release, beta12.
- Fix typo in description.
- Use simpler github source URL.
- Use make_build macros when compiling.

* Tue Aug 15 2017 Ben Rosser <rosser.bjr@gmail.com> 1.0-0.2.beta11
- Update to a git snapshot so opam can be built against.
- Modernize ocaml packaging.

* Tue Aug  1 2017 Ben Rosser <rosser.bjr@gmail.com> 1.0-0.1.beta11
- Initial package.