GNU Hurd: Allow partial builds.

svn path=/nixpkgs/trunk/; revision=21899
This commit is contained in:
Ludovic Courtès 2010-05-19 21:28:34 +00:00
parent 89b9d2af52
commit 2534ea88b1
2 changed files with 46 additions and 7 deletions

View File

@ -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 { })))

View File

@ -6085,6 +6085,24 @@ let
inherit fetchurl stdenv ncurses;
};
hurdCrossIntermediate = forceBuildDrv(import ../os-specific/gnu/hurd {
inherit fetchgit stdenv autoconf libtool texinfo machHeaders
mig glibcCross;
automake = automake111x;
headersOnly = false;
cross = assert crossSystem != null; crossSystem;
# The "final" GCC needs glibc and the Hurd libraries (libpthread in
# particular) so we first need an intermediate Hurd built with the
# intermediate GCC.
gccCross = gccCrossStageStatic;
# This intermediate Hurd is only needed to build libpthread, which really
# only needs libihash.
buildTarget = "libihash";
installTarget = "libihash-install";
});
hurdHeaders = import ../os-specific/gnu/hurd {
inherit fetchgit stdenv autoconf libtool texinfo machHeaders;
mig = migCross;