mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 15:11:25 +00:00
Merge pull request #235990 from uri-canva/fix-static
nixStatic: Fix darwin.
This commit is contained in:
commit
6e51b1a92e
@ -72,7 +72,10 @@ let
|
||||
then if lib.versionOlder version "1.78" then "mips1" else "mips"
|
||||
else if stdenv.hostPlatform.parsed.cpu.name == "s390x" then "s390x"
|
||||
else toString stdenv.hostPlatform.parsed.cpu.family}"
|
||||
"binary-format=${toString stdenv.hostPlatform.parsed.kernel.execFormat.name}"
|
||||
# env in host triplet for Mach-O is "macho", but boost binary format for Mach-O is "mach-o"
|
||||
"binary-format=${if stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.macho
|
||||
then "mach-o"
|
||||
else toString stdenv.hostPlatform.parsed.kernel.execFormat.name}"
|
||||
"target-os=${toString stdenv.hostPlatform.parsed.kernel.name}"
|
||||
|
||||
# adapted from table in boost manual
|
||||
|
@ -95,18 +95,20 @@ rec {
|
||||
makeStaticDarwin = stdenv: stdenv.override (old: {
|
||||
# extraBuildInputs are dropped in cross.nix, but darwin still needs them
|
||||
extraBuildInputs = [ pkgs.buildPackages.darwin.CF ];
|
||||
mkDerivationFromStdenv = extendMkDerivationArgs old (args: {
|
||||
NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_LINK or "")
|
||||
mkDerivationFromStdenv = withOldMkDerivation old (stdenv: mkDerivationSuper: args:
|
||||
(mkDerivationSuper args).overrideAttrs (finalAttrs: {
|
||||
NIX_CFLAGS_LINK = toString (finalAttrs.NIX_CFLAGS_LINK or "")
|
||||
+ lib.optionalString (stdenv.cc.isGNU or false) " -static-libgcc";
|
||||
nativeBuildInputs = (args.nativeBuildInputs or []) ++ [
|
||||
(pkgs.buildPackages.makeSetupHook {
|
||||
name = "darwin-portable-libSystem-hook";
|
||||
substitutions = {
|
||||
libsystem = "${stdenv.cc.libc}/lib/libSystem.B.dylib";
|
||||
};
|
||||
} ./darwin/portable-libsystem.sh)
|
||||
];
|
||||
});
|
||||
nativeBuildInputs = (finalAttrs.nativeBuildInputs or [])
|
||||
++ lib.optional stdenv.hasCC [
|
||||
(pkgs.buildPackages.makeSetupHook {
|
||||
name = "darwin-portable-libSystem-hook";
|
||||
substitutions = {
|
||||
libsystem = "${stdenv.cc.libc}/lib/libSystem.B.dylib";
|
||||
};
|
||||
} ./darwin/portable-libsystem.sh)
|
||||
];
|
||||
}));
|
||||
});
|
||||
|
||||
# Puts all the other ones together
|
||||
|
@ -111,6 +111,13 @@ let
|
||||
hash = "sha256-s1ybRFCjQaSGj7LKu0Z5g7UiHqdJGeD+iPoQL0vaiS0=";
|
||||
};
|
||||
|
||||
patch-fix-aarch64-darwin-static = fetchpatch {
|
||||
# https://github.com/NixOS/nix/pull/8068
|
||||
name = "fix-aarch64-darwin-static.patch";
|
||||
url = "https://github.com/NixOS/nix/commit/220aa8e0ac9d17de2c9f356a68be43b673d851a1.patch";
|
||||
hash = "sha256-YrmFkVpwPreiig1/BsP+DInpTdQrPmS7bEY0WUGpw+c=";
|
||||
};
|
||||
|
||||
in lib.makeExtensible (self: {
|
||||
nix_2_3 = (common rec {
|
||||
version = "2.3.16";
|
||||
@ -170,6 +177,9 @@ in lib.makeExtensible (self: {
|
||||
nix_2_13 = common {
|
||||
version = "2.13.3";
|
||||
hash = "sha256-jUc2ccTR8f6MGY2pUKgujm+lxSPNGm/ZAP+toX+nMNc=";
|
||||
patches = [
|
||||
patch-fix-aarch64-darwin-static
|
||||
];
|
||||
};
|
||||
|
||||
nix_2_14 = common {
|
||||
|
@ -259,10 +259,12 @@ let
|
||||
overlays = [ (self': super': {
|
||||
pkgsStatic = super';
|
||||
})] ++ overlays;
|
||||
} // lib.optionalAttrs stdenv.hostPlatform.isLinux {
|
||||
crossSystem = {
|
||||
isStatic = true;
|
||||
parsed = makeMuslParsedPlatform stdenv.hostPlatform.parsed;
|
||||
parsed =
|
||||
if stdenv.isLinux
|
||||
then makeMuslParsedPlatform stdenv.hostPlatform.parsed
|
||||
else stdenv.hostPlatform.parsed;
|
||||
} // lib.optionalAttrs (stdenv.hostPlatform.system == "powerpc64-linux") {
|
||||
gcc.abi = "elfv2";
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user