Merge pull request #38399 from obsidiansystems/binutils-is-binutils
binutils: No more darwin conditionals
This commit is contained in:
commit
e4e0cd66fe
|
@ -1,4 +1,4 @@
|
||||||
{ newScope, stdenv, binutils-raw, wrapCCWith, symlinkJoin }:
|
{ newScope, stdenv, binutils, wrapCCWith, symlinkJoin }:
|
||||||
let
|
let
|
||||||
callPackage = newScope (self // {inherit stdenv;});
|
callPackage = newScope (self // {inherit stdenv;});
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ let
|
||||||
emscriptenfastcomp-wrapped = wrapCCWith {
|
emscriptenfastcomp-wrapped = wrapCCWith {
|
||||||
cc = self.emscriptenfastcomp-unwrapped;
|
cc = self.emscriptenfastcomp-unwrapped;
|
||||||
# Never want Apple's cctools for WASM target
|
# Never want Apple's cctools for WASM target
|
||||||
bintools = binutils-raw;
|
bintools = binutils;
|
||||||
libc = stdenv.cc.libc;
|
libc = stdenv.cc.libc;
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
# hardening flags break WASM support
|
# hardening flags break WASM support
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
{ stdenv, buildPackages
|
{ stdenv, buildPackages
|
||||||
, fetchurl, fetchpatch, gnu-config, autoreconfHook264, bison
|
, fetchurl, fetchpatch, gnu-config, autoreconfHook264, bison, binutils-unwrapped
|
||||||
, libiberty, zlib
|
, libiberty, zlib
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let inherit (buildPackages.buildPackages) binutils-raw; in
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "libbfd-${version}";
|
name = "libbfd-${version}";
|
||||||
inherit (binutils-raw.bintools) version src;
|
inherit (binutils-unwrapped) version src;
|
||||||
|
|
||||||
outputs = [ "out" "dev" ];
|
outputs = [ "out" "dev" ];
|
||||||
|
|
||||||
patches = binutils-raw.bintools.patches ++ [
|
patches = binutils-unwrapped.patches ++ [
|
||||||
../../tools/misc/binutils/build-components-separately.patch
|
../../tools/misc/binutils/build-components-separately.patch
|
||||||
(fetchpatch {
|
(fetchpatch {
|
||||||
url = "https://raw.githubusercontent.com/mxe/mxe/e1d4c144ee1994f70f86cf7fd8168fe69bd629c6/src/bfd-1-disable-subdir-doc.patch";
|
url = "https://raw.githubusercontent.com/mxe/mxe/e1d4c144ee1994f70f86cf7fd8168fe69bd629c6/src/bfd-1-disable-subdir-doc.patch";
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
{ stdenv, buildPackages
|
{ stdenv, buildPackages
|
||||||
, fetchurl, autoreconfHook264, bison, binutils-raw
|
, fetchurl, autoreconfHook264, bison, binutils-unwrapped
|
||||||
, libiberty, libbfd
|
, libiberty, libbfd
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "libopcodes-${version}";
|
name = "libopcodes-${version}";
|
||||||
inherit (binutils-raw.bintools) version src;
|
inherit (binutils-unwrapped) version src;
|
||||||
|
|
||||||
outputs = [ "out" "dev" ];
|
outputs = [ "out" "dev" ];
|
||||||
|
|
||||||
patches = binutils-raw.bintools.patches ++ [
|
patches = binutils-unwrapped.patches ++ [
|
||||||
../../tools/misc/binutils/build-components-separately.patch
|
../../tools/misc/binutils/build-components-separately.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
{ stdenv, binutils-raw, cctools
|
{ stdenv, binutils-unwrapped, cctools
|
||||||
, hostPlatform, targetPlatform
|
, hostPlatform, targetPlatform
|
||||||
}:
|
}:
|
||||||
|
|
||||||
# Make sure both underlying packages claim to have prepended their binaries
|
# Make sure both underlying packages claim to have prepended their binaries
|
||||||
# with the same targetPrefix.
|
# with the same targetPrefix.
|
||||||
assert binutils-raw.targetPrefix == cctools.targetPrefix;
|
assert binutils-unwrapped.targetPrefix == cctools.targetPrefix;
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (binutils-raw) targetPrefix;
|
inherit (binutils-unwrapped) targetPrefix;
|
||||||
cmds = [
|
cmds = [
|
||||||
"ar" "ranlib" "as" "dsymutil" "install_name_tool"
|
"ar" "ranlib" "as" "dsymutil" "install_name_tool"
|
||||||
"ld" "strip" "otool" "lipo" "nm" "strings" "size"
|
"ld" "strip" "otool" "lipo" "nm" "strings" "size"
|
||||||
|
@ -21,7 +21,7 @@ stdenv.mkDerivation {
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
mkdir -p $out/bin $out/include
|
mkdir -p $out/bin $out/include
|
||||||
|
|
||||||
ln -s ${binutils-raw.bintools.out}/bin/${targetPrefix}c++filt $out/bin/${targetPrefix}c++filt
|
ln -s ${binutils-unwrapped.out}/bin/${targetPrefix}c++filt $out/bin/${targetPrefix}c++filt
|
||||||
|
|
||||||
# We specifically need:
|
# We specifically need:
|
||||||
# - ld: binutils doesn't provide it on darwin
|
# - ld: binutils doesn't provide it on darwin
|
||||||
|
@ -38,15 +38,15 @@ stdenv.mkDerivation {
|
||||||
ln -sf "${cctools}/bin/$i" "$out/bin/$i"
|
ln -sf "${cctools}/bin/$i" "$out/bin/$i"
|
||||||
done
|
done
|
||||||
|
|
||||||
ln -s ${binutils-raw.bintools.out}/share $out/share
|
ln -s ${binutils-unwrapped.out}/share $out/share
|
||||||
|
|
||||||
ln -s ${cctools}/libexec $out/libexec
|
ln -s ${cctools}/libexec $out/libexec
|
||||||
|
|
||||||
mkdir -p "$info/nix-support" "$man/nix-support"
|
mkdir -p "$info/nix-support" "$man/nix-support"
|
||||||
printWords ${binutils-raw.bintools.info} \
|
printWords ${binutils-unwrapped.info} \
|
||||||
>> $info/nix-support/propagated-build-inputs
|
>> $info/nix-support/propagated-build-inputs
|
||||||
# FIXME: cctools missing man pages
|
# FIXME: cctools missing man pages
|
||||||
printWords ${binutils-raw.bintools.man} \
|
printWords ${binutils-unwrapped.man} \
|
||||||
>> $man/nix-support/propagated-build-inputs
|
>> $man/nix-support/propagated-build-inputs
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -321,11 +321,11 @@ in rec {
|
||||||
darwin = super.darwin // {
|
darwin = super.darwin // {
|
||||||
inherit (darwin) dyld ICU Libsystem libiconv;
|
inherit (darwin) dyld ICU Libsystem libiconv;
|
||||||
} // lib.optionalAttrs (super.targetPlatform == localSystem) {
|
} // lib.optionalAttrs (super.targetPlatform == localSystem) {
|
||||||
inherit (darwin) cctools;
|
inherit (darwin) binutils cctools;
|
||||||
};
|
};
|
||||||
} // lib.optionalAttrs (super.targetPlatform == localSystem) {
|
} // lib.optionalAttrs (super.targetPlatform == localSystem) {
|
||||||
# Need to get rid of these when cross-compiling.
|
# Need to get rid of these when cross-compiling.
|
||||||
inherit binutils binutils-raw;
|
inherit binutils binutils-unwrapped;
|
||||||
};
|
};
|
||||||
in import ../generic rec {
|
in import ../generic rec {
|
||||||
name = "stdenv-darwin";
|
name = "stdenv-darwin";
|
||||||
|
@ -380,7 +380,7 @@ in rec {
|
||||||
bzip2.bin llvmPackages.llvm llvmPackages.llvm.lib zlib.out zlib.dev libffi.out coreutils ed diffutils gnutar
|
bzip2.bin llvmPackages.llvm llvmPackages.llvm.lib zlib.out zlib.dev libffi.out coreutils ed diffutils gnutar
|
||||||
gzip ncurses.out ncurses.dev ncurses.man gnused bash gawk
|
gzip ncurses.out ncurses.dev ncurses.man gnused bash gawk
|
||||||
gnugrep llvmPackages.clang-unwrapped llvmPackages.clang-unwrapped.lib patch pcre.out gettext
|
gnugrep llvmPackages.clang-unwrapped llvmPackages.clang-unwrapped.lib patch pcre.out gettext
|
||||||
binutils-raw.bintools binutils binutils.bintools
|
binutils.bintools darwin.binutils darwin.binutils.bintools
|
||||||
cc.expand-response-params
|
cc.expand-response-params
|
||||||
]) ++ (with pkgs.darwin; [
|
]) ++ (with pkgs.darwin; [
|
||||||
dyld Libsystem CF cctools ICU libiconv locale
|
dyld Libsystem CF cctools ICU libiconv locale
|
||||||
|
|
|
@ -374,7 +374,7 @@ in
|
||||||
${localSystem.libc} = getLibc prevStage;
|
${localSystem.libc} = getLibc prevStage;
|
||||||
} // lib.optionalAttrs (super.targetPlatform == localSystem) {
|
} // lib.optionalAttrs (super.targetPlatform == localSystem) {
|
||||||
# Need to get rid of these when cross-compiling.
|
# Need to get rid of these when cross-compiling.
|
||||||
inherit (prevStage) binutils binutils-raw;
|
inherit (prevStage) binutils binutils-unwrapped;
|
||||||
gcc = cc;
|
gcc = cc;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -7464,22 +7464,17 @@ with pkgs;
|
||||||
|
|
||||||
bin_replace_string = callPackage ../development/tools/misc/bin_replace_string { };
|
bin_replace_string = callPackage ../development/tools/misc/bin_replace_string { };
|
||||||
|
|
||||||
binutils =
|
|
||||||
if targetPlatform.isDarwin
|
|
||||||
then darwin.binutils
|
|
||||||
else binutils-raw;
|
|
||||||
|
|
||||||
binutils-unwrapped = callPackage ../development/tools/misc/binutils {
|
binutils-unwrapped = callPackage ../development/tools/misc/binutils {
|
||||||
# FHS sys dirs presumably only have stuff for the build platform
|
# FHS sys dirs presumably only have stuff for the build platform
|
||||||
noSysDirs = (targetPlatform != buildPlatform) || noSysDirs;
|
noSysDirs = (targetPlatform != buildPlatform) || noSysDirs;
|
||||||
};
|
};
|
||||||
binutils-raw = wrapBintoolsWith {
|
binutils = wrapBintoolsWith {
|
||||||
libc = if targetPlatform != hostPlatform then libcCross else stdenv.cc.libc;
|
libc = if targetPlatform != hostPlatform then libcCross else stdenv.cc.libc;
|
||||||
bintools = binutils-unwrapped;
|
bintools = binutils-unwrapped;
|
||||||
};
|
};
|
||||||
|
binutils_nogold = lowPrio (wrapBintoolsWith {
|
||||||
binutils_nogold = lowPrio (binutils-raw.override {
|
libc = if targetPlatform != hostPlatform then libcCross else stdenv.cc.libc;
|
||||||
bintools = binutils-raw.bintools.override {
|
bintools = binutils-unwrapped.override {
|
||||||
gold = false;
|
gold = false;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue