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

Cabal cleanup #5693

Merged
merged 3 commits into from Aug 27, 2019
Merged

Cabal cleanup #5693

merged 3 commits into from Aug 27, 2019

Conversation

tarleb
Copy link
Collaborator

@tarleb tarleb commented Aug 18, 2019

This consolidates handling of GHC options in the build. The ghc-options specified in pandoc.cabal are no longer repeated in cabal.project. Some options ­– those changing only console output – are moved to cabal.project.local, which can be generated via make cabal.project.local. The make target respects the GHC_VERSION variable, so only valid options are added.

Closes: #5691

cabal.project Outdated

package pandoc-citeproc
flags: +embed_data_files +bibutils -unicode_collation -test_citeproc -debug
ghc-options: -Wall -fno-warn-unused-do-bind -Wincomplete-record-updates -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -Wincomplete-uni-patterns -Widentities -j +RTS -A32M -RTS
ghc-options: -fhide-source-paths -j +RTS -A32M -RTS
Copy link
Owner

Choose a reason for hiding this comment

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

Are you sure that options here get added to the ghc-options in the cabal file, rather than replacing them altogether?
I think I believed the latter, perhaps as a result of experience.
But this should be easy to test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Options were combined when I tested it (cabal-install 2.4.0.0).

Copy link
Owner

Choose a reason for hiding this comment

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

OK, great.

Copy link
Owner

Choose a reason for hiding this comment

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

And if we put -fhide-source-paths in pandoc-citeproc.cabal, we're just left with -j +RTS -A32M -RTS. I wonder if those should also go in pandoc-citeproc.cabal?

pandoc.cabal Outdated
@@ -182,6 +182,8 @@ extra-source-files:
INSTALL.md, AUTHORS.md, README.md,
CONTRIBUTING.md, BUGS, changelog,
man/pandoc.1
-- Makefile
Makefile
-- cabal and stack build plans
Copy link
Owner

Choose a reason for hiding this comment

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

The argument against adding this is that the Makefile isn't necessary to build pandoc.
It's really just a convenience for developers, like some of the things in tools/.


package pandoc-citeproc
flags: +embed_data_files +bibutils -unicode_collation -test_citeproc -debug
ghc-options: -fhide-source-paths -j +RTS -A32M -RTS
ghc-options: -j +RTS -A32M -RTS

Copy link
Owner

Choose a reason for hiding this comment

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

Why not just add -fhide-source-paths in pandoc.cabal, conditionally on ghc version?
That would eliminate the need for an extra makefile target and a cabal.project.local.
And (I think) people could still override this default by adding -fno-hide-source-paths in their cabal.project.local (though I haven't tested this).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was afraid that this would be too opinionated and wouldn't quite belong in a cabal file. I'll happily change it.

I realized only yesterday that cabal new-configure overwrites cabal.project.local, which makes my approach even worse.

Copy link
Owner

Choose a reason for hiding this comment

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

I understand your thinking here -- but I think being a bit opinionated is okay if it lets us avoid some complexity.

@jgm jgm merged commit cd4b8f6 into jgm:master Aug 27, 2019
@jgm
Copy link
Owner

jgm commented Aug 27, 2019

I'm still not totally sure what I think about -fhide-source-paths in cabal file. I checked hackage and you can find it in some cabal files, but not many. So maybe you are right that it is too opinionated. One alternative would be to define a cabal flag. The condition on ghc version could be done under the cabal flag, and cabal.project could simply enable that flag.

@tarleb tarleb deleted the cabal-cleanup branch August 28, 2019 06:17
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.

Ensure GHC options are passed as intended
2 participants