Files
nixpkgs/pkgs/by-name/un/unity-test/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

125 lines
2.8 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
fetchpatch2,
meson,
ninja,
ruby,
python3,
nix-update-script,
testers,
iniparser,
validatePkgConfig,
# Adds test groups and extra CLI flags.
buildFixture ? false,
# Adds the ablilty to track malloc and free calls.
# Note that if fixtures are enabled, this option is ignored
# and will always be enabled.
buildMemory ? buildFixture,
# Adds double precision floating point assertions
supportDouble ? false,
}:
let
# On newer versions of Clang, Weverything is too much of everything.
ignoredErrors = [
"-Wno-unsafe-buffer-usage"
"-Wno-reserved-identifier"
"-Wno-extra-semi-stmt"
];
in
stdenv.mkDerivation (finalAttrs: {
pname = "unity-test";
version = "2.6.1";
src = fetchFromGitHub {
owner = "ThrowTheSwitch";
repo = "Unity";
tag = "v${finalAttrs.version}";
hash = "sha256-g0ubq7RxGQmL1R6vz9RIGJpVWYsgrZhsTWSrL1ySEug=";
};
patches = [
# The meson file does not have the subdir set correctly
(fetchpatch2 {
url = "https://patch-diff.githubusercontent.com/raw/ThrowTheSwitch/Unity/pull/771.patch";
hash = "sha256-r8ldVb7WrzVwTC2CtGul9Jk4Rzt+6ejk+paYAfFlR5M=";
})
# Fix up the shebangs in the auto directory as not all are correct
(fetchpatch2 {
url = "https://patch-diff.githubusercontent.com/raw/ThrowTheSwitch/Unity/pull/790.patch";
hash = "sha256-K+OxMe/ZMXPPjZXjGhgc5ULLN7plBwL0hV5gwmgA3FM=";
})
];
postPatch = ''
patchShebangs --build auto
'';
outputs = [
"out"
"dev"
];
strictDeps = true;
nativeBuildInputs = [
meson
ninja
python3
validatePkgConfig
];
# For the helper shebangs
buildInputs = [
python3
ruby
];
mesonFlags = [
(lib.mesonBool "extension_memory" buildMemory)
(lib.mesonBool "extension_fixture" buildFixture)
(lib.mesonBool "support_double" supportDouble)
];
doCheck = true;
checkPhase = ''
runHook preCheck
make -C../test -j $NIX_BUILD_CORES ${lib.optionalString stdenv.cc.isClang "CC=clang"} E="-Weverything ${lib.escapeShellArgs ignoredErrors}" test
runHook postCheck
'';
# Various helpers
postInstall = ''
mkdir -p "$out/share"
install -Dm755 ../auto/* -t "$out/share/"
'';
passthru = {
updateScript = nix-update-script { };
tests = {
inherit iniparser;
pkg-config = testers.hasPkgConfigModules {
package = finalAttrs.finalPackage;
versionCheck = true;
};
};
};
meta = {
description = "Unity Unit Testing Framework";
homepage = "https://www.throwtheswitch.org/unity";
changelog = "https://github.com/ThrowTheSwitch/Unity/releases/tag/v${finalAttrs.version}";
license = lib.licenses.mit;
platforms = lib.platforms.all;
pkgConfigModules = [ "unity" ];
maintainers = with lib.maintainers; [
i01011001
RossSmyth
];
};
})