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

lib, treewide: Add *Platform.extensions and use it where possible #29282

Merged
merged 2 commits into from Sep 13, 2017

Conversation

Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Sep 12, 2017

Motivation for this change

Keeping track of platform-specific extensions in a more organized manner.

Things done

Eval is currently broken on master, so testing is more difficult than it should be.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@Ericson2314 Ericson2314 added the 9.needs: port to stable A PR needs a backport to the stable release. label Sep 12, 2017
@Ericson2314 Ericson2314 added this to the 17.09 milestone Sep 12, 2017
@Ericson2314
Copy link
Member Author

https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/audio/mpc/default.nix#L21 taunts me for something more over-engineered.

@bjornfor
Copy link
Contributor

Let it go :-)

@FRidh
Copy link
Member

FRidh commented Sep 12, 2017

In python-packages.nix I recently introduced sharedLibraryExtension. Now, I suppose that this could be replaced by what you add here.

@Ericson2314
Copy link
Member Author

@FRidh I amend the commit to do that.

@Ericson2314
Copy link
Member Author

Ericson2314 commented Sep 12, 2017

@LnL7 pointed out I had to change the use sites, because my variable includes the dot (for symmetry with "" vs ".exe"). I took the time to inline some of the old per-package let bindings too.

grep '\.\$' (git grep -l 'stdenv.hostPlatform.extensions.sharedLibrary')

says we're all OK now.

@FRidh
Copy link
Member

FRidh commented Sep 13, 2017

Is having hostPlatform in there really necessary? Does it happen you need non-host?

@Ericson2314
Copy link
Member Author

@FRidh Yes it is. stdenv.{build,host,target}Platform.extensions.sharedLibrary are all defined and meaningful.

This is used to platform specific library and exectuable extensions. In
the next commit I'll replace a bunch of ad-hoc logic with it.
@Ericson2314
Copy link
Member Author

I rebuilt all package who's hash changed (but not their like ~5 reverse dependencies) on NixOS. Darwin won't eval overall, but I tested those packages at least do too.

@Ericson2314 Ericson2314 merged commit 8fccaa2 into NixOS:master Sep 13, 2017
@Ericson2314 Ericson2314 deleted the soext branch September 13, 2017 15:21
@Ericson2314 Ericson2314 added the 8.has: port to stable A PR already has a backport to the stable release. label Sep 13, 2017
@@ -193,7 +192,7 @@ in stdenv.mkDerivation rec {
mkdir -p $out/share/java
cp src/java/target/mesos-*.jar $out/share/java

MESOS_NATIVE_JAVA_LIBRARY=$out/lib/libmesos.${soext}
MESOS_NATIVE_JAVA_LIBRARY=$out/lib/libmesos${stdenv.hostPlatform.extensions.sharedLibrary}
Copy link
Member

Choose a reason for hiding this comment

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

pfft, I prefered .soext 😝

Copy link
Member Author

Choose a reason for hiding this comment

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

I only inlined of another long line was a worse offender 😝

magick_wand_library = "${imagemagick}/lib/libMagickWand-6.Q16${sharedLibraryExtension}";
imagemagick_library = "${imagemagick}/lib/libMagickCore-6.Q16${sharedLibraryExtension}";
soext = stdenv.hostPlatform.extensions.sharedLibrary;
magick_wand_library = "${imagemagick}/lib/libMagickWand-6.Q16${soext}";
Copy link
Member

Choose a reason for hiding this comment

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

These aren't equivalent; sharedLibraryExtension had a dot in it, whereas soext doesn't.

Copy link
Member Author

Choose a reason for hiding this comment

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

soext does have a dot.

Copy link
Member

Choose a reason for hiding this comment

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

Oh sorry!

Copy link
Member Author

Choose a reason for hiding this comment

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

No worries! It does look odd because it didn't have the dot before the anti-quote before, like most.

@samueldr samueldr removed the 9.needs: port to stable A PR needs a backport to the stable release. label Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: work-in-progress 8.has: port to stable A PR already has a backport to the stable release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants