summary refs log tree commit diff
path: root/pkgs/build-support/gcc-wrapper/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/gcc-wrapper/default.nix')
-rw-r--r--pkgs/build-support/gcc-wrapper/default.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkgs/build-support/gcc-wrapper/default.nix b/pkgs/build-support/gcc-wrapper/default.nix
new file mode 100644
index 0000000000000..da1896611645e
--- /dev/null
+++ b/pkgs/build-support/gcc-wrapper/default.nix
@@ -0,0 +1,23 @@
+# The Nix `gcc' derivation 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
+# derivation provides a wrapper that sets up the right environment
+# variables so that the compiler and the linker just "work".
+
+{name, stdenv, isNative, gcc ? null, glibc ? null, binutils ? null}:
+
+assert isNative -> gcc != "";
+assert !isNative -> gcc != null && glibc != null && binutils != null;
+
+derivation {
+  system = stdenv.system;
+  builder = ./builder.sh;
+  setupHook = ./setup-hook.sh;
+  gccWrapper = ./gcc-wrapper.sh;
+  ldWrapper = ./ld-wrapper.sh;
+  inherit name stdenv isNative gcc glibc binutils;
+  langC = if isNative then true else gcc.langC;
+  langCC = if isNative then true else gcc.langCC;
+  langF77 = if isNative then false else gcc.langF77;
+}