mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-02 07:31:26 +00:00
0c631f6181
into a stdenv adapater. svn path=/nixpkgs/branches/stdenv-updates/; revision=18397
38 lines
1.4 KiB
Nix
38 lines
1.4 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, nativePrefix ? ""
|
|
, gcc ? null, libc ? null, binutils ? null, shell ? "", cross ? ""
|
|
}:
|
|
|
|
assert nativeTools -> nativePrefix != "";
|
|
assert !nativeTools -> gcc != null && binutils != null;
|
|
assert !nativeLibc -> libc != null;
|
|
|
|
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;
|
|
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 ? langFortran;
|
|
shell = if shell == "" then stdenv.shell else shell;
|
|
meta = if gcc != null then gcc.meta else
|
|
{ description = "System C compiler wrapper";
|
|
};
|
|
|
|
passthru = {
|
|
inherit cross;
|
|
};
|
|
}
|