1 { lib, appleDerivation, makeWrapper }:
4 nativeBuildInputs = [ makeWrapper ];
7 substituteInPlace mk/bsd.prog.mk \
8 --replace '-o ''${BINOWN} -g ''${BINGRP}' "" \
9 --replace '-o ''${SCRIPTSOWN_''${.ALLSRC:T}}' "" \
10 --replace '-g ''${SCRIPTSGRP_''${.ALLSRC:T}}' ""
11 substituteInPlace mk/bsd.lib.mk --replace '-o ''${LIBOWN} -g ''${LIBGRP}' ""
12 substituteInPlace mk/bsd.info.mk --replace '-o ''${INFOOWN} -g ''${INFOGRP}' ""
13 substituteInPlace mk/bsd.doc.mk --replace '-o ''${BINOWN} -g ''${BINGRP}' ""
14 substituteInPlace mk/bsd.man.mk --replace '-o ''${MANOWN} -g ''${MANGRP}' ""
15 substituteInPlace mk/bsd.files.mk \
16 --replace '-o ''${''${group}OWN_''${.ALLSRC:T}}' "" \
17 --replace '-g ''${''${group}GRP_''${.ALLSRC:T}}' "" \
18 --replace '-o ''${''${group}OWN} -g ''${''${group}GRP}' ""
19 substituteInPlace mk/bsd.incs.mk \
20 --replace '-o ''${''${group}OWN_''${.ALLSRC:T}}' "" \
21 --replace '-g ''${''${group}GRP_''${.ALLSRC:T}}' "" \
22 --replace '-o ''${''${group}OWN} -g ''${''${group}GRP}' ""
24 # Workaround for https://github.com/NixOS/nixpkgs/issues/103172
25 # Prevents bsdmake from failing on systems that already had default limits
27 substituteInPlace main.c \
28 --replace 'err(2, "setrlimit");' 'warn("setrlimit");'
33 for file in $(find . -name '*.c'); do
34 obj="$(basename "$file" .c).o"
36 $CC -c "$file" -o "$obj" -DDEFSHELLNAME='"sh"' -D__FBSDID=__RCSID -mdynamic-no-pic -g
38 $CC "''${objs[@]}" -o bsdmake
42 install -d 0644 $out/bin
43 install -m 0755 bsdmake $out/bin
44 install -d 0644 $out/share/mk
45 install -m 0755 mk/* $out/share/mk
49 wrapProgram "$out/bin/bsdmake" --add-flags "-m $out/share/mk"
53 platforms = lib.platforms.darwin;