openttd: modernize derivation

This commit is contained in:
Stefan Frijters 2025-06-02 01:01:00 +02:00
parent da907856cb
commit 2aa44cba7f
No known key found for this signature in database
GPG key ID: 7619A6BC6E7DFA6F

View file

@ -40,25 +40,25 @@
let let
opengfx = fetchzip { opengfx = fetchzip {
url = "https://cdn.openttd.org/opengfx-releases/7.1/opengfx-7.1-all.zip"; url = "https://cdn.openttd.org/opengfx-releases/7.1/opengfx-7.1-all.zip";
sha256 = "sha256-daJ/Qwg/okpmLQkXcCjruIiP8GEwyyp02YWcGQepxzs="; hash = "sha256-daJ/Qwg/okpmLQkXcCjruIiP8GEwyyp02YWcGQepxzs=";
}; };
opensfx = fetchzip { opensfx = fetchzip {
url = "https://cdn.openttd.org/opensfx-releases/1.0.3/opensfx-1.0.3-all.zip"; url = "https://cdn.openttd.org/opensfx-releases/1.0.3/opensfx-1.0.3-all.zip";
sha256 = "sha256-QmfXizrRTu/fUcVOY7tCndv4t4BVW+fb0yUi8LgSYzM="; hash = "sha256-QmfXizrRTu/fUcVOY7tCndv4t4BVW+fb0yUi8LgSYzM=";
}; };
openmsx = fetchzip { openmsx = fetchzip {
url = "https://cdn.openttd.org/openmsx-releases/0.4.2/openmsx-0.4.2-all.zip"; url = "https://cdn.openttd.org/openmsx-releases/0.4.2/openmsx-0.4.2-all.zip";
sha256 = "sha256-Cgrg2m+uTODFg39mKgX+hE8atV7v5bVyZd716vSZB8M="; hash = "sha256-Cgrg2m+uTODFg39mKgX+hE8atV7v5bVyZd716vSZB8M=";
}; };
in in
stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "openttd"; pname = "openttd";
version = "14.1"; version = "14.1";
src = fetchzip { src = fetchzip {
url = "https://cdn.openttd.org/openttd-releases/${version}/${pname}-${version}-source.tar.xz"; url = "https://cdn.openttd.org/openttd-releases/${finalAttrs.version}/openttd-${finalAttrs.version}-source.tar.xz";
hash = "sha256-YT4IE/rJ9pnpeMWKbOra6AbSUwW19RwOKlXkxwoMeKY="; hash = "sha256-YT4IE/rJ9pnpeMWKbOra6AbSUwW19RwOKlXkxwoMeKY=";
}; };
@ -77,6 +77,7 @@ stdenv.mkDerivation rec {
pkg-config pkg-config
makeWrapper makeWrapper
]; ];
buildInputs = buildInputs =
[ [
SDL2 SDL2
@ -107,6 +108,8 @@ stdenv.mkDerivation rec {
libjack2 libjack2
]; ];
strictDeps = true;
postPatch = '' postPatch = ''
substituteInPlace src/music/fluidsynth.cpp \ substituteInPlace src/music/fluidsynth.cpp \
--replace-fail "/usr/share/soundfonts/default.sf2" \ --replace-fail "/usr/share/soundfonts/default.sf2" \
@ -124,7 +127,7 @@ stdenv.mkDerivation rec {
tar -xf ${openmsx}/*.tar -C $out/share/games/openttd/baseset tar -xf ${openmsx}/*.tar -C $out/share/games/openttd/baseset
''; '';
meta = with lib; { meta = {
description = ''Open source clone of the Microprose game "Transport Tycoon Deluxe"''; description = ''Open source clone of the Microprose game "Transport Tycoon Deluxe"'';
mainProgram = "openttd"; mainProgram = "openttd";
longDescription = '' longDescription = ''
@ -138,12 +141,12 @@ stdenv.mkDerivation rec {
- observe as spectators - observe as spectators
''; '';
homepage = "https://www.openttd.org/"; homepage = "https://www.openttd.org/";
changelog = "https://cdn.openttd.org/openttd-releases/${version}/changelog.txt"; changelog = "https://cdn.openttd.org/openttd-releases/${finalAttrs.version}/changelog.txt";
license = licenses.gpl2Only; license = lib.licenses.gpl2Only;
platforms = platforms.linux; platforms = lib.platforms.linux;
maintainers = with maintainers; [ maintainers = with lib.maintainers; [
jcumming jcumming
fpletz fpletz
]; ];
}; };
} })