12 stdenv.mkDerivation (finalAttrs: {
17 url = "https://www.crufty.net/ftp/pub/sjg/bmake-${finalAttrs.version}.tar.gz";
18 hash = "sha256-z+2sCduQhqytVeejoNIkBo90tMARxbZK1x8dhoCHjOA=";
22 # decouple tests from build phase
23 ./002-dont-test-while-installing.diff
24 # preserve PATH from build env in unit tests
25 ./003-fix-unexport-env-test.diff
26 # Always enable ksh test since it checks in a impure location /bin/ksh
27 ./004-unconditional-ksh-test.diff
30 outputs = [ "out" "man" ];
32 nativeBuildInputs = [ getopt ];
37 ] ++ lib.optionals (stdenv.hostPlatform.libc != "musl") [
41 # The generated makefile is a small wrapper for calling ./boot-strap with a
42 # given op. On a case-insensitive filesystem this generated makefile clobbers
43 # a distinct, shipped Makefile and causes infinite recursion during tests
44 # which eventually fail with "fork: Resource temporarily unavailable"
50 # * directive-export{,-gmake}: another failure related to TZ variables
51 # * opt-keep-going-indirect: not yet known
52 # * varmod-localtime: musl doesn't support TZDIR and this test relies on
53 # impure, implicit paths
54 env.BROKEN_TESTS = builtins.concatStringsSep " " [
56 "directive-export-gmake"
57 "opt-keep-going-indirect"
65 # Make tests work with musl
66 # * Disable deptgt-delete_on_error test (alpine does this too)
67 # * Disable shell-ksh test (ksh doesn't compile with musl)
68 # * Fix test failing due to different strerror(3) output for musl and glibc
69 postPatch = lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
70 sed -i unit-tests/Makefile \
71 -e '/deptgt-delete_on_error/d' \
73 substituteInPlace unit-tests/opt-chdir.exp --replace "File name" "Filename"
79 ./boot-strap --prefix=$out -o . op=build
87 ./boot-strap --prefix=$out -o . op=install
95 ./boot-strap -o . op=test
100 setupHook = ./setup-hook.sh;
104 bmakeMusl = pkgsMusl.bmake;
109 homepage = "https://www.crufty.net/help/sjg/bmake.html";
110 description = "Portable version of NetBSD 'make'";
111 license = lib.licenses.bsd3;
112 mainProgram = "bmake";
113 maintainers = with lib.maintainers; [ thoughtpolice AndersonTorres ];
114 platforms = lib.platforms.unix;
116 badPlatforms = [ lib.systems.inspect.platformPatterns.isStatic ];
119 # TODO: report the quirks and patches to bmake devteam (especially the Musl one)
120 # TODO: investigate static support