Merge pull request #32098 from obsidiansystems/binPrefix
treewide: Use `targetPrefix` instead of `prefix` for platform name prefixes
This commit is contained in:
commit
1c44d5efc6
|
@ -29,8 +29,8 @@ stdenv.mkDerivation rec {
|
||||||
installFlags = [ "DESTDIR=$(out)" ];
|
installFlags = [ "DESTDIR=$(out)" ];
|
||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"--exec-prefix=${stdenv.cc.prefix}"
|
"--exec-prefix=${stdenv.cc.targetPrefix}"
|
||||||
"CC=${stdenv.cc.prefix}cc"
|
"CC=${stdenv.cc.targetPrefix}cc"
|
||||||
];
|
];
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
|
|
@ -49,7 +49,7 @@ let
|
||||||
crossAttrs = {
|
crossAttrs = {
|
||||||
configurePlatforms = [];
|
configurePlatforms = [];
|
||||||
configureFlags = configureFlags ++ [
|
configureFlags = configureFlags ++ [
|
||||||
"--cross-prefix=${stdenv.cc.prefix}"
|
"--cross-prefix=${stdenv.cc.targetPrefix}"
|
||||||
"--enable-cross-compile"
|
"--enable-cross-compile"
|
||||||
"--target_os=linux"
|
"--target_os=linux"
|
||||||
"--arch=${hostPlatform.arch}"
|
"--arch=${hostPlatform.arch}"
|
||||||
|
|
|
@ -32,8 +32,8 @@ let
|
||||||
#
|
#
|
||||||
# TODO(@Ericson2314) Make unconditional, or optional but always true by
|
# TODO(@Ericson2314) Make unconditional, or optional but always true by
|
||||||
# default.
|
# default.
|
||||||
prefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
|
targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
|
||||||
(targetPlatform.config + "-");
|
(targetPlatform.config + "-");
|
||||||
|
|
||||||
ccVersion = (builtins.parseDrvName cc.name).version;
|
ccVersion = (builtins.parseDrvName cc.name).version;
|
||||||
ccName = (builtins.parseDrvName cc.name).name;
|
ccName = (builtins.parseDrvName cc.name).name;
|
||||||
|
@ -81,7 +81,7 @@ let
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = prefix
|
name = targetPrefix
|
||||||
+ (if name != "" then name else "${ccName}-wrapper")
|
+ (if name != "" then name else "${ccName}-wrapper")
|
||||||
+ (stdenv.lib.optionalString (cc != null && ccVersion != "") "-${ccVersion}");
|
+ (stdenv.lib.optionalString (cc != null && ccVersion != "") "-${ccVersion}");
|
||||||
|
|
||||||
|
@ -91,8 +91,7 @@ stdenv.mkDerivation {
|
||||||
shell = getBin shell + shell.shellPath or "";
|
shell = getBin shell + shell.shellPath or "";
|
||||||
gnugrep_bin = if nativeTools then "" else gnugrep;
|
gnugrep_bin = if nativeTools then "" else gnugrep;
|
||||||
|
|
||||||
binPrefix = prefix;
|
inherit targetPrefix infixSalt;
|
||||||
inherit infixSalt;
|
|
||||||
|
|
||||||
outputs = [ "out" "man" ];
|
outputs = [ "out" "man" ];
|
||||||
|
|
||||||
|
@ -102,8 +101,7 @@ stdenv.mkDerivation {
|
||||||
# Binutils, and Apple's "cctools"; "binutils" as an attempt to find an
|
# Binutils, and Apple's "cctools"; "binutils" as an attempt to find an
|
||||||
# unused middle-ground name that evokes both.
|
# unused middle-ground name that evokes both.
|
||||||
bintools = binutils_bin;
|
bintools = binutils_bin;
|
||||||
inherit libc nativeTools nativeLibc nativePrefix isGNU isClang default_cxx_stdlib_compile
|
inherit libc nativeTools nativeLibc nativePrefix isGNU isClang default_cxx_stdlib_compile;
|
||||||
prefix;
|
|
||||||
|
|
||||||
emacsBufferSetup = pkgs: ''
|
emacsBufferSetup = pkgs: ''
|
||||||
; We should handle propagation here too
|
; We should handle propagation here too
|
||||||
|
@ -154,7 +152,7 @@ stdenv.mkDerivation {
|
||||||
+ optionalString (targetPlatform.isSunOS && nativePrefix != "") ''
|
+ optionalString (targetPlatform.isSunOS && nativePrefix != "") ''
|
||||||
# Solaris needs an additional ld wrapper.
|
# Solaris needs an additional ld wrapper.
|
||||||
ldPath="${nativePrefix}/bin"
|
ldPath="${nativePrefix}/bin"
|
||||||
exec="$ldPath/${prefix}ld"
|
exec="$ldPath/${targetPrefix}ld"
|
||||||
wrap ld-solaris ${./ld-solaris-wrapper.sh}
|
wrap ld-solaris ${./ld-solaris-wrapper.sh}
|
||||||
'')
|
'')
|
||||||
|
|
||||||
|
@ -162,83 +160,83 @@ stdenv.mkDerivation {
|
||||||
# Create a symlink to as (the assembler). This is useful when a
|
# Create a symlink to as (the assembler). This is useful when a
|
||||||
# cc-wrapper is installed in a user environment, as it ensures that
|
# cc-wrapper is installed in a user environment, as it ensures that
|
||||||
# the right assembler is called.
|
# the right assembler is called.
|
||||||
if [ -e $ldPath/${prefix}as ]; then
|
if [ -e $ldPath/${targetPrefix}as ]; then
|
||||||
ln -s $ldPath/${prefix}as $out/bin/${prefix}as
|
ln -s $ldPath/${targetPrefix}as $out/bin/${targetPrefix}as
|
||||||
fi
|
fi
|
||||||
|
|
||||||
'' + (if !useMacosReexportHack then ''
|
'' + (if !useMacosReexportHack then ''
|
||||||
wrap ${prefix}ld ${./ld-wrapper.sh} ''${ld:-$ldPath/${prefix}ld}
|
wrap ${targetPrefix}ld ${./ld-wrapper.sh} ''${ld:-$ldPath/${targetPrefix}ld}
|
||||||
'' else ''
|
'' else ''
|
||||||
ldInner="${prefix}ld-reexport-delegate"
|
ldInner="${targetPrefix}ld-reexport-delegate"
|
||||||
wrap "$ldInner" ${./macos-sierra-reexport-hack.bash} ''${ld:-$ldPath/${prefix}ld}
|
wrap "$ldInner" ${./macos-sierra-reexport-hack.bash} ''${ld:-$ldPath/${targetPrefix}ld}
|
||||||
wrap "${prefix}ld" ${./ld-wrapper.sh} "$out/bin/$ldInner"
|
wrap "${targetPrefix}ld" ${./ld-wrapper.sh} "$out/bin/$ldInner"
|
||||||
unset ldInner
|
unset ldInner
|
||||||
'') + ''
|
'') + ''
|
||||||
|
|
||||||
if [ -e ${binutils_bin}/bin/${prefix}ld.gold ]; then
|
if [ -e ${binutils_bin}/bin/${targetPrefix}ld.gold ]; then
|
||||||
wrap ${prefix}ld.gold ${./ld-wrapper.sh} ${binutils_bin}/bin/${prefix}ld.gold
|
wrap ${targetPrefix}ld.gold ${./ld-wrapper.sh} ${binutils_bin}/bin/${targetPrefix}ld.gold
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e ${binutils_bin}/bin/ld.bfd ]; then
|
if [ -e ${binutils_bin}/bin/ld.bfd ]; then
|
||||||
wrap ${prefix}ld.bfd ${./ld-wrapper.sh} ${binutils_bin}/bin/${prefix}ld.bfd
|
wrap ${targetPrefix}ld.bfd ${./ld-wrapper.sh} ${binutils_bin}/bin/${targetPrefix}ld.bfd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We export environment variables pointing to the wrapped nonstandard
|
# We export environment variables pointing to the wrapped nonstandard
|
||||||
# cmds, lest some lousy configure script use those to guess compiler
|
# cmds, lest some lousy configure script use those to guess compiler
|
||||||
# version.
|
# version.
|
||||||
export named_cc=${prefix}cc
|
export named_cc=${targetPrefix}cc
|
||||||
export named_cxx=${prefix}c++
|
export named_cxx=${targetPrefix}c++
|
||||||
|
|
||||||
export default_cxx_stdlib_compile="${default_cxx_stdlib_compile}"
|
export default_cxx_stdlib_compile="${default_cxx_stdlib_compile}"
|
||||||
|
|
||||||
if [ -e $ccPath/${prefix}gcc ]; then
|
if [ -e $ccPath/${targetPrefix}gcc ]; then
|
||||||
wrap ${prefix}gcc ${./cc-wrapper.sh} $ccPath/${prefix}gcc
|
wrap ${targetPrefix}gcc ${./cc-wrapper.sh} $ccPath/${targetPrefix}gcc
|
||||||
ln -s ${prefix}gcc $out/bin/${prefix}cc
|
ln -s ${targetPrefix}gcc $out/bin/${targetPrefix}cc
|
||||||
export named_cc=${prefix}gcc
|
export named_cc=${targetPrefix}gcc
|
||||||
export named_cxx=${prefix}g++
|
export named_cxx=${targetPrefix}g++
|
||||||
elif [ -e $ccPath/clang ]; then
|
elif [ -e $ccPath/clang ]; then
|
||||||
wrap ${prefix}clang ${./cc-wrapper.sh} $ccPath/clang
|
wrap ${targetPrefix}clang ${./cc-wrapper.sh} $ccPath/clang
|
||||||
ln -s ${prefix}clang $out/bin/${prefix}cc
|
ln -s ${targetPrefix}clang $out/bin/${targetPrefix}cc
|
||||||
export named_cc=${prefix}clang
|
export named_cc=${targetPrefix}clang
|
||||||
export named_cxx=${prefix}clang++
|
export named_cxx=${targetPrefix}clang++
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e $ccPath/${prefix}g++ ]; then
|
if [ -e $ccPath/${targetPrefix}g++ ]; then
|
||||||
wrap ${prefix}g++ ${./cc-wrapper.sh} $ccPath/${prefix}g++
|
wrap ${targetPrefix}g++ ${./cc-wrapper.sh} $ccPath/${targetPrefix}g++
|
||||||
ln -s ${prefix}g++ $out/bin/${prefix}c++
|
ln -s ${targetPrefix}g++ $out/bin/${targetPrefix}c++
|
||||||
elif [ -e $ccPath/clang++ ]; then
|
elif [ -e $ccPath/clang++ ]; then
|
||||||
wrap ${prefix}clang++ ${./cc-wrapper.sh} $ccPath/clang++
|
wrap ${targetPrefix}clang++ ${./cc-wrapper.sh} $ccPath/clang++
|
||||||
ln -s ${prefix}clang++ $out/bin/${prefix}c++
|
ln -s ${targetPrefix}clang++ $out/bin/${targetPrefix}c++
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e $ccPath/cpp ]; then
|
if [ -e $ccPath/cpp ]; then
|
||||||
wrap ${prefix}cpp ${./cc-wrapper.sh} $ccPath/cpp
|
wrap ${targetPrefix}cpp ${./cc-wrapper.sh} $ccPath/cpp
|
||||||
fi
|
fi
|
||||||
''
|
''
|
||||||
|
|
||||||
+ optionalString cc.langFortran or false ''
|
+ optionalString cc.langFortran or false ''
|
||||||
wrap ${prefix}gfortran ${./cc-wrapper.sh} $ccPath/${prefix}gfortran
|
wrap ${targetPrefix}gfortran ${./cc-wrapper.sh} $ccPath/${targetPrefix}gfortran
|
||||||
ln -sv ${prefix}gfortran $out/bin/${prefix}g77
|
ln -sv ${targetPrefix}gfortran $out/bin/${targetPrefix}g77
|
||||||
ln -sv ${prefix}gfortran $out/bin/${prefix}f77
|
ln -sv ${targetPrefix}gfortran $out/bin/${targetPrefix}f77
|
||||||
''
|
''
|
||||||
|
|
||||||
+ optionalString cc.langJava or false ''
|
+ optionalString cc.langJava or false ''
|
||||||
wrap ${prefix}gcj ${./cc-wrapper.sh} $ccPath/${prefix}gcj
|
wrap ${targetPrefix}gcj ${./cc-wrapper.sh} $ccPath/${targetPrefix}gcj
|
||||||
''
|
''
|
||||||
|
|
||||||
+ optionalString cc.langGo or false ''
|
+ optionalString cc.langGo or false ''
|
||||||
wrap ${prefix}gccgo ${./cc-wrapper.sh} $ccPath/${prefix}gccgo
|
wrap ${targetPrefix}gccgo ${./cc-wrapper.sh} $ccPath/${targetPrefix}gccgo
|
||||||
''
|
''
|
||||||
|
|
||||||
+ optionalString cc.langAda or false ''
|
+ optionalString cc.langAda or false ''
|
||||||
wrap ${prefix}gnatgcc ${./cc-wrapper.sh} $ccPath/${prefix}gnatgcc
|
wrap ${targetPrefix}gnatgcc ${./cc-wrapper.sh} $ccPath/${targetPrefix}gnatgcc
|
||||||
wrap ${prefix}gnatmake ${./gnat-wrapper.sh} $ccPath/${prefix}gnatmake
|
wrap ${targetPrefix}gnatmake ${./gnat-wrapper.sh} $ccPath/${targetPrefix}gnatmake
|
||||||
wrap ${prefix}gnatbind ${./gnat-wrapper.sh} $ccPath/${prefix}gnatbind
|
wrap ${targetPrefix}gnatbind ${./gnat-wrapper.sh} $ccPath/${targetPrefix}gnatbind
|
||||||
wrap ${prefix}gnatlink ${./gnatlink-wrapper.sh} $ccPath/${prefix}gnatlink
|
wrap ${targetPrefix}gnatlink ${./gnatlink-wrapper.sh} $ccPath/${targetPrefix}gnatlink
|
||||||
''
|
''
|
||||||
|
|
||||||
+ optionalString cc.langVhdl or false ''
|
+ optionalString cc.langVhdl or false ''
|
||||||
ln -s $ccPath/${prefix}ghdl $out/bin/${prefix}ghdl
|
ln -s $ccPath/${targetPrefix}ghdl $out/bin/${targetPrefix}ghdl
|
||||||
'';
|
'';
|
||||||
|
|
||||||
propagatedBuildInputs = extraPackages;
|
propagatedBuildInputs = extraPackages;
|
||||||
|
@ -362,10 +360,10 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
# some linkers on some platforms don't support specific -z flags
|
# some linkers on some platforms don't support specific -z flags
|
||||||
export hardening_unsupported_flags=""
|
export hardening_unsupported_flags=""
|
||||||
if [[ "$($ldPath/${prefix}ld -z now 2>&1 || true)" =~ un(recognized|known)\ option ]]; then
|
if [[ "$($ldPath/${targetPrefix}ld -z now 2>&1 || true)" =~ un(recognized|known)\ option ]]; then
|
||||||
hardening_unsupported_flags+=" bindnow"
|
hardening_unsupported_flags+=" bindnow"
|
||||||
fi
|
fi
|
||||||
if [[ "$($ldPath/${prefix}ld -z relro 2>&1 || true)" =~ un(recognized|known)\ option ]]; then
|
if [[ "$($ldPath/${targetPrefix}ld -z relro 2>&1 || true)" =~ un(recognized|known)\ option ]]; then
|
||||||
hardening_unsupported_flags+=" relro"
|
hardening_unsupported_flags+=" relro"
|
||||||
fi
|
fi
|
||||||
''
|
''
|
||||||
|
|
|
@ -117,7 +117,7 @@ let
|
||||||
-exec sed '1i#line 1 "{}"' -i '{}' \;
|
-exec sed '1i#line 1 "{}"' -i '{}' \;
|
||||||
)
|
)
|
||||||
'' + optionalString (hostPlatform.libc == "msvcrt") ''
|
'' + optionalString (hostPlatform.libc == "msvcrt") ''
|
||||||
${stdenv.cc.prefix}ranlib "$out/lib/"*.a
|
${stdenv.cc.targetPrefix}ranlib "$out/lib/"*.a
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
|
@ -438,7 +438,7 @@ stdenv.mkDerivation rec {
|
||||||
crossAttrs = {
|
crossAttrs = {
|
||||||
configurePlatforms = [];
|
configurePlatforms = [];
|
||||||
configureFlags = configureFlags ++ [
|
configureFlags = configureFlags ++ [
|
||||||
"--cross-prefix=${stdenv.cc.prefix}"
|
"--cross-prefix=${stdenv.cc.targetPrefix}"
|
||||||
"--enable-cross-compile"
|
"--enable-cross-compile"
|
||||||
"--target_os=${hostPlatform.parsed.kernel.name}"
|
"--target_os=${hostPlatform.parsed.kernel.name}"
|
||||||
"--arch=${hostPlatform.arch}"
|
"--arch=${hostPlatform.arch}"
|
||||||
|
|
|
@ -173,7 +173,7 @@ stdenv.mkDerivation rec {
|
||||||
crossAttrs = {
|
crossAttrs = {
|
||||||
configurePlatforms = [];
|
configurePlatforms = [];
|
||||||
configureFlags = configureFlags ++ [
|
configureFlags = configureFlags ++ [
|
||||||
"--cross-prefix=${stdenv.cc.prefix}"
|
"--cross-prefix=${stdenv.cc.targetPrefix}"
|
||||||
"--enable-cross-compile"
|
"--enable-cross-compile"
|
||||||
"--target_os=${hostPlatform.parsed.kernel}"
|
"--target_os=${hostPlatform.parsed.kernel}"
|
||||||
"--arch=${hostPlatform.arch}"
|
"--arch=${hostPlatform.arch}"
|
||||||
|
|
|
@ -110,7 +110,7 @@ let
|
||||||
crossAttrs = {
|
crossAttrs = {
|
||||||
configurePlatforms = [];
|
configurePlatforms = [];
|
||||||
configureFlags = configureFlags ++ [
|
configureFlags = configureFlags ++ [
|
||||||
"--cross-prefix=${stdenv.cc.prefix}"
|
"--cross-prefix=${stdenv.cc.targetPrefix}"
|
||||||
"--enable-cross-compile"
|
"--enable-cross-compile"
|
||||||
"--target_os=linux"
|
"--target_os=linux"
|
||||||
"--arch=${hostPlatform.arch}"
|
"--arch=${hostPlatform.arch}"
|
||||||
|
|
|
@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
crossAttrs = {
|
crossAttrs = {
|
||||||
makeFlags = "CROSS_COMPILE=${stdenv.cc.prefix}";
|
makeFlags = "CROSS_COMPILE=${stdenv.cc.targetPrefix}";
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
|
|
|
@ -229,11 +229,11 @@ stdenv.mkDerivation rec {
|
||||||
'' + optionalString hostPlatform.isMinGW " -xplatform win32-g++-4.6";
|
'' + optionalString hostPlatform.isMinGW " -xplatform win32-g++-4.6";
|
||||||
patches = [];
|
patches = [];
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
sed -i -e 's/ g++/ ${stdenv.cc.prefix}g++/' \
|
sed -i -e 's/ g++/ ${stdenv.cc.targetPrefix}g++/' \
|
||||||
-e 's/ gcc/ ${stdenv.cc.prefix}gcc/' \
|
-e 's/ gcc/ ${stdenv.cc.targetPrefix}gcc/' \
|
||||||
-e 's/ ar/ ${stdenv.cc.prefix}ar/' \
|
-e 's/ ar/ ${stdenv.cc.targetPrefix}ar/' \
|
||||||
-e 's/ strip/ ${stdenv.cc.prefix}strip/' \
|
-e 's/ strip/ ${stdenv.cc.targetPrefix}strip/' \
|
||||||
-e 's/ windres/ ${stdenv.cc.prefix}windres/' \
|
-e 's/ windres/ ${stdenv.cc.targetPrefix}windres/' \
|
||||||
mkspecs/win32-g++/qmake.conf
|
mkspecs/win32-g++/qmake.conf
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ stdenv.mkDerivation rec {
|
||||||
];
|
];
|
||||||
|
|
||||||
makeFlags = [
|
makeFlags = [
|
||||||
"PREFIX=${stdenv.cc.prefix}"
|
"PREFIX=${stdenv.cc.targetPrefix}"
|
||||||
] ++ stdenv.lib.optionals (hostPlatform.libc == "msvcrt") [
|
] ++ stdenv.lib.optionals (hostPlatform.libc == "msvcrt") [
|
||||||
"-f" "win32/Makefile.gcc"
|
"-f" "win32/Makefile.gcc"
|
||||||
] ++ stdenv.lib.optionals (!static) [
|
] ++ stdenv.lib.optionals (!static) [
|
||||||
|
|
|
@ -11,13 +11,13 @@ let
|
||||||
version = "2.28.1";
|
version = "2.28.1";
|
||||||
basename = "binutils-${version}";
|
basename = "binutils-${version}";
|
||||||
inherit (stdenv.lib) optional optionals optionalString;
|
inherit (stdenv.lib) optional optionals optionalString;
|
||||||
# The prefix prepended to binary names to allow multiple binuntils on the
|
# The targetPrefix prepended to binary names to allow multiple binuntils on the
|
||||||
# PATH to both be usable.
|
# PATH to both be usable.
|
||||||
prefix = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-";
|
targetPrefix = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-";
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = prefix + basename;
|
name = targetPrefix + basename;
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "mirror://gnu/binutils/${basename}.tar.bz2";
|
url = "mirror://gnu/binutils/${basename}.tar.bz2";
|
||||||
|
@ -81,7 +81,7 @@ stdenv.mkDerivation rec {
|
||||||
then "-Wno-string-plus-int -Wno-deprecated-declarations"
|
then "-Wno-string-plus-int -Wno-deprecated-declarations"
|
||||||
else "-static-libgcc";
|
else "-static-libgcc";
|
||||||
|
|
||||||
# TODO(@Ericson2314): Always pass "--target" and always prefix.
|
# TODO(@Ericson2314): Always pass "--target" and always targetPrefix.
|
||||||
configurePlatforms =
|
configurePlatforms =
|
||||||
# TODO(@Ericson2314): Figure out what's going wrong with Arm
|
# TODO(@Ericson2314): Figure out what's going wrong with Arm
|
||||||
if hostPlatform == targetPlatform && targetPlatform.isArm
|
if hostPlatform == targetPlatform && targetPlatform.isArm
|
||||||
|
@ -102,7 +102,7 @@ stdenv.mkDerivation rec {
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit prefix version;
|
inherit targetPrefix version;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
|
|
|
@ -63,7 +63,7 @@ let
|
||||||
crossAttrs = {
|
crossAttrs = {
|
||||||
makeFlags = [
|
makeFlags = [
|
||||||
"ARCH=${hostPlatform.platform.kernelArch}"
|
"ARCH=${hostPlatform.platform.kernelArch}"
|
||||||
"CROSS_COMPILE=${stdenv.cc.prefix}"
|
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,24 +3,24 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
# 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 prefix.
|
# with the same targetPrefix.
|
||||||
assert binutils-raw.prefix == cctools.prefix;
|
assert binutils-raw.targetPrefix == cctools.targetPrefix;
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (binutils-raw) prefix;
|
inherit (binutils-raw) 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"
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
|
|
||||||
# TODO loop over prefixed binaries too
|
# TODO loop over targetPrefixed binaries too
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "${prefix}cctools-binutils-darwin";
|
name = "${targetPrefix}cctools-binutils-darwin";
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
mkdir -p $out/bin $out/include
|
mkdir -p $out/bin $out/include
|
||||||
|
|
||||||
ln -s ${binutils-raw.out}/bin/${prefix}c++filt $out/bin/${prefix}c++filt
|
ln -s ${binutils-raw.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
|
||||||
|
@ -33,7 +33,7 @@ stdenv.mkDerivation {
|
||||||
# - strip: the binutils one seems to break mach-o files
|
# - strip: the binutils one seems to break mach-o files
|
||||||
# - lipo: gcc build assumes it exists
|
# - lipo: gcc build assumes it exists
|
||||||
# - nm: the gnu one doesn't understand many new load commands
|
# - nm: the gnu one doesn't understand many new load commands
|
||||||
for i in ${stdenv.lib.concatStringsSep " " (builtins.map (e: prefix + e) cmds)}; do
|
for i in ${stdenv.lib.concatStringsSep " " (builtins.map (e: targetPrefix + e) cmds)}; do
|
||||||
ln -sf "${cctools}/bin/$i" "$out/bin/$i"
|
ln -sf "${cctools}/bin/$i" "$out/bin/$i"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -44,6 +44,6 @@ stdenv.mkDerivation {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit prefix;
|
inherit targetPrefix;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
# The prefix prepended to binary names to allow multiple binuntils on the
|
# The targetPrefix prepended to binary names to allow multiple binuntils on the
|
||||||
# PATH to both be usable.
|
# PATH to both be usable.
|
||||||
prefix = stdenv.lib.optionalString
|
targetPrefix = stdenv.lib.optionalString
|
||||||
(targetPlatform != hostPlatform)
|
(targetPlatform != hostPlatform)
|
||||||
"${targetPlatform.config}-";
|
"${targetPlatform.config}-";
|
||||||
in
|
in
|
||||||
|
@ -19,7 +19,7 @@ assert (!hostPlatform.isDarwin) -> (maloader != null && xctoolchain != null);
|
||||||
|
|
||||||
let
|
let
|
||||||
baseParams = rec {
|
baseParams = rec {
|
||||||
name = "${prefix}cctools-port-${version}";
|
name = "${targetPrefix}cctools-port-${version}";
|
||||||
version = "895";
|
version = "895";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
|
@ -49,7 +49,7 @@ let
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
# TODO(@Ericson2314): Always pass "--target" and always prefix.
|
# TODO(@Ericson2314): Always pass "--target" and always targetPrefix.
|
||||||
configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
|
configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
|
||||||
configureFlags = stdenv.lib.optionals (!stdenv.isDarwin) [
|
configureFlags = stdenv.lib.optionals (!stdenv.isDarwin) [
|
||||||
"CXXFLAGS=-I${libcxx}/include/c++/v1"
|
"CXXFLAGS=-I${libcxx}/include/c++/v1"
|
||||||
|
@ -113,7 +113,7 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit prefix;
|
inherit targetPrefix;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
|
|
@ -78,7 +78,7 @@ stdenv.mkDerivation rec {
|
||||||
CONFIG_DEFAULT_SETFONT_DIR "/etc/kbd"
|
CONFIG_DEFAULT_SETFONT_DIR "/etc/kbd"
|
||||||
|
|
||||||
${extraConfig}
|
${extraConfig}
|
||||||
CONFIG_CROSS_COMPILER_PREFIX "${stdenv.cc.prefix}"
|
CONFIG_CROSS_COMPILER_PREFIX "${stdenv.cc.targetPrefix}"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
make oldconfig
|
make oldconfig
|
||||||
|
@ -87,7 +87,7 @@ stdenv.mkDerivation rec {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postConfigure = lib.optionalString useMusl ''
|
postConfigure = lib.optionalString useMusl ''
|
||||||
makeFlagsArray+=("CC=${stdenv.cc.prefix}gcc -isystem ${musl}/include -B${musl}/lib -L${musl}/lib")
|
makeFlagsArray+=("CC=${stdenv.cc.targetPrefix}gcc -isystem ${musl}/include -B${musl}/lib -L${musl}/lib")
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = lib.optional (hostPlatform != buildPlatform) buildPackages.stdenv.cc;
|
nativeBuildInputs = lib.optional (hostPlatform != buildPlatform) buildPackages.stdenv.cc;
|
||||||
|
|
|
@ -51,7 +51,7 @@ stdenv.mkDerivation {
|
||||||
/* I don't want cross-python or cross-perl -
|
/* I don't want cross-python or cross-perl -
|
||||||
I don't know if cross-python even works */
|
I don't know if cross-python even works */
|
||||||
propagatedBuildInputs = [ elfutils.crossDrv newt.crossDrv ];
|
propagatedBuildInputs = [ elfutils.crossDrv newt.crossDrv ];
|
||||||
makeFlags = "CROSS_COMPILE=${stdenv.cc.prefix}";
|
makeFlags = "CROSS_COMPILE=${stdenv.cc.targetPrefix}";
|
||||||
elfutils = elfutils.crossDrv;
|
elfutils = elfutils.crossDrv;
|
||||||
inherit (kernel.crossDrv) src patches;
|
inherit (kernel.crossDrv) src patches;
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
|
||||||
] # TODO(@Ericson2314): We now can get the ABI from
|
] # TODO(@Ericson2314): We now can get the ABI from
|
||||||
# `hostPlatform.parsed.abi`, is this still a good idea?
|
# `hostPlatform.parsed.abi`, is this still a good idea?
|
||||||
++ stdenv.lib.optional (hostPlatform.platform.kernelArch == "arm") "CONFIG_AEABI=y"
|
++ stdenv.lib.optional (hostPlatform.platform.kernelArch == "arm") "CONFIG_AEABI=y"
|
||||||
++ stdenv.lib.optional (hostPlatform != buildPlatform) "CROSS_COMPILE=${stdenv.cc.prefix}";
|
++ stdenv.lib.optional (hostPlatform != buildPlatform) "CROSS_COMPILE=${stdenv.cc.targetPrefix}";
|
||||||
|
|
||||||
# Install static binaries as well.
|
# Install static binaries as well.
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
|
|
|
@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
|
||||||
"MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
|
"MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
|
||||||
"STRIP="
|
"STRIP="
|
||||||
] ++ stdenv.lib.optionals (hostPlatform != buildPlatform) [
|
] ++ stdenv.lib.optionals (hostPlatform != buildPlatform) [
|
||||||
"CROSS_COMPILE=${stdenv.cc.prefix}"
|
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
||||||
];
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [ groff ];
|
nativeBuildInputs = [ groff ];
|
||||||
|
|
|
@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
|
||||||
"MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
|
"MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
|
||||||
"STRIP="
|
"STRIP="
|
||||||
] ++ stdenv.lib.optionals (hostPlatform != buildPlatform) [
|
] ++ stdenv.lib.optionals (hostPlatform != buildPlatform) [
|
||||||
"CROSS_COMPILE=${stdenv.cc.prefix}"
|
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
||||||
];
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [ groff ];
|
nativeBuildInputs = [ groff ];
|
||||||
|
|
|
@ -18,7 +18,7 @@ stdenv.mkDerivation {
|
||||||
QTDIR = qt48;
|
QTDIR = qt48;
|
||||||
|
|
||||||
crossAttrs = {
|
crossAttrs = {
|
||||||
# cmakeFlags = "-DWIN32=1 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_RC_COMPILER=${stdenv.cc.prefix}windres";
|
# cmakeFlags = "-DWIN32=1 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_RC_COMPILER=${stdenv.cc.targetPrefix}windres";
|
||||||
QTDIR = qt48.crossDrv;
|
QTDIR = qt48.crossDrv;
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
export NIX_CROSS_CFLAGS_COMPILE=-fpermissive
|
export NIX_CROSS_CFLAGS_COMPILE=-fpermissive
|
||||||
|
|
|
@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
makeFlags = [
|
makeFlags = [
|
||||||
"INSTALL=install"
|
"INSTALL=install"
|
||||||
"STRIP=${stdenv.cc.bintools.prefix}strip"
|
"STRIP=${stdenv.cc.bintools.targetPrefix}strip"
|
||||||
"prefix=$(out)"
|
"prefix=$(out)"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue