From 4f209920e3af0e402de40f164c1e5a53e8a3d4e7 Mon Sep 17 00:00:00 2001 From: Lux Date: Tue, 28 Dec 2021 13:51:15 +0100 Subject: bugdom: init at 1.3.1 Co-authored-by: Christoph Neidahl --- pkgs/games/bugdom/default.nix | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 pkgs/games/bugdom/default.nix (limited to 'pkgs/games') diff --git a/pkgs/games/bugdom/default.nix b/pkgs/games/bugdom/default.nix new file mode 100644 index 0000000000000..57a1e41409023 --- /dev/null +++ b/pkgs/games/bugdom/default.nix @@ -0,0 +1,44 @@ +{ lib, stdenv, fetchFromGitHub, SDL2, cmake, makeWrapper }: + +stdenv.mkDerivation rec { + pname = "bugdom"; + version = "1.3.1"; + + src = fetchFromGitHub { + owner = "jorio"; + repo = pname; + rev = version; + sha256 = "sha256:1371inw11rzfrxmc3v4gv5axp56bxjbcr0mhqm4x839401bfq5mf"; + fetchSubmodules = true; + }; + + buildInputs = [ + SDL2 + ]; + + nativeBuildInputs = [ + cmake + makeWrapper + ]; + + installPhase = '' + runHook preInstall + + 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.linux; + }; +} -- cgit 1.4.1 From b75018a78939f48250e7286bcf93820e93cfa713 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Tue, 5 Apr 2022 23:57:06 +0200 Subject: bugdom: Enable on Darwin --- pkgs/games/bugdom/default.nix | 26 ++++++++++++++++++++++++-- pkgs/top-level/all-packages.nix | 4 +++- 2 files changed, 27 insertions(+), 3 deletions(-) (limited to 'pkgs/games') diff --git a/pkgs/games/bugdom/default.nix b/pkgs/games/bugdom/default.nix index 57a1e41409023..c5170c9845cca 100644 --- a/pkgs/games/bugdom/default.nix +++ b/pkgs/games/bugdom/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, SDL2, cmake, makeWrapper }: +{ lib, stdenv, fetchFromGitHub, SDL2, IOKit, Foundation, cmake, makeWrapper }: stdenv.mkDerivation rec { pname = "bugdom"; @@ -12,8 +12,18 @@ stdenv.mkDerivation rec { 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 = [ @@ -21,13 +31,25 @@ stdenv.mkDerivation rec { 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 ''; @@ -39,6 +61,6 @@ stdenv.mkDerivation rec { cc-by-sa-40 ]; maintainers = with maintainers; [ lux ]; - platforms = platforms.linux; + platforms = platforms.unix; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 21345ef8d88ae..9ea42e7ebd546 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -31003,7 +31003,9 @@ with pkgs; btanks = callPackage ../games/btanks { }; - bugdom = callPackage ../games/bugdom { }; + bugdom = callPackage ../games/bugdom { + inherit (darwin.apple_sdk.frameworks) IOKit Foundation; + }; bzflag = callPackage ../games/bzflag { inherit (darwin.apple_sdk.frameworks) Carbon CoreServices; -- cgit 1.4.1