From 639d7409f2353b754c1d964acc88f9ffea6ab058 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 3 Mar 2016 13:46:21 +0100 Subject: [PATCH] Move testBootstrapTools to make-bootstrap-tools.nix --- pkgs/stdenv/linux/default.nix | 60 ++-------------------- pkgs/stdenv/linux/make-bootstrap-tools.nix | 59 ++++++++++++++++++--- 2 files changed, 57 insertions(+), 62 deletions(-) diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 965188a0cdd8..59a8636ceace 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -8,20 +8,17 @@ { system ? builtins.currentSystem , allPackages ? import ../../top-level/all-packages.nix , platform ? null, config ? {}, lib ? (import ../../../lib) -, customBootstrapFiles ? null }: - -rec { - - bootstrapFiles = - if customBootstrapFiles != null then customBootstrapFiles - else if system == "i686-linux" then import ./bootstrap/i686.nix +, bootstrapFiles ? + 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 else if system == "armv7l-linux" then import ./bootstrap/armv7l.nix else if system == "mips64el-linux" then import ./bootstrap/loongson2f.nix - else abort "unsupported platform for the pure Linux stdenv"; + else abort "unsupported platform for the pure Linux stdenv" +}: +rec { commonPreHook = '' @@ -310,51 +307,4 @@ rec { }; }; - - 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 - - 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 ' >> foo.c - echo '#include ' >> 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 ' >> 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 ef651f643684..974f5475341b 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) { - inherit system; + bootstrapFiles = { + busybox = "${build}/on-server/busybox"; + bootstrapTools = "${build}/on-server/bootstrap-tools.tar.xz"; + }; - customBootstrapFiles = { - busybox = "${build}/on-server/busybox"; - bootstrapTools = "${build}/on-server/bootstrap-tools.tar.xz"; - }; - }).testBootstrapTools; + 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\"" ]; + + 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 ' >> foo.c + echo '#include ' >> 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 ' >> 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 + ''; + }; }