nixpkgs/pkgs/games/shipwright/default.nix
qubitnano dbf7e51850 shipwright: 7.1.1 -> 8.0.4, refactor
https://www.shipofharkinian.com/changelog

Updated shipwright to 8.0.4
Refactor - only generate soh.otr and allow users to select rom to generate oot.otr instead of adding to nix store when run
Migrate to finalAttrs,
Update gamecontrollerdb
Install desktop file and icon
soh working directory is under $HOME/.local/share/soh
mod support - mkdir $HOME/.local/share/soh/mods and place otr mods. Tested with a few graphic mods.
2024-01-21 15:35:20 -05:00

133 lines
2.9 KiB
Nix

{ stdenv
, cmake
, lsb-release
, ninja
, lib
, fetchFromGitHub
, fetchurl
, copyDesktopItems
, makeDesktopItem
, python3
, libX11
, libXrandr
, libXinerama
, libXcursor
, libXi
, libXext
, glew
, boost
, SDL2
, SDL2_net
, pkg-config
, libpulseaudio
, libpng
, imagemagick
, gnome
, makeWrapper
}:
stdenv.mkDerivation (finalAttrs: {
pname = "shipwright";
version = "8.0.4";
src = fetchFromGitHub {
owner = "harbourmasters";
repo = "shipwright";
rev = finalAttrs.version;
hash = "sha256-OoDToHCVNzccbKdsmek1kqCsW2HmVzA2vy3BtVW1DuM=";
fetchSubmodules = true;
};
# This would get fetched at build time otherwise, see:
# https://github.com/HarbourMasters/Shipwright/blob/e46c60a7a1396374e23f7a1f7122ddf9efcadff7/soh/CMakeLists.txt#L736
gamecontrollerdb = fetchurl {
name = "gamecontrollerdb.txt";
url = "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/81d89fd1e2bd5878e57dfa629abeed3a8feea438/gamecontrollerdb.txt";
hash = "sha256-m1XzDc2dS0hkBTEGABgW4J/jjIw1TXtvHHtsvui6Bcc=";
};
nativeBuildInputs = [
cmake
ninja
pkg-config
lsb-release
python3
imagemagick
copyDesktopItems
makeWrapper
];
buildInputs = [
boost
libX11
libXrandr
libXinerama
libXcursor
libXi
libXext
glew
SDL2
SDL2_net
libpulseaudio
libpng
gnome.zenity
];
cmakeFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/lib"
(lib.cmakeBool "NON_PORTABLE" true)
];
dontAddPrefix = true;
# Linking fails without this
hardeningDisable = [ "format" ];
postBuild = ''
cp ${finalAttrs.gamecontrollerdb} ${finalAttrs.gamecontrollerdb.name}
pushd ../OTRExporter
python3 ./extract_assets.py -z ../build/ZAPD/ZAPD.out --norom --xml-root ../soh/assets/xml --custom-assets-path ../soh/assets/custom --custom-otr-file soh.otr --port-ver ${finalAttrs.version}
popd
'';
preInstall = ''
# Cmake likes it here for its install paths
cp ../OTRExporter/soh.otr ..
'';
postInstall = ''
mkdir -p $out/bin
ln -s $out/lib/soh.elf $out/bin/soh
install -Dm644 ../soh/macosx/sohIcon.png $out/share/pixmaps/soh.png
'';
fixupPhase = ''
wrapProgram $out/lib/soh.elf --prefix PATH ":" ${lib.makeBinPath [ gnome.zenity ]}
'';
desktopItems = [
(makeDesktopItem {
name = "soh";
icon = "soh";
exec = "soh";
comment = finalAttrs.meta.description;
genericName = "Ship of Harkinian";
desktopName = "soh";
categories = [ "Game" ];
})
];
meta = {
homepage = "https://github.com/HarbourMasters/Shipwright";
description = "A PC port of Ocarina of Time with modern controls, widescreen, high-resolution, and more";
mainProgram = "soh";
platforms = [ "x86_64-linux" ];
maintainers = with lib.maintainers; [ ivar j0lol ];
license = with lib.licenses; [
# OTRExporter, OTRGui, ZAPDTR, libultraship
mit
# Ship of Harkinian itself
unfree
];
};
})