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

stlink: fix Darwin build #60621

Merged
merged 2 commits into from May 6, 2019
Merged

Conversation

thefloweringash
Copy link
Member

@thefloweringash thefloweringash commented May 1, 2019

Motivation for this change

Make it build on Darwin.

The packaging assumes a static .a file for libusb, which nixpkgs does not provide. If we remove this special case for Darwin, it can successfully find libusb's .dylib.

Update: make nixpkgs provide the static .a instead.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nix-review --run "nix-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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@bjornfor
Copy link
Contributor

bjornfor commented May 1, 2019

Have you tried submitting the patch upstream?

Please explain stuff in the commit message, not only the PR message. (The latter does not become part of the git history.)

@bjornfor
Copy link
Contributor

bjornfor commented May 1, 2019

Other than that (above), looks good.

@thefloweringash
Copy link
Member Author

I looked deeper at the build system in stlink, and it seems like the static library usage on Darwin is intentional and supports their binary releases. I think the easiest solution is to provide the static version of libusb (PR updated to do this). The nixpkgs documentation on dontDisableStatic doesn't give much of a guideline of when it's appropriate, but hopefully this is a valid use.

Upstream supports various Unixes, so optimistically set platforms to
`unix` even though we're only going to build it on Linux and Darwin.
@bjornfor bjornfor merged commit ce5a090 into NixOS:master May 6, 2019
@thefloweringash thefloweringash deleted the stlink-darwin branch May 6, 2019 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants