about summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2022-04-06 00:02:41 +0000
committerGitHub <noreply@github.com>2022-04-06 00:02:41 +0000
commit3dc8bd98b93633fe1baa00fa6e05cbe7eca577d5 (patch)
treeff92a096aebd9a5092def057ec7e6b889fc623c0 /pkgs/games
parente2166cd22bf43d56483d27589b5d630be818fc3a (diff)
parente321dcea0de984e086311273c502fa466642d833 (diff)
Merge staging-next into staging
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/bugdom/default.nix66
1 files changed, 66 insertions, 0 deletions
diff --git a/pkgs/games/bugdom/default.nix b/pkgs/games/bugdom/default.nix
new file mode 100644
index 0000000000000..c5170c9845cca
--- /dev/null
+++ b/pkgs/games/bugdom/default.nix
@@ -0,0 +1,66 @@
+{ lib, stdenv, fetchFromGitHub, SDL2, IOKit, Foundation, cmake, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  pname = "bugdom";
+  version = "1.3.1";
+
+  src = fetchFromGitHub {
+    owner = "jorio";
+    repo = pname;
+    rev = version;
+    sha256 = "sha256:1371inw11rzfrxmc3v4gv5axp56bxjbcr0mhqm4x839401bfq5mf";
+    fetchSubmodules = true;
+  };
+
+  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") #'
+  '';
+
+  buildInputs = [
+    SDL2
+  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
+    IOKit
+    Foundation
+  ];
+
+  nativeBuildInputs = [
+    cmake
+    makeWrapper
+  ];
+
+  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
+
+  '' + (if stdenv.hostPlatform.isDarwin then ''
+    mkdir -p $out/{bin,Applications}
+    mv {,$out/Applications/}Bugdom.app
+    ln -s $out/{Applications/Bugdom.app/Contents/MacOS,bin}/Bugdom
+  '' 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"
+  '') + ''
+
+    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 ];
+    platforms = platforms.unix;
+  };
+}