2024-05-20 21:38:52 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, SDL2, IOKit, Foundation, OpenGL, cmake, makeWrapper }:
|
2021-12-28 12:51:15 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "bugdom";
|
2024-01-25 22:13:21 +00:00
|
|
|
version = "1.3.4";
|
2021-12-28 12:51:15 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jorio";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2024-01-25 22:13:21 +00:00
|
|
|
hash = "sha256-0c7v5tSqYuqtLOFl4sqD7+naJNqX/wlKHVntkZQGJ8A=";
|
2021-12-28 12:51:15 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
2022-04-05 21:57:06 +00: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 21:57:06 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-28 12:51:15 +00:00
|
|
|
buildInputs = [
|
|
|
|
SDL2
|
2022-04-05 21:57:06 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
IOKit
|
|
|
|
Foundation
|
2024-05-20 21:38:52 +00:00
|
|
|
OpenGL
|
2021-12-28 12:51:15 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
2022-04-05 21:57:06 +00: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"
|
|
|
|
];
|
|
|
|
|
2021-12-28 12:51:15 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2022-04-05 21:57:06 +00: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 21:57:06 +00:00
|
|
|
'' else ''
|
2021-12-28 12:51:15 +00:00
|
|
|
mkdir -p $out/share/bugdom
|
|
|
|
mv Data $out/share/bugdom
|
|
|
|
install -Dm755 {.,$out/bin}/Bugdom
|
|
|
|
wrapProgram $out/bin/Bugdom --run "cd $out/share/bugdom"
|
2024-01-25 22:13:21 +00:00
|
|
|
install -Dm644 $src/packaging/io.jor.bugdom.desktop $out/share/applications/io.jor.bugdom.desktop
|
|
|
|
install -Dm644 $src/packaging/io.jor.bugdom.png $out/share/pixmaps/io.jor.bugdom.png
|
2022-04-05 21:57:06 +00:00
|
|
|
'') + ''
|
2021-12-28 12:51:15 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Port of Bugdom, a 1999 Macintosh game by Pangea Software, for modern operating systems";
|
|
|
|
homepage = "https://github.com/jorio/Bugdom";
|
2022-05-05 00:46:39 +00:00
|
|
|
license = with licenses; [ cc-by-sa-40 ];
|
2021-12-28 12:51:15 +00:00
|
|
|
maintainers = with maintainers; [ lux ];
|
2022-05-05 00:46:39 +00:00
|
|
|
mainProgram = "Bugdom";
|
2022-04-05 21:57:06 +00:00
|
|
|
platforms = platforms.unix;
|
2021-12-28 12:51:15 +00:00
|
|
|
};
|
|
|
|
}
|