2004-03-29 19:23:01 +02:00
|
|
|
# The Nix `gcc' stdenv.mkDerivation is not directly usable, since it doesn't
|
2004-03-08 17:02:46 +01:00
|
|
|
# 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
|
2004-03-29 19:23:01 +02:00
|
|
|
# stdenv.mkDerivation provides a wrapper that sets up the right environment
|
2004-03-08 17:02:46 +01:00
|
|
|
# variables so that the compiler and the linker just "work".
|
|
|
|
|
2004-07-05 14:00:19 +02:00
|
|
|
{ name ? "", stdenv, nativeTools, nativeGlibc, nativePrefix ? ""
|
2004-03-30 14:46:52 +02:00
|
|
|
, gcc ? null, glibc ? null, binutils ? null, shell ? ""
|
2004-03-11 18:26:14 +01:00
|
|
|
}:
|
2004-03-08 17:02:46 +01:00
|
|
|
|
2004-03-11 18:26:14 +01:00
|
|
|
assert nativeTools -> nativePrefix != "";
|
|
|
|
assert !nativeTools -> gcc != null && binutils != null;
|
|
|
|
assert !nativeGlibc -> glibc != null;
|
2004-03-08 17:02:46 +01:00
|
|
|
|
2004-03-29 19:23:01 +02:00
|
|
|
stdenv.mkDerivation {
|
2004-03-08 17:02:46 +01:00
|
|
|
builder = ./builder.sh;
|
2005-02-22 15:32:56 +01:00
|
|
|
substitute = ../substitute/substitute.sh;
|
2004-03-08 17:02:46 +01:00
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
gccWrapper = ./gcc-wrapper.sh;
|
|
|
|
ldWrapper = ./ld-wrapper.sh;
|
2004-03-12 12:12:18 +01:00
|
|
|
utils = ./utils.sh;
|
2005-02-22 15:32:56 +01:00
|
|
|
addFlags = ./add-flags;
|
2004-07-05 14:00:19 +02:00
|
|
|
inherit nativeTools nativeGlibc nativePrefix gcc glibc binutils;
|
|
|
|
name = if name == "" then gcc.name else name;
|
2004-03-11 18:26:14 +01:00
|
|
|
langC = if nativeTools then true else gcc.langC;
|
|
|
|
langCC = if nativeTools then true else gcc.langCC;
|
|
|
|
langF77 = if nativeTools then false else gcc.langF77;
|
2004-03-30 14:46:52 +02:00
|
|
|
shell = if shell == "" then stdenv.shell else shell;
|
2006-03-24 15:20:31 +01:00
|
|
|
meta = if gcc != null && (gcc ? meta) then gcc.meta else
|
2006-03-10 17:12:46 +01:00
|
|
|
{ description = "System C compiler wrapper";
|
|
|
|
};
|
2006-03-24 15:20:31 +01:00
|
|
|
}
|