Skip to content

Commit

Permalink
rott-shareware: include shareware data
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-serwin committed Mar 10, 2025
1 parent fa72edb commit c0f8e31
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions pkgs/by-name/ro/rott/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

sourceRoot = "rott-${finalAttrs.version}/rott";

nativeBuildInputs = [ copyDesktopItems ];
nativeBuildInputs = [ copyDesktopItems ] ++ lib.optional withSharewareData unzip;

buildInputs = [
SDL_compat
Expand All @@ -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
Expand All @@ -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;
};
Expand Down

0 comments on commit c0f8e31

Please sign in to comment.