rott-shareware: include shareware data

This commit is contained in:
Marcin Serwin 2025-03-02 16:19:15 +01:00
parent fa72edbde7
commit c0f8e318d7
No known key found for this signature in database
GPG Key ID: DACFAC4EA0B194E0

View File

@ -2,22 +2,41 @@
stdenv,
lib,
fetchurl,
fetchzip,
SDL_compat,
SDL_mixer,
makeDesktopItem,
copyDesktopItems,
unzip,
buildShareware ? false,
withSharewareData ? buildShareware,
}:
assert withSharewareData -> buildShareware;
let
datadir = "share/data/rott-shareware/";
in
stdenv.mkDerivation (finalAttrs: {
pname = "rott";
version = "1.1.2";
src = fetchurl {
url = "https://icculus.org/rott/releases/${finalAttrs.pname}-${finalAttrs.version}.tar.gz";
hash = "sha256-ECUW6MMS9rC79sYj4fAcv7vDFKzorf4fIB1HsVvZJ/8=";
};
__structuredAttrs = true;
srcs =
[
(fetchurl {
url = "https://icculus.org/rott/releases/${finalAttrs.pname}-${finalAttrs.version}.tar.gz";
hash = "sha256-ECUW6MMS9rC79sYj4fAcv7vDFKzorf4fIB1HsVvZJ/8=";
})
]
++ lib.optional withSharewareData (fetchzip {
url = "http://icculus.org/rott/share/1rott13.zip";
hash = "sha256-l0pP+mNPAabGh7LZrwcB6KOhPRSycrZpAlPVTyDXc6Y=";
stripRoot = false;
});
nativeBuildInputs = [ copyDesktopItems ];
sourceRoot = "rott-${finalAttrs.version}/rott";
nativeBuildInputs = [ copyDesktopItems ] ++ lib.optional withSharewareData unzip;
buildInputs = [
SDL_compat
@ -26,15 +45,18 @@ stdenv.mkDerivation (finalAttrs: {
enableParallelBuilding = true;
sourceRoot = "rott-${finalAttrs.version}/rott";
makeFlags = [
"SHAREWARE=${if buildShareware then "1" else "0"}"
''EXTRACFLAGS=-DDATADIR=\"${if withSharewareData then "${placeholder "out"}/${datadir}" else ""}\"''
];
installPhase = ''
runHook preInstall
${lib.optionalString withSharewareData ''
mkdir -p "$out/${datadir}"
unzip -d "$out/${datadir}" ../../source/ROTTSW13.SHR
''}
install -Dm755 -t $out/bin rott
runHook postInstall
@ -53,7 +75,7 @@ stdenv.mkDerivation (finalAttrs: {
description = "SDL port of Rise of the Triad";
mainProgram = "rott";
homepage = "https://icculus.org/rott/";
license = lib.licenses.gpl2Plus;
license = with lib.licenses; [ gpl2Plus ] ++ lib.optional withSharewareData unfreeRedistributable;
maintainers = with lib.maintainers; [ sander ];
platforms = lib.platforms.all;
};