ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.63k stars 401 forks source link

package managers wrapping dune must use release mode #1801

Open avsm opened 5 years ago

avsm commented 5 years ago

Many dune packages have a makefile that contains targets such as dune build. While opam packages do the right thing and specify -p and a package name in order to enable release mode, I suspect that many other OS package managers do not do this and simply wrap the Makefile.

There are a few things that'll help:

If release mode is not set, then the resulting binaries from the package manager will have cross-module inlining disabled.

ghost commented 5 years ago

BTW, there was a thread on the caml-list about having a standard makefile for dune projects. Should we consider something like this? i.e. have dune generate a standard Makefile, with some hooks a-la-oasis to allow the user to customize it a bit.

rgrinberg commented 5 years ago

I think that would be useful but I don't think it would fix the problem. The debian packaging would still need to be aware of it since presumably we'd keept the --profile=dev default in the generated makefile.

avsm commented 5 years ago

I'm wondering why the Makefile can't always do a release build. Doesn't the editor invoke dune build directly usually (no Makefile) to get the dev build?

rgrinberg commented 5 years ago

I guess it's not how I use things. I use a makefile to drive development (with plenty of convenience targets). If I'm in the minority here, I'm ok with switching my workflow so that makefiles are used for production builds by default.

ghost commented 5 years ago

I do that as well. I think the problem is that this part is just not standardised at all so everybody must be doing something different. Personally, I use C-c C-c from emacs to compile, and even getting that to do something reasonable require writing non-trivial emacs lisp.

That said, the underlying problem is selecting release builds for building distribution packages. Surely this is not a dune or even OCaml specific problem.

avsm commented 5 years ago

I think @rgrinberg's addition of #1806 DUNE_PROFILE should be sufficient, as long as we communicate this to the upstream projects. I'll leave this open to write some docs on the topic so we can point them at it once 1.7.0 is out the door.

ghost commented 5 years ago

Will it be enough for project containing multiple packages though? At the same time, maybe distributions build all the packages at once.

avsm commented 5 years ago

There's a lot of variation in the way package managers generate binary packages, so I suspect all options will eventually be explored by some random distro :-)

ejgallego commented 3 years ago

https://github.com/ocurrent/opam-repo-ci/issues/137 could help detect this problem