Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ejgallego
Copy link

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?

TODO:

- configuration
- fix warnings
- run tests
- opam generation?
- CI?
@olafhering
Copy link

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

@hannesm
Copy link
Member

hannesm commented Jan 27, 2021

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.

@ejgallego
Copy link
Author

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

@antoinemine
Copy link
Collaborator

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 ?).

@xavierleroy
Copy link
Contributor

My Cryptokit library recently moved to using Dune: xavierleroy/cryptokit#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.

@ejgallego
Copy link
Author

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.

@EduardoRFS
Copy link

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.

(name zarith)
(wrapped false)
(flags -w -6)
(library_flags -cclib -lgmp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to use dune-configurator here instead, having -lgmp as a fallback.
See ocaml/opam-repository#18131 & ocaml/opam-repository#18128

@hhugo
Copy link
Contributor

hhugo commented Jun 13, 2023

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.

@ejgallego
Copy link
Author

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

@hhugo
Copy link
Contributor

hhugo commented Jun 14, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants