-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
rpm: Add Darwin support #35142
rpm: Add Darwin support #35142
Conversation
BTW, the missing files for qemu were added in e3f947a. |
@grahamc ^ Possible @GrahamcOfBorg's bug -- how does it determine when the change is Darwin-specific? |
Yeah, I have a pr open for that. |
The |
I don't understand the error in the checker. Can someone help with that? |
@@ -18,7 +18,8 @@ stdenv.mkDerivation rec { | |||
buildInputs = [ cpio zlib bzip2 file libarchive nspr nss db xz python lua ]; | |||
|
|||
# rpm/rpmlib.h includes popt.h, and then the pkg-config file mentions these as linkage requirements | |||
propagatedBuildInputs = [ popt elfutils nss db bzip2 libarchive libbfd ]; | |||
propagatedBuildInputs = [ popt nss db bzip2 libarchive libbfd ] | |||
++ stdenv.lib.optionals stdenv.isLinux elfutils; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The checker marks line 21. optionals
takes a list as the second parameter, so either use a singleton list or optional
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@@ -52,13 +53,20 @@ stdenv.mkDerivation rec { | |||
# symlinks produced by build are incorrect | |||
ln -sf $out/bin/{rpm,rpmquery} | |||
ln -sf $out/bin/{rpm,rpmverify} | |||
'' + stdenv.lib.optionalString stdenv.isDarwin '' | |||
cd $out/bin | |||
ln -s "${nss}/lib/libnss3.dylib" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to fix the install_name of these libraries, everything that depends on them is going to have this problem otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds right. I wasn't sure if there is a reason for them to have this problem. New to Nix so didn't want to assume. Should they be their own issues / PR's?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add it to this pr if you want, just try to keep the changes in a separate commit per package.
@GrahamcOfBorg build rpm |
Success on x86_64-linux (full log) Partial log (click to expand)
|
Success on x86_64-darwin (full log) Partial log (click to expand)
|
Success on aarch64-linux (full log) Partial log (click to expand)
|
@@ -33,6 +33,10 @@ in stdenv.mkDerivation rec { | |||
|
|||
patchFlags = "-p0"; | |||
|
|||
postPatch = stdenv.lib.optionalString stdenv.isDarwin '' | |||
substituteInPlace nss/coreconf/Darwin.mk --replace '@executable_path/$(notdir $@)' "$out/lib/\$(notdir \$@)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this work correctly if you need to fixup the install_name afterwards anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It fixes a part of the paths. I couldn’t fix them all in the build. So I ended up hacking the rest with install_name_tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, in that case take a look at fixDarwinDylibNames
, that should handle the fixup for you. (the second part)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Didn't notice that when grepping around.
@GrahamcOfBorg build rpm |
Success on x86_64-linux (full log) Partial log (click to expand)
|
Success on x86_64-darwin (full log) Partial log (click to expand)
|
Success on aarch64-linux (full log) Partial log (click to expand)
|
Thanks! |
I’m really new at Nix. Just trying it out. You were one of the most helpful and active reviewers I’ve seen. Thanks for all the help with this PR. |
Welcome! Darwin really lacks contributors, compared to x86_64-linux. |
Motivation for this change
RPM didn't work on macOS, now it does.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)Could not run nox-phase because
.nox/nixpkgs/pkgs/applications/virtualization/qemu/statfs-flags.patch
was missing. Shouldn't break Linux packages as the derivation is the same on Linux.I'm new to Nix so the "ln -s" solution in this PR might not be the best solution. It was used in other derivations so I picked it. The problem was that rpm tools pointed to
@execution_path/libnss3.dylib
, but I could not fix that withinstall_name_tool
becausenss
itself had more of those paths.