about summary refs log tree commit diff
path: root/pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix
blob: 73fa887c51231434b1c6eb96864c1ae1184ef9dd (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
{ lib, mkDerivation
, buildPackages
, bsdSetupHook, freebsdSetupHook
, makeMinimal
, install
, mandoc, groff, rsync /*, nbperf*/, rpcgen
}:

mkDerivation {
  path = "include";

  extraPaths = [
    "contrib/libc-vis"
    "etc/mtree/BSD.include.dist"
    "sys"
  ];

  nativeBuildInputs =  [
    bsdSetupHook freebsdSetupHook
    makeMinimal
    install
    mandoc groff rsync /*nbperf*/ rpcgen

    # HACK use NetBSD's for now
    buildPackages.netbsd.mtree
  ];

  patches = [
    ./no-perms-BSD.include.dist.patch
  ];

  # The makefiles define INCSDIR per subdirectory, so we have to set
  # something else on the command line so those definitions aren't
  # overridden.
  postPatch = ''
    find "$BSDSRCDIR" -name Makefile -exec \
      sed -i -E \
        -e 's_/usr/include_''${INCSDIR0}_' \
        {} \;
  '';

  makeFlags = [
    "RPCGEN_CPP=${buildPackages.stdenv.cc.cc}/bin/cpp"
  ];

  # multiple header dirs, see above
  postConfigure = ''
    makeFlags=''${makeFlags/INCSDIR/INCSDIR0}
  '';

  headersOnly = true;

  MK_HESIOD = "yes";

  meta.platforms = lib.platforms.freebsd;
}