bmake: cosmetic rewrite

- remove `with lib;`
- put BROKEN_TESTS under env
- reorder phases in execution order (because it's nice!)
This commit is contained in:
Anderson Torres
2023-07-26 21:50:56 -03:00
parent a149d8852a
commit aef415998b
@@ -13,23 +13,10 @@ stdenv.mkDerivation (finalAttrs: {
version = "20230414";
src = fetchurl {
url = "http://www.crufty.net/ftp/pub/sjg/${finalAttrs.pname}-${finalAttrs.version}.tar.gz";
url = "http://www.crufty.net/ftp/pub/sjg/bmake-${finalAttrs.version}.tar.gz";
hash = "sha256-KcsdJqrn3p3vkr2us6rUUg6JlRzpey518LibrhuVOZ8=";
};
# Make tests work with musl
# * Disable deptgt-delete_on_error test (alpine does this too)
# * Disable shell-ksh test (ksh doesn't compile with musl)
# * Fix test failing due to different strerror(3) output for musl and glibc
postPatch = lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
sed -i unit-tests/Makefile \
-e '/deptgt-delete_on_error/d' \
-e '/shell-ksh/d'
substituteInPlace unit-tests/opt-chdir.exp --replace "File name" "Filename"
'';
nativeBuildInputs = [ getopt ];
patches = [
# make bootstrap script aware of the prefix in /nix/store
./bootstrap-fix.patch
@@ -51,6 +38,19 @@ stdenv.mkDerivation (finalAttrs: {
})
];
# Make tests work with musl
# * Disable deptgt-delete_on_error test (alpine does this too)
# * Disable shell-ksh test (ksh doesn't compile with musl)
# * Fix test failing due to different strerror(3) output for musl and glibc
postPatch = lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
sed -i unit-tests/Makefile \
-e '/deptgt-delete_on_error/d' \
-e '/shell-ksh/d'
substituteInPlace unit-tests/opt-chdir.exp --replace "File name" "Filename"
'';
nativeBuildInputs = [ getopt ];
# The generated makefile is a small wrapper for calling ./boot-strap with a
# given op. On a case-insensitive filesystem this generated makefile clobbers
# a distinct, shipped, Makefile and causes infinite recursion during tests
@@ -59,17 +59,6 @@ stdenv.mkDerivation (finalAttrs: {
"--without-makefile"
];
# Disabled tests:
# opt-chdir: ofborg complains about it somehow
# opt-keep-going-indirect: not yet known
# varmod-localtime: musl doesn't support TZDIR and this test relies on impure,
# implicit paths
BROKEN_TESTS = builtins.concatStringsSep " " [
"opt-chdir"
"opt-keep-going-indirect"
"varmod-localtime"
];
buildPhase = ''
runHook preBuild
@@ -94,6 +83,17 @@ stdenv.mkDerivation (finalAttrs: {
ksh
];
# Disabled tests:
# opt-chdir: ofborg complains about it somehow
# opt-keep-going-indirect: not yet known
# varmod-localtime: musl doesn't support TZDIR and this test relies on impure,
# implicit paths
env.BROKEN_TESTS = builtins.concatStringsSep " " [
"opt-chdir"
"opt-keep-going-indirect"
"varmod-localtime"
];
checkPhase = ''
runHook preCheck
@@ -104,14 +104,14 @@ stdenv.mkDerivation (finalAttrs: {
setupHook = ./setup-hook.sh;
meta = with lib; {
passthru.tests.bmakeMusl = pkgsMusl.bmake;
meta = {
homepage = "http://www.crufty.net/help/sjg/bmake.html";
description = "Portable version of NetBSD 'make'";
license = licenses.bsd3;
maintainers = with maintainers; [ thoughtpolice AndersonTorres ];
platforms = platforms.unix;
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ thoughtpolice AndersonTorres ];
platforms = lib.platforms.unix;
};
passthru.tests.bmakeMusl = pkgsMusl.bmake;
})
# TODO: report the quirks and patches to bmake devteam (especially the Musl one)