9 , pkgsMusl # for passthru.tests
12 stdenv.mkDerivation (finalAttrs: {
17 url = "http://www.crufty.net/ftp/pub/sjg/bmake-${finalAttrs.version}.tar.gz";
18 hash = "sha256-Hl5sdlQN/oEEQmzX/T9xXMZAT5A5ySA0RwErjy9re4Y=";
22 # make bootstrap script aware of the prefix in /nix/store
23 ./001-bootstrap-fix.diff
24 # decouple tests from build phase
25 ./002-dont-test-while-installing.diff
26 # preserve PATH from build env in unit tests
27 ./003-fix-unexport-env-test.diff
28 # Always enable ksh test since it checks in a impure location /bin/ksh
29 ./004-unconditional-ksh-test.diff
32 # Make tests work with musl
33 # * Disable deptgt-delete_on_error test (alpine does this too)
34 # * Disable shell-ksh test (ksh doesn't compile with musl)
35 # * Fix test failing due to different strerror(3) output for musl and glibc
36 postPatch = lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
37 sed -i unit-tests/Makefile \
38 -e '/deptgt-delete_on_error/d' \
40 substituteInPlace unit-tests/opt-chdir.exp --replace "File name" "Filename"
43 nativeBuildInputs = [ getopt ];
45 # The generated makefile is a small wrapper for calling ./boot-strap with a
46 # given op. On a case-insensitive filesystem this generated makefile clobbers
47 # a distinct, shipped, Makefile and causes infinite recursion during tests
48 # which eventually fail with "fork: Resource temporarily unavailable"
56 ./boot-strap --prefix=$out -o . op=build
64 ./boot-strap --prefix=$out -o . op=install
74 ] ++ lib.optionals (stdenv.hostPlatform.libc != "musl") [
79 # directive-export{,-gmake}: another failure related to TZ variables
80 # opt-chdir: ofborg complains about it somehow
81 # opt-keep-going-indirect: not yet known
82 # varmod-localtime: musl doesn't support TZDIR and this test relies on impure,
84 env.BROKEN_TESTS = builtins.concatStringsSep " " [
86 "directive-export-gmake"
87 "opt-chdir" # works on my machine -- AndersonTorres
88 "opt-keep-going-indirect"
95 ./boot-strap -o . op=test
102 setupHook = ./setup-hook.sh;
104 passthru.tests.bmakeMusl = pkgsMusl.bmake;
107 homepage = "http://www.crufty.net/help/sjg/bmake.html";
108 description = "Portable version of NetBSD 'make'";
109 license = lib.licenses.bsd3;
110 mainProgram = "bmake";
111 maintainers = with lib.maintainers; [ thoughtpolice AndersonTorres ];
112 platforms = lib.platforms.unix;
113 # ofborg: x86_64-linux builds the musl package, aarch64-linux doesn't
114 broken = stdenv.hostPlatform.isMusl && stdenv.buildPlatform.isAarch64;
117 # TODO: report the quirks and patches to bmake devteam (especially the Musl one)
118 # TODO: investigate Musl support