Open avsm opened 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.
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.
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?
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.
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.
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.
Will it be enough for project containing multiple packages though? At the same time, maybe distributions build all the packages at once.
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 :-)
https://github.com/ocurrent/opam-repo-ci/issues/137 could help detect this problem
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:
DUNE_PROFILE
environment variable that a generic wrapper such asdh_ocaml
in Debian can set torelease
in order to force release mode for the package.If release mode is not set, then the resulting binaries from the package manager will have cross-module inlining disabled.