openttd-grfcodec: unstable-2021-03-10 -> 6.2.0, embed & check version (#483479)

This commit is contained in:
Gergő Gutyina
2026-01-31 01:53:27 +00:00
committed by GitHub
+19 -5
View File
@@ -5,25 +5,39 @@
boost,
cmake,
git,
versionCheckHook,
}:
stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
pname = "openttd-grfcodec";
version = "unstable-2021-03-10";
version = "6.2.0";
src = fetchFromGitHub {
owner = "OpenTTD";
repo = "grfcodec";
rev = "045774dee7cab1a618a3e0d9b39bff78a12b6efa";
sha256 = "0b4xnnkqc01d3r834lhkq744ymar6c8iyxk51wc4c7hvz0vp9vmy";
tag = finalAttrs.version;
hash = "sha256-zIRHo2glD738Rmg4dhetIGtbIY/AgMKnzAJaP00lsqk=";
leaveDotGit = true;
postFetch = ''
# git arguments taken from generate_version.cmake
git_date=$(git -C $out show -s --pretty=%cd --date=short)
echo "${finalAttrs.version};$git_date" > $out/.version
rm -rf $out/.git
'';
};
buildInputs = [ boost ];
nativeBuildInputs = [
cmake
git
];
nativeInstallCheckInputs = [ versionCheckHook ];
doInstallCheck = true;
versionCheckProgram = "${placeholder "out"}/bin/grfcodec";
installPhase = ''
mkdir -p $out/bin
cp -a grfcodec grfid grfstrip nforenum $out/bin/
@@ -35,4 +49,4 @@ stdenv.mkDerivation {
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ ToxicFrog ];
};
}
})