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

haskell.gtk2hs packages: fix Darwin build #80422

Merged
merged 1 commit into from Feb 21, 2020

Conversation

simonchatts
Copy link
Contributor

@simonchatts simonchatts commented Feb 18, 2020

Motivation for this change

The gtk2hs packages (gtk, cairo, pango, glib, gio) currently fail on Darwin. This change includes two layered fixes for these:

  • a point-in-time override for the current version of all these tools (that can hopefully be backed out after there's a new release and nixpkgs pulls this in)
  • an additional override for gtk that likely wants to remain indefinitely
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Edit: correct the gtk2hs issue referenced in the commit message

@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Feb 18, 2020
Comment on lines 1421 to 1428
glib = appendPatch super.glib ./patches/glib.patch;
gio = appendPatch super.gio ./patches/gio.patch;
pango = appendPatch super.pango ./patches/pango.patch;
# In addition to the issue above, gtk in particular needs to be told on Darwin
# that that the supplied gtk lib uses quartz not X11 (as recommended in
# https://github.com/gtk2hs/gtk2hs/issues/249). This appendConfigureFlags part
# should remain even after we can remove the v0.13.8.0-specific appendPatch.
gtk = appendConfigureFlags (appendPatch super.gtk ./patches/gtk.patch)
Copy link
Member

Choose a reason for hiding this comment

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

Could you either pull these patches directly from upstream (maybe using fetchPatch), or try to add this -D__attribute__(x)= flag inline here (maybe using appendConfigureFlags)?

If possible, we try to avoid carrying around patches directly in nixpkgs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense! I can't think of a way to achieve this just via command-line flags, and there isn't a canonical patch source yet, but I've just pushed an alternative. Hopefully the let-bound helper function will be relatively short-lived.

Copy link
Member

Choose a reason for hiding this comment

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

a canonical patch source yet

The canonical patch source would be your PR. Look for examples of fetchPatch in nixpkgs to see how this is done.

Otherwise, you might be able to use the optP GHC flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the guidance! I've pushed an update using fetchpatch (and re-tested on both Darwin and NixOS).

There is some commonality that could be factored out into a helper function (at which point one might make the patch darwin-specific) but I've erred on the side of keeping everything local. Unconditionally applying the patch is safe, and doesn't have a huge fan-out. But I'm not sure which is most idiomatic - opinions welcomed!

@simonchatts simonchatts force-pushed the haskell-gtk2hs branch 3 times, most recently from 96083a0 to 68663ac Compare February 20, 2020 18:00
This includes two layered changes so the gtk2hs packages build on Darwin:

 - For `glib`, `gio`, `gtk`, `gtk3`, and `pango`: the fix for version 0.13.8.0
   from gtk2hs/gtk2hs#293 . I expect at some point the
   referenced fix (or one like it) will be released and and brought into
   nixpkgs, at which point the override and patch files here can (in fact must)
   be removed.

 - For `gtk` and `gtk3`: also apply the required cabal flag cited in
   gtk2hs/gtk2hs#249 to specify the Quartz rather than
   X11 backend (Quartz is the one that both nixpkgs and macOS support
   out-the-box). This override is likely to be wanted indefinitely.

Both modifications are required for a successful build of `gtk` or `gtk3` on
Darwin right now.
@cdepillabout
Copy link
Member

Great, thanks for fixing this up! LGTM.

@cdepillabout
Copy link
Member

@GrahamcOfBorg build haskellPackages.gtk
@GrahamcOfBorg build haskellPackages.gtk3
@GrahamcOfBorg build haskellPackages.cairo
@GrahamcOfBorg build haskellPackages.pango
@GrahamcOfBorg build haskellPackages.glib
@GrahamcOfBorg build haskellPackages.gio

@cdepillabout
Copy link
Member

Looks like everything built successfully on darwin, thanks for fixing this up!

@cdepillabout cdepillabout merged commit b00efc9 into NixOS:haskell-updates Feb 21, 2020
@simonchatts simonchatts deleted the haskell-gtk2hs branch February 21, 2020 17:34
@simonchatts simonchatts restored the haskell-gtk2hs branch March 26, 2020 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants