Unverified Commit 390349a5 authored by Gergő Gutyina's avatar Gergő Gutyina Committed by GitHub
Browse files

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

parents d7ba0dba e02b14bd
Loading
Loading
Loading
Loading
+19 −5
Original line number Diff line number Diff line
@@ -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 ];
  };
}
})