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

librsvg: fix build on darwin #84458

Merged
merged 1 commit into from Apr 8, 2020
Merged

Conversation

marsam
Copy link
Contributor

@marsam marsam commented Apr 6, 2020

Motivation for this change

librsvg needs -lobjc ldflag on darwin

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.

buildInputs = [ libxml2 bzip2 pango libintl ]
++ lib.optionals stdenv.isDarwin [ darwin.libobjc ];

NIX_LDFLAGS = if stdenv.isDarwin then "-lobjc" else null;
Copy link
Member

Choose a reason for hiding this comment

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

A bit hacky / confusing but rewriting this as

  ${if stdenv.hostPlatform.isDarwin then "NIX_LDFLAGS" else null } = "-lobjc";

should avoid a Linux rebuild for now if that's a concern here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hehe, that's neat, didn't actually know it was possible to circumvent the problem this way (though that should ideally be the meaning of foo = null tbh.).

If we want to target master then I think we do want this hack, preferably with a FIXME comment.

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'm inclined to the initial version, because is more easy to understand; but I don't mind updating it. Please let me know if we are going to use this approach

Copy link
Member

Choose a reason for hiding this comment

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

Yours' definitely much clearer so I would also be in favour of that. I think I may have left my comment at the time there was still a change triggering a Linux rebuild, as that's no longer an issue so you can just dismiss my comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, I guess optionalString returns an empty string when false (which does make sense), but foo = null actually works the way we want. That makes it a lot more palatable indeed :)

@Kha Kha mentioned this pull request Apr 8, 2020
@veprbl veprbl linked an issue Apr 8, 2020 that may be closed by this pull request
@jtojnar jtojnar merged commit 2a7a7a8 into NixOS:master Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

librsvg broken on darwin
4 participants