nixpkgs/pkgs/by-name/ec/ecwolf/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

82 lines
2.4 KiB
Nix
Raw Normal View History

{ stdenv
, lib
, fetchFromBitbucket
, cmake
, pkg-config
2023-02-06 15:05:19 +00:00
, makeWrapper
, zlib
, bzip2
, libjpeg
, SDL2
, SDL2_net
, SDL2_mixer
, gtk3
, writers
, python3Packages
, nix-update
}:
2021-08-09 10:28:34 +01:00
2021-07-26 19:05:00 +01:00
stdenv.mkDerivation rec {
pname = "ecwolf";
version = "1.4.1";
2021-07-26 19:05:00 +01:00
src = fetchFromBitbucket {
owner = pname;
repo = pname;
rev = version;
sha256 = "V2pSP8i20zB50WtUMujzij+ISSupdQQ/oCYYrOaTU1g=";
2021-07-26 19:05:00 +01:00
};
nativeBuildInputs = [ cmake pkg-config ]
2023-02-06 15:05:19 +00:00
++ lib.optionals stdenv.hostPlatform.isDarwin [ makeWrapper ];
buildInputs = [ zlib bzip2 libjpeg SDL2 SDL2_net SDL2_mixer gtk3 ];
2021-07-26 19:05:00 +01:00
2023-02-06 15:05:19 +00:00
NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-framework AppKit";
2021-07-26 19:05:00 +01:00
# ECWolf installs its binary to the games/ directory, but Nix only adds bin/
# directories to the PATH.
2023-02-06 15:05:19 +00:00
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
mv "$out/games" "$out/bin"
2023-02-06 15:05:19 +00:00
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/{Applications,bin}
cp -R ecwolf.app $out/Applications
makeWrapper $out/{Applications/ecwolf.app/Contents/MacOS,bin}/ecwolf
'';
passthru.updateScript = let
updateScriptPkg = writers.writePython3 "ecwolf_update_script" {
libraries = with python3Packages; [ debian-inspector requests ];
} ''
from os import execl
from sys import argv
from debian_inspector.debcon import get_paragraphs_data
from requests import get
# The debian.drdteam.org repo is a primary source of information. Its
# run by Blzut3, the creator and primary developer of ECWolf. Its also
# listed on ECWolfs download page:
# <https://maniacsvault.net/ecwolf/download.php>.
url = 'https://debian.drdteam.org/dists/stable/multiverse/binary-amd64/Packages' # noqa: E501
response = get(url)
packages = get_paragraphs_data(response.text)
for package in packages:
if package['package'] == 'ecwolf':
latest_version = package['version']
break
nix_update_path = argv[1]
execl(nix_update_path, nix_update_path, '--version', latest_version)
'';
in [ updateScriptPkg (lib.getExe nix-update) ];
2021-07-26 19:05:00 +01:00
meta = with lib; {
description = "Enhanched SDL-based port of Wolfenstein 3D for various platforms";
mainProgram = "ecwolf";
2021-07-26 19:05:00 +01:00
homepage = "https://maniacsvault.net/ecwolf/";
license = licenses.gpl2Plus;
2023-01-31 21:17:56 +00:00
maintainers = with maintainers; [ jayman2000 sander ];
2021-07-26 19:05:00 +01:00
platforms = platforms.all;
};
}