summary refs log tree commit diff
path: root/pkgs/stdenv/nix-linux-static/default.nix
blob: f8121fb54023106ad36f457e1925a8c162d111c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
rec {

  curl = derivation {
    name = "curl";
    builder = ./bash-static/bash;
    tar = ./gnutar-static/bin/tar;
    gunzip = ./gzip-static/bin/gunzip;
    curl = ./curl-static/curl-7.12.2-static.tar.gz;
    cp = ./tools/cp;
    system = "i686-linux";
    args = [ ./scripts/curl-unpack ];
  };

  download =
  { url, pkgname, postProcess ? [], addToPath ? []
  , extra ? null, extra2 ? null
  , extra3 ? null, extra4? null, patchelf ? null}:
  derivation {
    name = pkgname;
    builder = ./bash-static/bash;
    tar = ./gnutar-static/bin/tar;
    gunzip = ./gzip-static/bin/gunzip;
    inherit curl url;
    cp = ./tools/cp;
    system = "i686-linux";
    args = [ ./scripts/download-script ];
    inherit postProcess addToPath extra extra2 extra3 extra4 patchelf;
  };

  coreutils = download {
    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/coreutils-5.0-static.tar.gz;
    pkgname = "coreutils";
  };

  patchelf = ./patchelf-static/bin/patchelf;

  bzip2 = download {
    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/bzip2-1.0.2-static.tar.gz;
    pkgname = "bzip2";
  };

  gnumake = download {
    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/make-3.80-static.tar.gz;
    pkgname = "gnumake";
  };

  binutils = download {
    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/binutils-2.15-static.tar.gz;
    pkgname = "binutils";
  };

  diffutils = download {
    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/diffutils-2.8.1-static.tar.gz;
    pkgname = "diffutils";
  };

  gnused = download {
    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/sed-4.0.7-static.tar.gz;
    pkgname = "gnused";
  };

  gnugrep = download {
    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/grep-2.5.1-static.tar.gz;
    pkgname = "gnugrep";
  };

  gcc = (download {url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/gcc-3.4.2-static.tar.gz;
    pkgname = "gcc";
    postProcess = [./scripts/fix-outpath.sh];
    addToPath = [coreutils findutils gnused];
  }) // { langC = true; langCC = false; langF77 = false; };

  gawk = download {
    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/gawk-3.1.3-static.tar.gz;
    pkgname = "gawk";
  };

  patch = download {
    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/patch-2.5.4-static.tar.gz;
    pkgname = "patch";
  };

  findutils = download {
    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/findutils-4.1.20-static.tar.gz;
    pkgname = "findutils";
  };

  linuxHeaders = download {
    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/linux-headers-2.4.25-i386.tar.gz;
    pkgname = "linux-headers";
  };

  glibc = download {
    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/glibc-2.3.3-static-2.tar.gz;
    pkgname = "glibc";
    patchelf = ./patchelf-static/bin/patchelf;
    postProcess = [./scripts/add-symlink.sh /* ./scripts/fix-outpath.sh */];
    addToPath = [coreutils findutils gnused];
    extra = linuxHeaders;
  };

  
  stdenvInitial = let {

    body = derivation {
      name = "stdenv-linux-static-initial";
      system = "i686-linux";
      builder = ./bash-static/bash;
      args = ./scripts/builder-stdenv-initial.sh;
      inherit coreutils gnused;
    }  // {
      mkDerivation = attrs: derivation (attrs // {
        builder = ./bash-static/bash;
        args = ["-e" attrs.builder];
        stdenv = body;
        system = body.system;
      });

      shell = ./bash-static/bash;
    };
  };


  stdenvBootFun = {glibc, gcc, binutils, staticGlibc}: (import ../generic) {
    name = "stdenv-linux-static-boot";
    param1 = if staticGlibc then "static" else "dynamic";
    preHook = ./prehook.sh;
    stdenv = stdenvInitial;
    shell = ./bash-static/bash;
    gcc = (import ../../build-support/gcc-wrapper) {
      stdenv = stdenvInitial;
      nativeTools = false;
      nativeGlibc = false;
      inherit gcc glibc binutils;
    };
    initialPath = [
      coreutils
      ./gnutar-static
      ./gzip-static
      bzip2
      gnused
      gnugrep
      gawk
      gnumake
      findutils
      diffutils
      patch
      ./patchelf-static
    ];
  };
}