gcc: Adjust builder.sh to find some things in bintools-wrapper instead
This commit is contained in:
parent
99806c5e12
commit
12e0672d88
@ -356,6 +356,7 @@ stdenv.mkDerivation ({
|
|||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools;
|
||||||
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
||||||
|
|
||||||
# Needed for the cross compilation to work
|
# Needed for the cross compilation to work
|
||||||
|
@ -444,6 +444,7 @@ stdenv.mkDerivation ({
|
|||||||
buildFlags = "";
|
buildFlags = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools;
|
||||||
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
||||||
|
|
||||||
# Needed for the cross compilation to work
|
# Needed for the cross compilation to work
|
||||||
|
@ -442,6 +442,7 @@ stdenv.mkDerivation ({
|
|||||||
buildFlags = "";
|
buildFlags = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools;
|
||||||
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
||||||
|
|
||||||
# Needed for the cross compilation to work
|
# Needed for the cross compilation to work
|
||||||
|
@ -451,6 +451,7 @@ stdenv.mkDerivation ({
|
|||||||
buildFlags = "";
|
buildFlags = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools;
|
||||||
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
||||||
|
|
||||||
# Needed for the cross compilation to work
|
# Needed for the cross compilation to work
|
||||||
|
@ -452,6 +452,7 @@ stdenv.mkDerivation ({
|
|||||||
buildFlags = "";
|
buildFlags = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools;
|
||||||
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
||||||
|
|
||||||
# Needed for the cross compilation to work
|
# Needed for the cross compilation to work
|
||||||
|
@ -446,6 +446,7 @@ stdenv.mkDerivation ({
|
|||||||
buildFlags = "";
|
buildFlags = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools;
|
||||||
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
||||||
|
|
||||||
# Needed for the cross compilation to work
|
# Needed for the cross compilation to work
|
||||||
|
@ -28,37 +28,55 @@ if test "$noSysDirs" = "1"; then
|
|||||||
EXTRA_BUILD_FLAGS EXTRA_FLAGS EXTRA_TARGET_FLAGS \
|
EXTRA_BUILD_FLAGS EXTRA_FLAGS EXTRA_TARGET_FLAGS \
|
||||||
EXTRA_BUILD_LDFLAGS EXTRA_TARGET_LDFLAGS
|
EXTRA_BUILD_LDFLAGS EXTRA_TARGET_LDFLAGS
|
||||||
|
|
||||||
|
# Extract flags from Bintools Wrappers
|
||||||
|
for pre in 'BUILD_' ''; do
|
||||||
|
curBintools="NIX_${pre}BINTOOLS"
|
||||||
|
|
||||||
|
declare -a extraLDFlags=()
|
||||||
|
if [[ -e "${!curBintools}/nix-support/orig-libc" ]]; then
|
||||||
|
# Figure out what extra flags when linking to pass to the gcc
|
||||||
|
# compilers being generated to make sure that they use our libc.
|
||||||
|
extraLDFlags=($(< "${!curBintools}/nix-support/libc-ldflags") $(< "${!curBintools}/nix-support/libc-ldflags-before" || true))
|
||||||
|
|
||||||
|
# The path to the Libc binaries such as `crti.o'.
|
||||||
|
libc_libdir="$(< "${!curBintools}/nix-support/orig-libc")/lib"
|
||||||
|
else
|
||||||
|
# Hack: support impure environments.
|
||||||
|
extraLDFlags=("-L/usr/lib64" "-L/usr/lib")
|
||||||
|
libc_libdir="/usr/lib"
|
||||||
|
fi
|
||||||
|
extraLDFlags=("-L$libc_libdir" "-rpath" "$libc_libdir"
|
||||||
|
"${extraLDFlags[@]}")
|
||||||
|
for i in "${extraLDFlags[@]}"; do
|
||||||
|
declare EXTRA_${pre}LDFLAGS+=" -Wl,$i"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
# Extract flags from CC Wrappers
|
||||||
for pre in 'BUILD_' ''; do
|
for pre in 'BUILD_' ''; do
|
||||||
curCC="NIX_${pre}CC"
|
curCC="NIX_${pre}CC"
|
||||||
curFIXINC="NIX_${pre}FIXINC_DUMMY"
|
curFIXINC="NIX_${pre}FIXINC_DUMMY"
|
||||||
|
|
||||||
declare -a extraFlags=() extraLDFlags=()
|
declare -a extraFlags=()
|
||||||
if [[ -e "${!curCC}/nix-support/orig-libc" ]]; then
|
if [[ -e "${!curCC}/nix-support/orig-libc" ]]; then
|
||||||
# Figure out what extra flags to pass to the gcc compilers being
|
# Figure out what extra compiling flags to pass to the gcc compilers
|
||||||
# generated to make sure that they use our glibc.
|
# being generated to make sure that they use our libc.
|
||||||
extraFlags=($(cat "${!curCC}/nix-support/libc-cflags"))
|
extraFlags=($(< "${!curCC}/nix-support/libc-cflags"))
|
||||||
extraLDFlags=($(cat "${!curCC}/nix-support/libc-ldflags") $(cat "${!curCC}/nix-support/libc-ldflags-before" || true))
|
|
||||||
|
|
||||||
# The path to the Glibc binaries such as `crti.o'.
|
# The path to the Libc headers
|
||||||
glibc_libdir="$(cat "${!curCC}/nix-support/orig-libc")/lib"
|
libc_devdir="$(< "${!curCC}/nix-support/orig-libc-dev")"
|
||||||
glibc_devdir="$(cat "${!curCC}/nix-support/orig-libc-dev")"
|
|
||||||
|
|
||||||
# Use *real* header files, otherwise a limits.h is generated that
|
# Use *real* header files, otherwise a limits.h is generated that
|
||||||
# does not include Glibc's limits.h (notably missing SSIZE_MAX,
|
# does not include Libc's limits.h (notably missing SSIZE_MAX,
|
||||||
# which breaks the build).
|
# which breaks the build).
|
||||||
declare NIX_${pre}FIXINC_DUMMY="$glibc_devdir/include"
|
declare NIX_${pre}FIXINC_DUMMY="$libc_devdir/include"
|
||||||
else
|
else
|
||||||
# Hack: support impure environments.
|
# Hack: support impure environments.
|
||||||
extraFlags=("-isystem" "/usr/include")
|
extraFlags=("-isystem" "/usr/include")
|
||||||
extraLDFlags=("-L/usr/lib64" "-L/usr/lib")
|
|
||||||
glibc_libdir="/usr/lib"
|
|
||||||
declare NIX_${pre}FIXINC_DUMMY=/usr/include
|
declare NIX_${pre}FIXINC_DUMMY=/usr/include
|
||||||
fi
|
fi
|
||||||
|
|
||||||
extraFlags=("-I${!curFIXINC}"
|
extraFlags=("-I${!curFIXINC}" "${extraFlags[@]}")
|
||||||
"${extraFlags[@]}")
|
|
||||||
extraLDFlags=("-L$glibc_libdir" "-rpath" "$glibc_libdir"
|
|
||||||
"${extraLDFlags[@]}")
|
|
||||||
|
|
||||||
# BOOT_CFLAGS defaults to `-g -O2'; since we override it below, make
|
# BOOT_CFLAGS defaults to `-g -O2'; since we override it below, make
|
||||||
# sure to explictly add them so that files compiled with the bootstrap
|
# sure to explictly add them so that files compiled with the bootstrap
|
||||||
@ -72,9 +90,6 @@ if test "$noSysDirs" = "1"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
declare EXTRA_${pre}FLAGS="${extraFlags[*]}"
|
declare EXTRA_${pre}FLAGS="${extraFlags[*]}"
|
||||||
for i in "${extraLDFlags[@]}"; do
|
|
||||||
declare EXTRA_${pre}LDFLAGS+=" -Wl,$i"
|
|
||||||
done
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if test -z "${targetConfig-}"; then
|
if test -z "${targetConfig-}"; then
|
||||||
|
@ -433,6 +433,7 @@ stdenv.mkDerivation ({
|
|||||||
buildFlags = "";
|
buildFlags = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools;
|
||||||
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
||||||
|
|
||||||
# Needed for the cross compilation to work
|
# Needed for the cross compilation to work
|
||||||
|
Loading…
x
Reference in New Issue
Block a user