mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-28 14:22:50 +03:00
aa9a04883e
The main output started to retain dependency on bootstrap-tools; see https://github.com/NixOS/nixpkgs/pull/15867#issuecomment-227949096 This reverts commitc05d829598
, reversing changes made tof073df60d6
.
64 lines
2.1 KiB
Nix
64 lines
2.1 KiB
Nix
# The Nix `gcc' stdenv.mkDerivation is not directly usable, since it doesn't
|
|
# know where the C library and standard header files are. Therefore
|
|
# the compiler produced by that package cannot be installed directly
|
|
# in a user environment and used from the command line. This
|
|
# stdenv.mkDerivation provides a wrapper that sets up the right environment
|
|
# variables so that the compiler and the linker just "work".
|
|
|
|
{ name ? "", stdenv, nativeTools, nativeLibc, noLibc ? false, nativePrefix ? ""
|
|
, gcc ? null, libc ? null, binutils ? null, shell ? "", cross
|
|
}:
|
|
|
|
assert nativeTools -> nativePrefix != "";
|
|
assert !nativeTools -> gcc != null && binutils != null;
|
|
assert !noLibc -> (!nativeLibc -> libc != null);
|
|
|
|
let
|
|
chosenName = if name == "" then gcc.name else name;
|
|
gccLibs = stdenv.mkDerivation {
|
|
name = chosenName + "-libs";
|
|
phases = [ "installPhase" ];
|
|
installPhase = ''
|
|
echo $out
|
|
mkdir -p "$out"
|
|
|
|
if [ -d "${gcc}/${cross.config}/lib" ]
|
|
then
|
|
cp -Rd "${gcc}/${cross.config}/lib" "$out/lib"
|
|
chmod -R +w "$out/lib"
|
|
for a in "$out/lib/"*.la; do
|
|
sed -i -e "s,${gcc}/${cross.config}/lib,$out/lib,g" $a
|
|
done
|
|
rm -f "$out/lib/"*.py
|
|
else
|
|
# The MinGW cross-compiler falls into this category.
|
|
mkdir "$out/lib"
|
|
fi
|
|
'';
|
|
};
|
|
in
|
|
stdenv.mkDerivation {
|
|
builder = ./builder.sh;
|
|
setupHook = ./setup-hook.sh;
|
|
gccWrapper = ./gcc-wrapper.sh;
|
|
ldWrapper = ./ld-wrapper.sh;
|
|
utils = ./utils.sh;
|
|
addFlags = ./add-flags;
|
|
inherit nativeTools nativeLibc nativePrefix gcc libc binutils;
|
|
crossConfig = if cross != null then cross.config else null;
|
|
osxMinVersion = cross.osxMinVersion or null;
|
|
gccLibs = if gcc != null then gccLibs else null;
|
|
name = chosenName;
|
|
langC = if nativeTools then true else gcc.langC;
|
|
langCC = if nativeTools then true else gcc.langCC;
|
|
langF77 = if nativeTools then false else gcc ? langFortran;
|
|
shell = if shell == "" then stdenv.shell else shell;
|
|
meta = if gcc != null then gcc.meta else
|
|
{ description = "System C compiler wrapper";
|
|
};
|
|
|
|
passthru = {
|
|
target = cross;
|
|
};
|
|
}
|