summary refs log tree commit diff
path: root/pkgs/os-specific/linux/klibc/1.5.nix
blob: 3a92c2f4d2974beae4e58c32013682a28b23f5ad (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
{stdenv, fetchurl, perl, bison, mktemp, kernelHeaders}:

assert stdenv.isLinux;

let version = "1.5"; in

stdenv.mkDerivation {
  name = "klibc-${version}";

  src = fetchurl {
    url = "mirror://kernel/linux/libs/klibc/klibc-${version}.tar.bz2";
    sha256 = "1izhf8kscjymsvsvhcqw9awnmp94vwv70zdj09srg9bkpjj0n017";
  };
  
  makeFlags = ["V=1" "prefix=$out" "SHLIBDIR=$out/lib"];
  
  preBuild = ''
    makeFlags=$(eval "echo $makeFlags")

    mkdir linux
    cp -prsd ${kernelHeaders}/include linux/
    chmod -R u+w linux/include/
  ''; # */
  
  # Install static binaries as well.
  postInstall = ''
    dir=$out/lib/klibc/bin.static
    mkdir $dir
    cp $(find $(find . -name static) -type f ! -name "*.g" -a ! -name ".*") $dir/
    cp usr/dash/sh $dir/
  '';
  
  buildInputs = [perl bison mktemp];
}