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

Add a config option to override gcc path #2264

Merged
merged 3 commits into from
Jul 10, 2016

Conversation

khanage
Copy link
Contributor

@khanage khanage commented Jun 11, 2016

This allows one to specify with-gcc: in stack.yaml.

Happy for any feedback - I just picked this up as it's marked with newcomer!

This allows one to specify with-gcc: in stack.yaml.
@@ -279,6 +280,12 @@ configOptsParser hide0 =
<> help "Extra directories to check for libraries"
<> hide
)))
<*> optionalFirst (textOption
( long "with-ghc"
Copy link
Member

Choose a reason for hiding this comment

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

That should probably be "with-gcc" – not sure if there would be an advantage in using configMonoidOverrideGccPathName directly…

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you mean by configMonoidOverrideGccPathName?

Copy link
Member

Choose a reason for hiding this comment

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

In Stack.Types.Config you define configMonoidOverrideGccPathName = "with-gcc", so you could potentially reuse that definition instead of duplicating the literal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just cargo culted that - I'm happy to make the change, although I think it should be done categorically, as it's "not the way it's currently done".

Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

I think it should be done categorically, as it's "not the way it's currently done".

Good point. You can certainly just use a literal for this PR.

Change `with-ghc` to actually be `with-gcc`
@@ -840,6 +842,8 @@ data ConfigMonoid =
-- ^ See: 'configExtraIncludeDirs'
,configMonoidExtraLibDirs :: !(Set Text)
-- ^ See: 'configExtraLibDirs'
, configMonoidOverrideGccPath :: !(First Text)
Copy link
Member

@sjakobi sjakobi Jun 13, 2016

Choose a reason for hiding this comment

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

Personally, I'd prefer a First (Path Abs File) here.

The main advantage I'd expect from that, would be better error messages than those that we currently relay from cabal or ghc.

I also think that this should be done "categorically", so for configMonoidExtraIncludeDirs, configMonoidExtraLibDirs, configMonoidWorkDir and configMonoidLocalBinPath too. (Not necessarily in this PR though)

Options.Applicative.Builder.eitherReader would probably be a useful helper function for this.

Copy link
Member

Choose a reason for hiding this comment

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

I have opened #2267 with regard to the overly permissive types.

Given that it's a rather tangential point, feel free to change configMonoidOverrideGccPath to First (Path Abs File) or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just had a quick play with this - there's a slight problem with there being no FromJSON instance for Path Abs File etc. I'd rather fix that as part of #2267 (as it is a little tangential). I'm happy to pick that one up as well once this is done though :).

Copy link
Member

Choose a reason for hiding this comment

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

I've already started working on #2267 so you may want to choose a different issue next. ;)

@sjakobi
Copy link
Member

sjakobi commented Jun 13, 2016

Can you also add a paragraph to doc/yaml_configuration.md and an entry to the changelog?

I think this will be good to go then (if @mgsloan agrees :)).

@sjakobi
Copy link
Member

sjakobi commented Jun 14, 2016

LGTM!

Thanks for working on this, @khanage!

@khanage khanage self-assigned this Jun 21, 2016
@sjakobi
Copy link
Member

sjakobi commented Jul 2, 2016

I'm sorry to see this PR languishing for so long.

@mgsloan: Given that I've already reviewed this, are you ok with me simply merging this?

Alternatively, would anyone else be interested in giving this PR a second look?

@borsboom
Copy link
Contributor

I'm fine with this. @sjakobi, go ahead and merge when ready.

@simonjantsch
Copy link

Are dependencies also built with the specified gcc? I have one project where I need to build a dependency with a special gcc version, I just tried to add the 'with-gcc' option in the projects stack.yaml, it did not work though. The dependency does not have a stack.yaml at the moment, so I could not add the option there.

@khanage khanage deleted the 593_override_gcc_path branch July 12, 2016 13:09
@sjakobi
Copy link
Member

sjakobi commented Jul 12, 2016

@simonjantsch

Are dependencies also built with the specified gcc?

They certainly should. Did you make sure that the dependency was actually rebuilt? If so, please open an issue and include the output with --verbose --cabal-verbose, and ideally a project that we can reproduce the problem with, too.

@simonjantsch
Copy link

@sjakobi I have opened an issue (see reference above)

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.

4 participants