2005-11-29 01:40:33 +00:00
|
|
|
# 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".
|
|
|
|
|
2006-10-27 14:44:17 +01:00
|
|
|
{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
|
|
|
|
, gcc ? null, libc ? null, binutils ? null, shell ? "", cross ? ""
|
2005-11-29 01:40:33 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert nativeTools -> nativePrefix != "";
|
|
|
|
assert !nativeTools -> gcc != null && binutils != null;
|
2006-10-27 14:44:17 +01:00
|
|
|
assert !nativeLibc -> libc != null;
|
2005-11-29 01:40:33 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
builder = ./builder.sh;
|
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
gccWrapper = ./gcc-wrapper.sh;
|
|
|
|
ldWrapper = ./ld-wrapper.sh;
|
|
|
|
utils = ./utils.sh;
|
|
|
|
addFlags = ./add-flags;
|
2006-10-27 14:44:17 +01:00
|
|
|
inherit nativeTools nativeLibc nativePrefix gcc libc binutils cross;
|
2005-11-29 01:40:33 +00:00
|
|
|
name = if name == "" then gcc.name else name;
|
|
|
|
langC = if nativeTools then true else gcc.langC;
|
|
|
|
langCC = if nativeTools then true else gcc.langCC;
|
|
|
|
langF77 = if nativeTools then false else gcc.langF77;
|
|
|
|
shell = if shell == "" then stdenv.shell else shell;
|
2006-03-10 16:12:46 +00:00
|
|
|
meta = if gcc != null then gcc.meta else
|
|
|
|
{ description = "System C compiler wrapper";
|
|
|
|
};
|
2005-11-29 01:40:33 +00:00
|
|
|
}
|