<div dir="ltr"><div>Expanding on Moritz a bit:</div><div><br></div>configure creates a build plan, hadrian runs it.<div><br></div><div>Newcomers to autoconf-based ecosystems often add a rule to run configure to their Makefiles, as a "shortcut". At some time thereafter, they discover that there's a problem when configure alters the build plan make is executing. There's no sane way to integrate this properly if the build plan changes enough, even if configure is always the very first thing executed as part of the original build plan. This generally results in forcing make to abort after running autoconf, since trying to be more clever results in looping over configure. The only other way that works is arranging for 2-stage Makefiles where the outer one amounts to "configure && make -f Makefile.real". Which makes it noticeably more error-prone to tweak something and do a fast rebuild, since configure will often cause it to be a full rebuild instead. If you try to give configure dependencies so that it doesn't get re-run, you discover that it's dependent in some sense on its own outputs and again can cause loops.</div><div><br></div><div>Trying to integrate configure with hadrian runs the same risk, heightened by hadrian not using anything like Makefiles, so it would be even easier for it to either miss changes made by configure or end up looping on it. Or worse, the same with autoconf — or for ghc, the boot script which runs autoconf, among other things, and thus has even nastier risks in terms of missing important changes made thereby or causing loops.</div><div><br></div><div>Really, don't try to conflate these; someone is going to end up very unhappy.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 15, 2019 at 9:35 AM Moritz Angermann <<a href="mailto:moritz.angermann@gmail.com">moritz.angermann@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Arnaud,<br>
<br>
> On Mar 15, 2019, at 8:32 PM, Spiwack, Arnaud <<a href="mailto:arnaud.spiwack@tweag.io" target="_blank">arnaud.spiwack@tweag.io</a>> wrote:<br>
> <br>
> On Thu, Mar 14, 2019 at 7:20 PM Herbert Valerio Riedel <<a href="mailto:hvriedel@gmail.com" target="_blank">hvriedel@gmail.com</a>> wrote:<br>
> I don't have the ticket number at my fingertips but it should be fairly easy to find.<br>
> <br>
> I'm afraid it doesn't appear to be. Could you share your arguments in this thread?<br>
This was the last one that lead to the current `-c` state:<br>
- <a href="https://github.com/snowleopard/hadrian/issues/457" rel="noreferrer" target="_blank">https://github.com/snowleopard/hadrian/issues/457</a><br>
There is also<br>
- <a href="https://github.com/snowleopard/hadrian/issues/655" rel="noreferrer" target="_blank">https://github.com/snowleopard/hadrian/issues/655</a><br>
<br>
if you look through the issues on snowleopard/hadrian and sort by comment frequency<br>
you'll likely find quite a lot of further discussion about not making configure and<br>
boot the default.<br>
<br>
> <br>
> On Fri, Mar 15, 2019 at 3:10 AM Moritz Angermann <<a href="mailto:moritz.angermann@gmail.com" target="_blank">moritz.angermann@gmail.com</a>> wrote:<br>
> It's magically conflating two different phases with `-c`. The configure phase and<br>
> the build phase. Making this the default means it's always magic. I don't like magic!<br>
> <br>
> Unfortunately, I really don't understand what you are saying. What's magic about combining the phases?<br>
<br>
We have two phases:<br>
<br>
Phase 1: autoconf<br>
<br>
  This phase is essentially a code-generation phase, where specific templates are<br>
  instantiated to configure time value.  Which again can be split into two specific<br>
  subproblems:<br>
<br>
  - Generation of the configure script from the <a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> and aclocal.m4 files<br>
    using autoconf.<br>
  - Generating code using the configure script by computing configure time calues<br>
    and filling those into the `.in` files producing the files that lack the `.in`<br>
    extension.<br>
<br>
Phase 2: building<br>
<br>
  This has been traditionally the job of make, and this is what hadrian should<br>
  replace.<br>
<br>
<br>
By subsuming the configure phase (by invoking ./configure) from hadrian we loose<br>
the phase distinction and if the `-c` flag is optional, users will *not even see*<br>
a flag that indicates that the system will run `./configure` for them. This is the<br>
magic I'm referring to and to which I strongly object.  If we can retire autoconf<br>
and do the whole configuration in hadrian, that story may change.  But as long as<br>
we are using an autoconf based configuration we should *not* run that magically.<br>
The `-c` flag is at least there to show that hadrian is explicilty instructed to<br>
run configure.<br>
<br>
./configure supports its own set of flags, if hadrian subsumes those, we'd need<br>
some generic way of passing flags to ./configure, at which point I have to ask<br>
why do we do this in the first place and try to call ./configure from within hadrian?<br>
<br>
Unless you want to reconfigure ghc, or hack on it's autoconf part, you are likely<br>
going to run the following only:<br>
<br>
./boot --hadrian<br>
./configure <your flags of choice><br>
./hadrian/build.sh -j<N> ...<br>
./hadrian/build.sh -j<N> ...<br>
./hadrian/build.sh -j<N> ...<br>
./hadrian/build.sh -j<N> ...<br>
...<br>
<br>
the configure step is required, and should be explicit. That is where you configure<br>
your ghc build. Set host/build/target values, and other configure flags that<br>
influence how you want your ghc to be configure. Hadrian is there to build that<br>
configuration.  Mixing both may be convenient but hides the fact that there is a<br>
./configure step.  I consider this hiding to be magic which is meant to benefit the<br>
user but hides what's really going on.  And again I don't like magic.<br>
<br>
Cheers,<br>
 Moritz<br>
<br>
PS: we also don't hide the `./configure` step in the usual `./configure <args> && make -j`<br>
    instructions when building other software, even though you could surely hack that into<br>
    your Makefile if you so wanted to.  Why start with ghc now?<br>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>brandon s allbery kf8nh</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a></div></div></div></div></div>