3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #253160 from pwaller/static-skip-install-rpath

makeStaticBinaries: Set -DCMAKE_SKIP_INSTALL_RPATH
This commit is contained in:
Artturi 2023-10-01 21:36:02 +03:00 committed by GitHub
commit 3bf47679b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,12 +60,13 @@ rec {
mkDerivationFromStdenv = withOldMkDerivation old (stdenv: mkDerivationSuper: args:
if stdenv.hostPlatform.isDarwin
then throw "Cannot build fully static binaries on Darwin/macOS"
else (mkDerivationSuper args).overrideAttrs(finalAttrs: {
NIX_CFLAGS_LINK = toString (finalAttrs.NIX_CFLAGS_LINK or "") + " -static";
} // lib.optionalAttrs (!(finalAttrs.dontAddStaticConfigureFlags or false)) {
configureFlags = (finalAttrs.configureFlags or []) ++ [
"--disable-shared" # brrr...
];
else (mkDerivationSuper args).overrideAttrs (args: {
NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_LINK or "") + " -static";
} // lib.optionalAttrs (!(args.dontAddStaticConfigureFlags or false)) {
configureFlags = (args.configureFlags or []) ++ [
"--disable-shared" # brrr...
];
cmakeFlags = (args.cmakeFlags or []) ++ ["-DCMAKE_SKIP_INSTALL_RPATH=On"];
}));
} // lib.optionalAttrs (stdenv0.hostPlatform.libc == "glibc") {
extraBuildInputs = (old.extraBuildInputs or []) ++ [