3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/games/bugdom/default.nix

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

70 lines
2.1 KiB
Nix
Raw Normal View History

2022-04-05 22:57:06 +01:00
{ lib, stdenv, fetchFromGitHub, SDL2, IOKit, Foundation, cmake, makeWrapper }:
stdenv.mkDerivation rec {
pname = "bugdom";
2023-01-29 07:03:23 +00:00
version = "1.3.3";
src = fetchFromGitHub {
owner = "jorio";
repo = pname;
rev = version;
2023-01-29 07:03:23 +00:00
hash = "sha256-oe7xxvoL82YF+EoIJDK6AfN3PmpqeGRlIsbaGx8xGeM=";
fetchSubmodules = true;
};
2022-04-05 22:57:06 +01:00
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
# Expects SDL2.framework in specific location, which we don't have
# Passing this in cmakeFlags doesn't work because the path is hard-coded for Darwin
substituteInPlace cmake/FindSDL2.cmake \
--replace 'set(SDL2_LIBRARIES' 'set(SDL2_LIBRARIES "${SDL2}/lib/libSDL2.dylib") #'
2023-01-29 07:03:23 +00:00
# Expects plutil, which we don't have
sed -i '/plutil/d' CMakeLists.txt
2022-04-05 22:57:06 +01:00
'';
buildInputs = [
SDL2
2022-04-05 22:57:06 +01:00
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
IOKit
Foundation
];
nativeBuildInputs = [
cmake
makeWrapper
];
2022-04-05 22:57:06 +01:00
cmakeFlags = lib.optionals stdenv.hostPlatform.isDarwin [
"-DCMAKE_OSX_ARCHITECTURES=${stdenv.hostPlatform.darwinArch}"
# Expects SDL2.framework in specific location, which we don't have
"-DSDL2_INCLUDE_DIRS=${SDL2.dev}/include/SDL2"
];
installPhase = ''
runHook preInstall
2022-04-05 22:57:06 +01:00
'' + (if stdenv.hostPlatform.isDarwin then ''
mkdir -p $out/{bin,Applications}
mv {,$out/Applications/}Bugdom.app
2023-01-29 07:03:23 +00:00
makeWrapper $out/{Applications/Bugdom.app/Contents/MacOS,bin}/Bugdom
2022-04-05 22:57:06 +01:00
'' else ''
mkdir -p $out/share/bugdom
mv Data $out/share/bugdom
install -Dm755 {.,$out/bin}/Bugdom
wrapProgram $out/bin/Bugdom --run "cd $out/share/bugdom"
install -Dm644 $src/packaging/bugdom.desktop $out/share/applications/bugdom.desktop
install -Dm644 $src/packaging/bugdom-desktopicon.png $out/share/pixmaps/bugdom-desktopicon.png
2022-04-05 22:57:06 +01:00
'') + ''
runHook postInstall
'';
meta = with lib; {
description = "A port of Bugdom, a 1999 Macintosh game by Pangea Software, for modern operating systems";
homepage = "https://github.com/jorio/Bugdom";
license = with licenses; [ cc-by-sa-40 ];
maintainers = with maintainers; [ lux ];
mainProgram = "Bugdom";
2022-04-05 22:57:06 +01:00
platforms = platforms.unix;
};
}