1# Packages that make up the GNU/Hurd operating system (aka. GNU).
2
3args@{ fetchgit, stdenv, autoconf, automake, automake111x, libtool
4, texinfo, glibcCross, hurdPartedCross, libuuid, samba
5, gccCrossStageStatic, gcc
6, forceSystem, newScope, platform, config
7, targetPlatform, buildPlatform
8, overrides ? {}
9, buildPackages, pkgs
10}:
11
12with args;
13
14let
15 callPackage = newScope gnu;
16
17 forcedNativePackages =
18 if stdenv.hostPlatform == stdenv.buildPlatform
19 then pkgs
20 else buildPackages;
21
22 gnu = {
23 hurdCross = forcedNativePackages.callPackage ./hurd {
24 inherit fetchgit stdenv autoconf libtool texinfo
25 glibcCross hurdPartedCross;
26 inherit (gnu) machHeaders mig;
27 libuuid = libuuid.crossDrv;
28 automake = automake111x;
29 headersOnly = false;
30 cross = assert targetPlatform != buildPlatform; targetPlatform;
31 gccCross = gcc;
32 };
33
34 hurdCrossIntermediate = forcedNativePackages.callPackage ./hurd {
35 inherit fetchgit stdenv autoconf libtool texinfo glibcCross;
36 inherit (gnu) machHeaders mig;
37 hurdPartedCross = null;
38 libuuid = null;
39 automake = automake111x;
40 headersOnly = false;
41 cross = assert targetPlatform != buildPlatform; targetPlatform;
42
43 # The "final" GCC needs glibc and the Hurd libraries (libpthread in
44 # particular) so we first need an intermediate Hurd built with the
45 # intermediate GCC.
46 gccCross = gccCrossStageStatic;
47
48 # This intermediate Hurd is only needed to build libpthread, which needs
49 # libihash, and to build Parted, which needs libstore and
50 # libshouldbeinlibc.
51 buildTarget = "libihash libstore libshouldbeinlibc";
52 installTarget = "libihash-install libstore-install libshouldbeinlibc-install";
53 };
54
55 hurdHeaders = callPackage ./hurd {
56 automake = automake111x;
57 headersOnly = true;
58 gccCross = null;
59 glibcCross = null;
60 libuuid = null;
61 hurdPartedCross = null;
62 };
63
64 libpthreadHeaders = callPackage ./libpthread {
65 headersOnly = true;
66 hurd = null;
67 };
68
69 libpthreadCross = forcedNativePackages.callPackage ./libpthread {
70 inherit fetchgit stdenv autoconf automake libtool glibcCross;
71 inherit (gnu) machHeaders hurdHeaders;
72 hurd = gnu.hurdCrossIntermediate;
73 gccCross = gccCrossStageStatic;
74 cross = assert targetPlatform != buildPlatform; targetPlatform;
75 };
76
77 # In theory GNU Mach doesn't have to be cross-compiled. However, since it
78 # has to be built for i586 (it doesn't work on x86_64), one needs a cross
79 # compiler for that host.
80 mach = callPackage ./mach {
81 automake = automake111x;
82 };
83
84 machHeaders = callPackage ./mach {
85 automake = automake111x;
86 headersOnly = true;
87 mig = null;
88 };
89
90 mig = callPackage ./mig {
91 # Build natively, but force use of a 32-bit environment because we're
92 # targeting `i586-pc-gnu'.
93 stdenv = (forceSystem "i686-linux" "i386").stdenv;
94 };
95
96 # XXX: Use this one for its `.crossDrv'. Using the one above from
97 # `x86_64-linux' leads to building a different cross-toolchain because of
98 # the `forceSystem'.
99 mig_raw = callPackage ./mig {};
100
101 smbfs = callPackage ./smbfs {
102 hurd = gnu.hurdCross;
103 };
104
105 unionfs = callPackage ./unionfs {
106 hurd = gnu.hurdCross;
107 };
108 }
109
110 # Allow callers to override elements of this attribute set.
111 // overrides;
112
113in gnu # we trust!