about summary refs log tree commit diff
path: root/pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix
blob: 0fc6ca452be0d7dc78b4531675221919146e40aa (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
{
  mkDerivation,
  writeShellScript,
  mtree,
  make,
  bsdSetupHook,
  netbsdSetupHook,
  makeMinimal,
  mandoc,
  groff,
  rsync,
  compatIfNeeded,
  fts,

}:

# HACK: to ensure parent directories exist. This emulates GNU
# install’s -D option. No alternative seems to exist in BSD install.
let
  binstall = writeShellScript "binstall" (
    builtins.readFile ../../../lib/install-wrapper.sh
    + ''
      @out@/bin/xinstall "''${args[@]}"
    ''
  );
in
mkDerivation {
  path = "usr.bin/xinstall";
  version = "9.2";
  sha256 = "1f6pbz3qv1qcrchdxif8p5lbmnwl8b9nq615hsd3cyl4avd5bfqj";
  extraPaths = [
    mtree.src
    make.src
  ];
  nativeBuildInputs = [
    bsdSetupHook
    netbsdSetupHook
    makeMinimal
    mandoc
    groff
    rsync
  ];
  skipIncludesPhase = true;
  buildInputs =
    compatIfNeeded
    # fts header is needed. glibc already has this header, but musl doesn't,
    # so make sure pkgsMusl.netbsd.install still builds in case you want to
    # remove it!
    ++ [ fts ];
  installPhase = ''
    runHook preInstall

    install -D install.1 $out/share/man/man1/install.1
    install -D xinstall $out/bin/xinstall
    install -D -m 0550 ${binstall} $out/bin/binstall
    substituteInPlace $out/bin/binstall --subst-var out
    ln -s $out/bin/binstall $out/bin/install

    runHook postInstall
  '';
  setupHook = ./install-setup-hook.sh;
}