Hadrian: support in-tree GMP
AbandonedPublic

Authored by harpocrates on Dec 6 2018, 12:55 AM.

Details

Summary

This adds top-level configure flags '--with-intree-gmp' and
'--with-framework-preferred', both of which are especially relevant
on MacOS.

Besides gaining two new flags, Hadrian also had to be taught what to
do with the 'framework' in .cabal files.

Test Plan

./boot && ./configure --with-intree-gmp && ./hadrian/build.sh
./boot && ./configure --with-gmp-framework-preferred && ./hadrian/build.sh # on macos

harpocrates created this revision.Dec 6 2018, 12:55 AM
alpmestan accepted this revision.Dec 6 2018, 5:38 AM

The hadrian part looks good to me. I suggested a set of flags in the ticket, but making the choice through configure is sensible enough and would work for me if everyone's happy with that.

This revision is now accepted and ready to land.Dec 6 2018, 5:38 AM
snowleopard accepted this revision.Dec 6 2018, 9:29 AM
snowleopard added inline comments.
hadrian/src/Settings/Builders/Ghc.hs
74

This bit seems strange to me.

If fmwks == ["A", "B"], the result will be "-frameworkA-frameworkB", isn't it?

I guess we want something like this instead:

darwin ? pure ["-framework " ++ fmwk | fmwk <- fmwks ]
adamse added a subscriber: adamse.Dec 6 2018, 9:34 AM

The make buildsystem doesn't require me to re-run ./configure to use intree-gmp. I'm not sure on the build time impact rerunning ./configure has but maybe it should be taken into account?

harpocrates added inline comments.Dec 6 2018, 9:40 AM
hadrian/src/Settings/Builders/Ghc.hs
74

If fmwks == ["A", "B"], the result will be ["-framework","A","-framework","B"].

I've been match the corresponding Cabal code: https://github.com/haskell/cabal/blob/dd745a9100b4bef79c6b1ddbe7bcb02ca33638b3/Cabal/Distribution/Simple/Program/GHC.hs#L682-L683 (loosely hoping that the Cabal logic might someday be refactored for re-use here).

snowleopard added inline comments.Dec 6 2018, 9:44 AM
hadrian/src/Settings/Builders/Ghc.hs
74

Ah, I think you are right, it's all good. Sorry for the noise!

@harpocrates Thank you for the patch.

It would be nice to also add a Hadrian command like flag at some point for people who don't like going via the configure script (like me), or for people who might be swithing between different GMP settings often (like @adamse?).

@adamse Regarding the build times: Hadrian does not require a full rebuild after a reconfigure: only the affected build rules will be (or rather should be!) rerun.

@harpocrates Thank you for the patch.

It would be nice to also add a Hadrian command like flag at some point for people who don't like going via the configure script (like me), or for people who might be swithing between different GMP settings often (like @adamse?).

@adamse Regarding the build times: Hadrian does not require a full rebuild after a reconfigure: only the affected build rules will be (or rather should be!) rerun.

I agree, but I wanted to maintain consistency with the --with-gmp-includes/--with-gmp-libraries options (which are passed in via configure too). If you have a better idea for how to structure all of this, I don't mind rolling back the configure changes in favour of something else.