about summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorAmbroz Bizjak <ambrop7@gmail.com>2015-02-03 22:25:56 +0100
committerAmbroz Bizjak <ambrop7@gmail.com>2015-02-05 21:29:02 +0100
commit93e018cbe919c835938c131933db1790ea057b68 (patch)
tree486838abe4276be81d9c52e7df575f8da3cc557e /pkgs/stdenv
parent810b416d895477de01c2a984da827a9c98590b35 (diff)
downloadnixlib-93e018cbe919c835938c131933db1790ea057b68.tar
nixlib-93e018cbe919c835938c131933db1790ea057b68.tar.gz
nixlib-93e018cbe919c835938c131933db1790ea057b68.tar.bz2
nixlib-93e018cbe919c835938c131933db1790ea057b68.tar.lz
nixlib-93e018cbe919c835938c131933db1790ea057b68.tar.xz
nixlib-93e018cbe919c835938c131933db1790ea057b68.tar.zst
nixlib-93e018cbe919c835938c131933db1790ea057b68.zip
Make the bootstrap-tools test use the real unpacking derivation.
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/linux/default.nix56
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools.nix94
2 files changed, 60 insertions, 90 deletions
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 6cf716586f0e..1876a8957e9a 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -7,12 +7,14 @@
 # The function defaults are for easy testing.
 { system ? builtins.currentSystem
 , allPackages ? import ../../top-level/all-packages.nix
-, platform ? null, config ? {}, lib ? (import ../../../lib) }:
+, platform ? null, config ? {}, lib ? (import ../../../lib)
+, customBootstrapFiles ? null }:
 
 rec {
 
   bootstrapFiles =
-    if system == "i686-linux" then import ./bootstrap/i686.nix
+    if customBootstrapFiles != null then customBootstrapFiles
+    else if system == "i686-linux" then import ./bootstrap/i686.nix
     else if system == "x86_64-linux" then import ./bootstrap/x86_64.nix
     else if system == "armv5tel-linux" then import ./bootstrap/armv5tel.nix
     else if system == "armv6l-linux" then import ./bootstrap/armv6l.nix
@@ -293,5 +295,53 @@ rec {
         attr acl paxctl zlib pcre;
     };
   };
-
+  
+  
+  testBootstrapTools = let
+    defaultPkgs = allPackages { inherit system platform; };
+  in derivation {
+    name = "test-bootstrap-tools";
+    inherit system;
+    builder = bootstrapFiles.busybox;
+    args = [ "ash" "-e" "-c" "eval \"$buildCommand\"" ];
+
+    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
+      curl --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 ${defaultPkgs.hello.src}
+      cd hello-*
+      ./configure --prefix=$out
+      make
+      make install
+    '';
+  };
 }
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix
index a836f6fdd378..3ad81476c2e9 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix
@@ -154,92 +154,12 @@ rec {
       allowedReferences = [];
     };
 
-
-  unpack =
-
-    derivation {
-      name = "unpack";
-      inherit system;
-      builder = "${build}/on-server/busybox";
-      args = [ "ash" "-e" "-c" "eval \"$buildCommand\"" ];
-
-      buildCommand = ''
-        export PATH=${build}/on-server:$out/bin
-
-        busybox mkdir $out
-        < ${build}/on-server/bootstrap-tools.tar.xz busybox unxz | busybox tar x -C $out
-
-        for i in $out/bin/* $out/libexec/gcc/*/*/*; do
-            if [ -L "$i" ]; then continue; fi
-            if [ -z "''${i##*/liblto*}" ]; then continue; fi
-            echo patching "$i"
-            LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.2 \
-                $out/bin/patchelf --set-interpreter $out/lib/ld-linux*.so.2 --set-rpath $out/lib --force-rpath "$i"
-        done
-
-        for i in $out/lib/libpcre*; do
-            if [ -L "$i" ]; then continue; fi
-            echo patching "$i"
-            $out/bin/patchelf --set-rpath $out/lib --force-rpath "$i"
-        done
-
-        # Fix the libc linker script.
-        for i in $out/lib/libc.so; do
-            cat $i | sed "s|/nix/store/e*-[^/]*/|$out/|g" > $i.tmp
-            mv $i.tmp $i
-        done
-      ''; # " */
-
-      allowedReferences = ["out"];
-    };
-
-
-  test =
-
-    derivation {
-      name = "test";
-      inherit system;
-      builder = "${build}/on-server/busybox";
-      args = [ "ash" "-e" "-c" "eval \"$buildCommand\"" ];
-
-      buildCommand = ''
-        export PATH=${unpack}/bin
-        ls -l
-        mkdir $out
-        mkdir $out/bin
-        sed --version
-        find --version
-        diff --version
-        patch --version
-        make --version
-        awk --version
-        grep --version
-        gcc --version
-        curl --version
-
-        ldlinux=$(echo ${unpack}/lib/ld-linux*.so.2)
-
-        export CPP="cpp -idirafter ${unpack}/include-glibc -B${unpack}"
-        export CC="gcc -idirafter ${unpack}/include-glibc -B${unpack} -Wl,-dynamic-linker,$ldlinux -Wl,-rpath,${unpack}/lib"
-        export CXX="g++ -idirafter ${unpack}/include-glibc -B${unpack} -Wl,-dynamic-linker,$ldlinux -Wl,-rpath,${unpack}/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
-      ''; # */
+  test = ((import ./default.nix) {
+    inherit system;
+    
+    customBootstrapFiles = {
+      busybox = "${build}/on-server/busybox";
+      bootstrapTools = "${build}/on-server/bootstrap-tools.tar.xz";
     };
-
+  }).testBootstrapTools;
 }