From 715e50af8739785e9d4db2567780075900711ff9 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Sat, 4 Jan 2020 17:32:38 -0700 Subject: [PATCH] New version 2.1.0 (bz 1742638). Also: - Invoke the configure script (bz 1740196). - Add LGPLv2 to License due to incremental-cycles. - Add -emacs subpackage and byte compile the Emacs Lisp files. - Drop upstreamed 15c04b09a8c06871635d5fd98c3a37089bbde6d9.patch. - Add -doc-emphasis and -doc-scheme patches. - Run the unit tests in %check. --- ...4b09a8c06871635d5fd98c3a37089bbde6d9.patch | 28 -- ocaml-dune-doc-emphasis.patch | 13 + ocaml-dune-doc-scheme.patch | 297 ++++++++++++++++++ ocaml-dune.rpmlintrc | 14 + ocaml-dune.spec | 190 ++++++----- 5 files changed, 439 insertions(+), 103 deletions(-) delete mode 100644 15c04b09a8c06871635d5fd98c3a37089bbde6d9.patch create mode 100644 ocaml-dune-doc-emphasis.patch create mode 100644 ocaml-dune-doc-scheme.patch create mode 100644 ocaml-dune.rpmlintrc diff --git a/15c04b09a8c06871635d5fd98c3a37089bbde6d9.patch b/15c04b09a8c06871635d5fd98c3a37089bbde6d9.patch deleted file mode 100644 index 0c2ba1f..0000000 --- a/15c04b09a8c06871635d5fd98c3a37089bbde6d9.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 15c04b09a8c06871635d5fd98c3a37089bbde6d9 Mon Sep 17 00:00:00 2001 -From: Jeremie Dimino -Date: Thu, 8 Aug 2019 23:31:27 +0100 -Subject: [PATCH] remove nodynlink optimisation - -Signed-off-by: Jeremie Dimino ---- - src/exe_rules.ml | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/exe_rules.ml b/src/exe_rules.ml -index 834afab21..eda12ee4d 100644 ---- a/src/exe_rules.ml -+++ b/src/exe_rules.ml -@@ -104,11 +104,11 @@ let executables_rules ~sctx ~dir ~dir_kind ~expander - else - Some js_of_ocaml - in -- let dynlink = -+ let dynlink = true (* - Dune_file.Executables.Link_mode.Set.exists exes.modes ~f:(fun mode -> - match mode.kind with - | Shared_object -> true -- | _ -> false) -+ | _ -> false)*) - in - Compilation_context.create () - ~super_context:sctx diff --git a/ocaml-dune-doc-emphasis.patch b/ocaml-dune-doc-emphasis.patch new file mode 100644 index 0000000..f0148f7 --- /dev/null +++ b/ocaml-dune-doc-emphasis.patch @@ -0,0 +1,13 @@ +diff --git a/doc/caching.rst b/doc/caching.rst +index 60958630..6ccc20d7 100644 +--- a/doc/caching.rst ++++ b/doc/caching.rst +@@ -18,7 +18,7 @@ promoted to the cache, and subsequent builds will automatically check + the cache for hits. + + The cached files are stored inside you `XDG_CACHE_HOME` directory on +-*nix systems, and `"HOME\\Local Settings\\Cache"` on Windows. ++\*nix systems, and `"HOME\\Local Settings\\Cache"` on Windows. + + + Daemon diff --git a/ocaml-dune-doc-scheme.patch b/ocaml-dune-doc-scheme.patch new file mode 100644 index 0000000..69c70ac --- /dev/null +++ b/ocaml-dune-doc-scheme.patch @@ -0,0 +1,297 @@ +diff --git a/doc/advanced-topics.rst b/doc/advanced-topics.rst +index 7a90753d..26f826aa 100644 +--- a/doc/advanced-topics.rst ++++ b/doc/advanced-topics.rst +@@ -215,7 +215,7 @@ Below is an example where we build ``my.cmxs`` containing ``foo.cmxa`` and + ``d.cmx``. Note how we use a :ref:`library` stanza to set up the compilation of + ``d.cmx``. + +-.. code:: scheme ++.. code:: lisp + + (library + (name foo) +diff --git a/doc/concepts.rst b/doc/concepts.rst +index dd83ebb0..6cf67d46 100644 +--- a/doc/concepts.rst ++++ b/doc/concepts.rst +@@ -83,7 +83,7 @@ error. + Here's a simple example of a condition that expresses running on OSX and having + an flambda compiler with the help of variable expansion: + +-.. code:: scheme ++.. code:: lisp + + (and %{ocamlc-config:flambda} (= %{ocamlc-config:system} macosx)) + +@@ -247,7 +247,7 @@ Forms that expands to list of items, such as ``%{cc}``, ``%{deps}``, + ``%{targets}`` or ``%{read-lines:...}``, are suitable to be used in, say, + ``(run )``. For instance in: + +-.. code:: scheme ++.. code:: lisp + + (run foo %{deps}) + +@@ -275,7 +275,7 @@ which is equivalent to the following shell command: + Note that, since ``%{deps}`` is a list of items, the first one may be + used as a program name, for instance: + +-.. code:: scheme ++.. code:: lisp + + (rule + (targets result.txt) +@@ -284,7 +284,7 @@ used as a program name, for instance: + + Here is another example: + +-.. code:: scheme ++.. code:: lisp + + (rule + (target foo.exe) +@@ -400,7 +400,7 @@ be an action that reads the file given as only dependency named + More precisely, ``(preprocess (action ))`` acts as if + you had setup a rule for every file of the form: + +- .. code:: scheme ++ .. code:: lisp + + (rule + (target file.pp.ml) +@@ -456,7 +456,7 @@ names. + + For instance: + +- .. code:: scheme ++ .. code:: lisp + + (preprocess (per_module + (((action (run ./pp.sh X=1 %{input-file})) foo bar)) +@@ -537,7 +537,7 @@ in actions (like the ``%{deps}``, ``%{target}`` and ``%{targets}`` built in vari + One instance where this is useful is for naming globs. Here's an + example of an imaginary bundle command: + +-.. code:: scheme ++.. code:: lisp + + (rule + (target archive.tar) +@@ -696,7 +696,7 @@ Note: expansion of the special ``%{:...}`` is done relative to the current + working directory of the part of the DSL being executed. So for instance if you + have this action in a ``src/foo/dune``: + +-.. code:: scheme ++.. code:: lisp + + (action (chdir ../../.. (echo %{path:dune}))) + +@@ -831,7 +831,7 @@ complicated tests. In order to prevent dune from running the + actions at the same time, you can specify that both actions take the + same lock: + +-.. code:: scheme ++.. code:: lisp + + (rule + (alias runtest) +@@ -857,7 +857,7 @@ contexts setup, the same rule might still be executed concurrently between the + two build contexts. If you want a lock that is global to all build contexts, + simply use an absolute filename: + +-.. code:: scheme ++.. code:: lisp + + (rule + (alias runtest) +@@ -957,7 +957,7 @@ Declaring a package + To declare a package, simply add a ``package`` stanza to your + ``dune-project`` file: + +-.. code:: scheme ++.. code:: lisp + + (package + (name mypackage) +diff --git a/doc/cross-compilation.rst b/doc/cross-compilation.rst +index a4459caa..bc6189e2 100644 +--- a/doc/cross-compilation.rst ++++ b/doc/cross-compilation.rst +@@ -97,6 +97,6 @@ Some packages might still have to be updated to support cross-compilation. For + instance if the ``foo.exe`` program in the previous example was using + ``Sys.os_type``, it should instead take it as a command line argument: + +-.. code:: scheme ++.. code:: lisp + + (rule (with-stdout-to blah (run ./foo.exe -os-type %{os_type}))) +diff --git a/doc/dune-files.rst b/doc/dune-files.rst +index e8cba1ee..770b5c50 100644 +--- a/doc/dune-files.rst ++++ b/doc/dune-files.rst +@@ -277,7 +277,7 @@ The syntax of ``dune`` files is described in :ref:`metadata-format` section. + ``dune`` files are composed of stanzas. For instance a typical + ``dune`` looks like: + +-.. code:: scheme ++.. code:: lisp + + (library + (name mylib) +@@ -871,7 +871,7 @@ time obvious what are the dependencies and targets. + + For instance: + +-.. code:: scheme ++.. code:: lisp + + (rule + (target b) +@@ -897,7 +897,7 @@ Note that in dune, targets must always be known + statically. For instance, this ``(rule ...)`` + stanza is rejected by dune: + +-.. code:: scheme ++.. code:: lisp + + (rule (copy a b.%{read:file})) + +@@ -906,7 +906,7 @@ ocamllex + + ``(ocamllex )`` is essentially a shorthand for: + +-.. code:: scheme ++.. code:: lisp + + (rule + (target .ml) +@@ -929,7 +929,7 @@ ocamlyacc + + ``(ocamlyacc )`` is essentially a shorthand for: + +-.. code:: scheme ++.. code:: lisp + + (rule + (targets .ml .mli) +@@ -1074,7 +1074,7 @@ The syntax is as follows: + + The typical use of the ``alias`` stanza is to define tests: + +-.. code:: scheme ++.. code:: lisp + + (rule + (alias runtest) +@@ -1240,7 +1240,7 @@ be used to override the test binary invocation, for example if you're using + alcotest and wish to see all the test failures on the standard output when + running dune runtest you can use the following stanza: + +-.. code:: scheme ++.. code:: lisp + + (tests + (names mytest) +@@ -1324,7 +1324,7 @@ the user the following operations: + + Examples: + +-.. code:: scheme ++.. code:: lisp + + (dirs *) ;; include all directories + (dirs :standard \ ocaml) ;; include all directories except ocaml +@@ -1374,7 +1374,7 @@ All of the specified ```` will be ignored by dune. Note that users + should rely on the ``dirs`` stanza along with the appropriate set operations + instead of this stanza. For example: + +-.. code:: scheme ++.. code:: lisp + + (dirs :standard \ ...) + +@@ -1559,7 +1559,7 @@ writers avoid boilerplate we provide a `(coqpp ...)` stanza: + + which for each ``g_mod`` in ```` is equivalent to: + +-.. code:: scheme ++.. code:: lisp + + (rule + (targets g_mod.ml) +diff --git a/doc/migration.rst b/doc/migration.rst +index 0a905d26..e4249fc8 100644 +--- a/doc/migration.rst ++++ b/doc/migration.rst +@@ -191,7 +191,7 @@ Removed variables + A named dependency should be used instead of ``${<}``. For instance + the following jbuild file: + +-.. code:: scheme ++.. code:: lisp + + (alias + ((name runtest) +@@ -200,7 +200,7 @@ the following jbuild file: + + should be rewritten to the following dune file: + +-.. code:: scheme ++.. code:: lisp + + (rule + (alias runtest) +diff --git a/doc/quick-start.rst b/doc/quick-start.rst +index 5cbb12e4..18c61536 100644 +--- a/doc/quick-start.rst ++++ b/doc/quick-start.rst +@@ -134,7 +134,7 @@ Using cppo + + Add this field to your ``library`` or ``executable`` stanzas: + +-.. code:: scheme ++.. code:: lisp + + (preprocess (action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{input-file}))) + +@@ -150,7 +150,7 @@ Using the .cppo.ml style like the ocamlbuild plugin + + Write this in your ``dune`` file: + +-.. code:: scheme ++.. code:: lisp + + (rule + (targets foo.ml) +@@ -182,7 +182,7 @@ Defining a library with C stubs using pkg-config + Same context as before, but using ``pkg-config`` to query the + compilation and link flags. Write this ``dune`` file: + +-.. code:: scheme ++.. code:: lisp + + (library + (name mylib) +@@ -239,7 +239,7 @@ Using a custom code generator + + To generate a file ``foo.ml`` using a program from another directory: + +-.. code:: scheme ++.. code:: lisp + + (rule + (targets foo.ml) +diff --git a/doc/tests.rst b/doc/tests.rst +index 52d7902e..7931c8d1 100644 +--- a/doc/tests.rst ++++ b/doc/tests.rst +@@ -357,7 +357,7 @@ In this example, we put tests in comments of the form: + + The backend for such a framework looks like this: + +-.. code:: scheme ++.. code:: lisp + + (library + (name simple_tests) diff --git a/ocaml-dune.rpmlintrc b/ocaml-dune.rpmlintrc new file mode 100644 index 0000000..e72af52 --- /dev/null +++ b/ocaml-dune.rpmlintrc @@ -0,0 +1,14 @@ +# THIS FILE IS FOR WHITELISTING RPMLINT ERRORS AND WARNINGS IN TASKOTRON +# https://fedoraproject.org/wiki/Taskotron/Tasks/dist.rpmlint#Whitelisting_errors + +# The dictionary lacks some technical words +addFilter(r'W: spelling-error .* (composable|flymake)') + +# Caused by ocaml; this package cannot fix it +addFilter(r'ocaml-dune\.[^:]+: E: missing-call-to-chdir-with-chroot') + +# Documentation is in the main package +addFilter(r'ocaml-dune-.*\.[^:]+: W: no-documentation') + +# The configure script is not an autotools-generated script +addFilter(r'ocaml-dune\.spec:[^:]*: W: configure-without-libdir-spec') diff --git a/ocaml-dune.spec b/ocaml-dune.spec index 5d3b7ff..b207373 100644 --- a/ocaml-dune.spec +++ b/ocaml-dune.spec @@ -1,30 +1,37 @@ -Name: ocaml-dune -Version: 1.11.0 -Release: 4%{?dist} +%global libname dune + +Name: ocaml-%{libname} +Version: 2.1.0 +Release: 1%{?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 +# Dune itself is MIT. Some bundled libraries have a different license: +# ISC: +# - vendor/cmdliner +# LGPLv2: +# - vendor/incremental-cycles +# LGPLv2 with exceptions: +# - vendor/opam-file-format +# - vendor/re +License: MIT and LGPLv2 and LGPLv2 with exceptions and ISC URL: https://dune.build Source0: https://github.com/ocaml/%{libname}/archive/%{version}/%{libname}-%{version}.tar.gz +# Fix an unescaped asterisk misinterpreted as emphasis start +# https://github.com/ocaml/dune/pull/2999 +Patch0: %{name}-doc-emphasis.patch +# Use the Lisp lexer instead of Scheme when nonstandard characters are used +# https://github.com/ocaml/dune/pull/3000 +Patch1: %{name}-doc-scheme.patch -# 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 +BuildRequires: emacs +BuildRequires: ocaml >= 4.07 +BuildRequires: ocaml-findlib +BuildRequires: python3dist(sphinx) +BuildRequires: python3dist(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. @@ -32,7 +39,7 @@ BuildRequires: ocaml-result-devel # 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-cmdliner) = 1.0.3 Provides: bundled(ocaml-re) = 1.7.1 Provides: dune = %{version}-%{release} @@ -68,95 +75,128 @@ BuildArch: noarch %description doc HTML documentation for dune, a composable build system for OCaml. +%package emacs +Summary: Emacs support for %{name} +License: ISC +Requires: %{name} = %{version}-%{release} + +BuildArch: noarch + +%description emacs +The %{name}-devel package contains Emacs integration with the dune build +system, a mode to edit dune files, and flymake support for dune files. + %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 +%autosetup -n %{libname}-%{version} -p1 %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 +./configure --libdir %{_libdir}/ocaml --mandir %{_mandir} + +# This command fails, because ppx_bench, ppx_expect, and core_bench are missing. +# However, it is only tests that fail, not the actual build, so ignore the +# failures and continue. +%make_build || : +./dune.exe build @install %make_build doc +%ifarch %{ocaml_native_compiler} +# Relink the stublib. See https://github.com/ocaml/dune/issues/2977. +cd _build/default/src/stdune +ocamlmklib -g -ldopt "$RPM_LD_FLAGS" -o stdune_stubs fcntl_stubs.o +cd - +%endif + %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 +# "make install" only installs the binary. We want the libraries, too. +./dune.exe install --destdir %{buildroot} -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/ +%ifarch %{ocaml_native_compiler} +# Add missing executable bits +find %{buildroot}%{_libdir}/ocaml -name \*.cmxs -exec chmod 0755 {} \+ +%endif -# 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 +# Byte compile the Emacs files +cd %{buildroot}%{_emacs_sitelispdir} +%_emacs_bytecompile dune.el dune-flymake.el +cd - # Install documentation by way of pkgdocdir. +rm -fr %{buildroot}%{_prefix}/doc mkdir -p %{buildroot}%{_pkgdocdir}/ -cp -ar README.md CHANGES.md doc/_build/* %{buildroot}%{_pkgdocdir}/ +cp -ar README.md CHANGES.md MIGRATION.md doc/_build/* %{buildroot}%{_pkgdocdir}/ %check -# Do not run the unit tests which assume opam is installed. - -%{buildroot}%{_bindir}/dune --version +# These are the only tests we can run. The others require components that +# either depend on dune themselves or are not available in Fedora at all. +%{buildroot}%{_bindir}/dune runtest test/unit-tests %files %license LICENSE.md %doc %{_pkgdocdir}/README.md %doc %{_pkgdocdir}/CHANGES.md -%{_bindir}/jbuilder +%doc %{_pkgdocdir}/MIGRATION.md %{_bindir}/dune %{_mandir}/man*/dune* -%dir %{_pkgdocdir} -%{_libdir}/ocaml/%{libname} +%dir %{_pkgdocdir}/ +%dir %{_libdir}/ocaml/dune/ +%dir %{_libdir}/ocaml/dune-action-plugin/ +%dir %{_libdir}/ocaml/dune-build-info/ +%dir %{_libdir}/ocaml/dune-configurator/ +%dir %{_libdir}/ocaml/dune-glob/ +%dir %{_libdir}/ocaml/dune-private-libs/ +%dir %{_libdir}/ocaml/dune-private-libs/dune-lang/ +%dir %{_libdir}/ocaml/dune-private-libs/dune_re/ +%dir %{_libdir}/ocaml/dune-private-libs/ocaml-config/ +%dir %{_libdir}/ocaml/dune-private-libs/stdune/ +%{_libdir}/ocaml/dune*/META +%{_libdir}/ocaml/dune*/*.cma +%{_libdir}/ocaml/dune*/*.cmi +%{_libdir}/ocaml/dune-private-libs/*/*.cma +%{_libdir}/ocaml/dune-private-libs/*/*.cmi %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 +%{_libdir}/ocaml/dune*/*.cmxs +%{_libdir}/ocaml/dune-private-libs/*/*.cmxs +%{_libdir}/ocaml/stublibs/dllstdune_stubs.so %endif -%exclude %{_libdir}/ocaml/%{libname}/*/*.mli -%exclude %{_libdir}/ocaml/%{libname}/_wp/*/*.mli %files devel +%{_libdir}/ocaml/dune*/dune-package +%{_libdir}/ocaml/dune*/opam +%{_libdir}/ocaml/dune*/*.cmt +%{_libdir}/ocaml/dune*/*.cmti +%{_libdir}/ocaml/dune*/*.ml +%{_libdir}/ocaml/dune*/*.mli +%{_libdir}/ocaml/dune-private-libs/*/*.cmt +%{_libdir}/ocaml/dune-private-libs/*/*.cmti +%{_libdir}/ocaml/dune-private-libs/*/*.ml +%{_libdir}/ocaml/dune-private-libs/*/*.mli %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 +%{_libdir}/ocaml/dune*/*.a +%{_libdir}/ocaml/dune*/*.cmx +%{_libdir}/ocaml/dune*/*.cmxa +%{_libdir}/ocaml/dune-private-libs/*/*.a +%{_libdir}/ocaml/dune-private-libs/*/*.cmx +%{_libdir}/ocaml/dune-private-libs/*/*.cmxa %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}/* +%files emacs +%{_emacs_sitelispdir}/dune* + %changelog +* Sat Jan 4 2020 Jerry James - 2.1.0-1 +- New version 2.1.0 (bz 1742638) +- Invoke the configure script (bz 1740196) +- Add LGPLv2 to License due to incremental-cycles +- Add -emacs subpackage and byte compile the Emacs Lisp files +- Drop upstreamed 15c04b09a8c06871635d5fd98c3a37089bbde6d9.patch +- Add -doc-emphasis and -doc-scheme patches +- Run the unit tests in %%check + * Fri Dec 06 2019 Richard W.M. Jones - 1.11.0-4 - OCaml 4.09.0 (final) rebuild.