summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
authorLudovic Courtès2010-05-19 21:28:34 +0000
committerLudovic Courtès2010-05-19 21:28:34 +0000
commit2534ea88b1a2a5203a3069201a89d680da392233 (patch)
tree7f3848dc47d7ed9752ff5aae9d728657b5b2dec0 /pkgs/os-specific
parent89b9d2af527cdb360385bb64db63e31ec54d6790 (diff)
GNU Hurd: Allow partial builds.
svn path=/nixpkgs/trunk/; revision=21899
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/gnu/hurd/default.nix35
1 files changed, 28 insertions, 7 deletions
diff --git a/pkgs/os-specific/gnu/hurd/default.nix b/pkgs/os-specific/gnu/hurd/default.nix
index 609955668e81..b53dd98d9e7d 100644
--- a/pkgs/os-specific/gnu/hurd/default.nix
+++ b/pkgs/os-specific/gnu/hurd/default.nix
@@ -1,14 +1,21 @@
 { fetchgit, stdenv, autoconf, automake, libtool, texinfo
-, machHeaders, mig, headersOnly ? true }:
+, machHeaders, mig, headersOnly ? true
+, cross ? null, gccCross ? null, glibcCross ? null
+, buildTarget ? "all", installTarget ? "install" }:
 
 assert (cross != null) -> (gccCross != null);
 
 let
-  date = "2010-05-12";
-  rev  = "master@{${date}}";
+  date   = "2010-05-12";
+  rev    = "master@{${date}}";
+  suffix = if headersOnly
+           then "-headers"
+           else (if buildTarget != "all"
+                 then "-minimal"
+                 else "");
 in
 stdenv.mkDerivation ({
-  name = "hurd${if headersOnly then "-headers" else ""}-${date}";
+  name = "hurd${suffix}-${date}";
 
   src = fetchgit {
     url = "git://git.sv.gnu.org/hurd/hurd.git";
@@ -16,13 +23,19 @@ stdenv.mkDerivation ({
     inherit rev;
   };
 
-  buildInputs = [ autoconf automake libtool texinfo mig ];
+  buildInputs = [ autoconf automake libtool texinfo mig ]
+    ++ stdenv.lib.optional (gccCross != null) gccCross
+    ++ stdenv.lib.optional (glibcCross != null) glibcCross;
+
   propagatedBuildInputs = [ machHeaders ];
 
-  configureFlags = "--build=i586-pc-gnu";
+  configureFlags = stdenv.lib.optionals headersOnly [ "--build=i586-pc-gnu" ];
 
   preConfigure = "autoreconf -vfi";
 
+  buildPhase = "make ${buildTarget}";
+  installPhase = "make ${installTarget}";
+
   meta = {
     description = "The GNU Hurd, GNU project's replacement for the Unix kernel";
 
@@ -46,4 +59,12 @@ stdenv.mkDerivation ({
 
 (if headersOnly
  then { buildPhase = ":"; installPhase = "make install-headers"; }
- else {}))
+ else (if (cross != null)
+       then {
+         crossConfig = cross.config;
+
+         # The `configure' script wants to build executables so tell it where
+         # to find `crt1.o' et al.
+         LDFLAGS = "-B${glibcCross}/lib";
+       }
+       else { })))