about summary refs log tree commit diff
path: root/pkgs/stdenv/linux/make-bootstrap-tools.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-03 13:46:21 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-03 13:57:45 +0100
commit639d7409f2353b754c1d964acc88f9ffea6ab058 (patch)
treec0114ac6acb00ba46744cefd832426d343e977f4 /pkgs/stdenv/linux/make-bootstrap-tools.nix
parente9b408936c7b4c56d7326fb364e7d2138060f0ec (diff)
Move testBootstrapTools to make-bootstrap-tools.nix
Diffstat (limited to 'pkgs/stdenv/linux/make-bootstrap-tools.nix')
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools.nix57
1 files changed, 51 insertions, 6 deletions
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix
index ef651f6436840..974f5475341b1 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix
@@ -156,12 +156,57 @@ rec {
     '';
   };
 
-  test = ((import ./default.nix) {
+  bootstrapFiles = {
+    busybox = "${build}/on-server/busybox";
+    bootstrapTools = "${build}/on-server/bootstrap-tools.tar.xz";
+  };
+
+  bootstrapTools = (import ./default.nix {
+    inherit system bootstrapFiles;
+  }).bootstrapTools;
+
+  test = derivation {
+    name = "test-bootstrap-tools";
     inherit system;
+    builder = bootstrapFiles.busybox;
+    args = [ "ash" "-e" "-c" "eval \"$buildCommand\"" ];
 
-    customBootstrapFiles = {
-      busybox = "${build}/on-server/busybox";
-      bootstrapTools = "${build}/on-server/bootstrap-tools.tar.xz";
-    };
-  }).testBootstrapTools;
+    buildCommand = ''
+      export PATH=${bootstrapTools}/bin
+
+      ls -l
+      mkdir $out
+      mkdir $out/bin
+      sed --version
+      find --version
+      diff --version
+      patch --version
+      make --version
+      awk --version
+      grep --version
+      gcc --version
+
+      ldlinux=$(echo ${bootstrapTools}/lib/ld-linux*.so.?)
+      export CPP="cpp -idirafter ${bootstrapTools}/include-glibc -B${bootstrapTools}"
+      export CC="gcc -idirafter ${bootstrapTools}/include-glibc -B${bootstrapTools} -Wl,-dynamic-linker,$ldlinux -Wl,-rpath,${bootstrapTools}/lib"
+      export CXX="g++ -idirafter ${bootstrapTools}/include-glibc -B${bootstrapTools} -Wl,-dynamic-linker,$ldlinux -Wl,-rpath,${bootstrapTools}/lib"
+
+      echo '#include <stdio.h>' >> foo.c
+      echo '#include <limits.h>' >> foo.c
+      echo 'int main() { printf("Hello World\\n"); return 0; }' >> foo.c
+      $CC -o $out/bin/foo foo.c
+      $out/bin/foo
+
+      echo '#include <iostream>' >> bar.cc
+      echo 'int main() { std::cout << "Hello World\\n"; }' >> bar.cc
+      $CXX -v -o $out/bin/bar bar.cc
+      $out/bin/bar
+
+      tar xvf ${hello.src}
+      cd hello-*
+      ./configure --prefix=$out
+      make
+      make install
+    '';
+  };
 }