Zarith icon indicating copy to clipboard operation
Zarith copied to clipboard

[build] [wip] Support for the dune build system.

Open ejgallego opened this issue 5 years ago • 10 comments
trafficstars

This is a preliminary draft PR for building zarith with dune; my motivation was to be able to compose zarith with other developments, so far seems to work well!

If developers like this, I could finish the TODO:

  • configuration
  • fix warnings
  • run all tests
  • opam generation?
  • CI?

ejgallego avatar Sep 17 '20 14:09 ejgallego

This needs rebasing. fact, fib and tak do not exist anymore.

olafhering avatar Jan 14 '21 13:01 olafhering

is this planned to be rebased & merged & zarith to be released (with the very nice other changes that are so far only in trunk)? thanks.

hannesm avatar Jan 27 '21 11:01 hannesm

I'd be happy to do more progress on this, once I get feedback from the developers as whether this would be considered.

ejgallego avatar Jan 27 '21 11:01 ejgallego

I have no strong opinion. I think that the main complexity of the build system for Zarith lies in the configure script. The Makefile is rather simple, we have few files and directories. To get a more decisive opinion and be excited about this, it would help to see a complete dune-based build system with the configure phase working on all the platforms currently supported by the Makefile, as well as some incentive (what is the concrete benefit of switching to dune ?).

antoinemine avatar Jan 27 '21 12:01 antoinemine

My Cryptokit library recently moved to using Dune: https://github.com/xavierleroy/cryptokit/pull/24 . On the one hand, the previous build system (based on Oasis) had issues, so Dune was an improvement. On the other hand, Dune's support for autoconfiguration is rather primitive, to the point that I'd rather stick with a handwritten configure shell script.

xavierleroy avatar Jan 27 '21 18:01 xavierleroy

To get a more decisive opinion and be excited about this, it would help to see a complete dune-based build system with the configure phase working on all the platforms currently supported by the Makefile, as well as some incentive (what is the concrete benefit of switching to dune ?).

My main motivation to write this was to be able to debug zarith and a client [in this case Coq] at the same time, with Dune you only need to drop zarith inside Coq's build scope and things work out of the box. This was very useful but don't expect to have a need for it again soon.

Dune also provides some other advantages and extra tooling such as documentation, dune-release, etc... YMMV.

On the other hand, Dune's support for autoconfiguration is rather primitive, to the point that I'd rather stick with a handwritten configure shell script.

I don't think that the configure script would be replaced, only adapted to output files that can be :include'd from dune's build rules.

ejgallego avatar Jan 27 '21 18:01 ejgallego

I would also like to have it using dune + autoconf, like opam itself does it. It simplifies a lot when cross compiling zarith to other platforms.

EduardoRFS avatar Feb 08 '21 22:02 EduardoRFS

FYI, I've rebased and updated this PR in https://github.com/hhugo/zarith/tree/dune.

  • adding back most tests
  • adapting the configure script to emit sexp files consumed by dune (:include ...) stanza.

hhugo avatar Jun 13 '23 15:06 hhugo

Great @hhugo , please feel free to take over / close this PR, it is unlikely I can put any cycles on this any time soon.

ejgallego avatar Jun 13 '23 19:06 ejgallego

I have no strong opinion. I think that the main complexity of the build system for Zarith lies in the configure script. The Makefile is rather simple, we have few files and directories. To get a more decisive opinion and be excited about this, it would help to see a complete dune-based build system with the configure phase working on all the platforms currently supported by the Makefile, as well as some incentive (what is the concrete benefit of switching to dune ?).

I've updated https://github.com/hhugo/zarith/tree/dune to demonstrate what a near complete dune-based build system would look like for zarith.

hhugo avatar Jun 14 '23 12:06 hhugo

Thanks a lot @hhugo , I'm closing this PR in favor of #143

ejgallego avatar Sep 10 '24 17:09 ejgallego