12 stdenv.mkDerivation (finalAttrs: {
17 url = "https://www.crufty.net/ftp/pub/sjg/bmake-${finalAttrs.version}.tar.gz";
18 hash = "sha256-tZGJJRtIPezUSS8fdDh7KlhMA9WqRjfNSLOOxiucCEg=";
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" ];
39 ] ++ lib.optionals (stdenv.hostPlatform.libc != "musl") [
43 # The generated makefile is a small wrapper for calling ./boot-strap with a
44 # given op. On a case-insensitive filesystem this generated makefile clobbers
45 # a distinct, shipped Makefile and causes infinite recursion during tests
46 # which eventually fail with "fork: Resource temporarily unavailable"
52 # * directive-export{,-gmake}: another failure related to TZ variables
53 # * opt-keep-going-indirect: not yet known
54 # * varmod-localtime: musl doesn't support TZDIR and this test relies on
55 # impure, implicit paths
56 env.BROKEN_TESTS = builtins.concatStringsSep " " [
58 "directive-export-gmake"
59 "opt-keep-going-indirect"
67 # Make tests work with musl
68 # * Disable deptgt-delete_on_error test (alpine does this too)
69 # * Disable shell-ksh test (ksh doesn't compile with musl)
70 # * Fix test failing due to different strerror(3) output for musl and glibc
71 postPatch = lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
72 sed -i unit-tests/Makefile \
73 -e '/deptgt-delete_on_error/d' \
75 substituteInPlace unit-tests/opt-chdir.exp --replace "File name" "Filename"
81 ./boot-strap --prefix=$out -o . op=build
89 ./boot-strap --prefix=$out -o . op=install
97 ./boot-strap -o . op=test
102 setupHook = ./setup-hook.sh;
106 bmakeMusl = pkgsMusl.bmake;
111 homepage = "https://www.crufty.net/help/sjg/bmake.html";
112 description = "Portable version of NetBSD 'make'";
113 license = lib.licenses.bsd3;
114 mainProgram = "bmake";
115 maintainers = with lib.maintainers; [ thoughtpolice AndersonTorres ];
116 platforms = lib.platforms.unix;
118 badPlatforms = [ lib.systems.inspect.platformPatterns.isStatic ];
121 # TODO: report the quirks and patches to bmake devteam (especially the Musl one)
122 # TODO: investigate static support