brogue-ce: add configuration options for terminal/graphics and macOS

Exposes configuration options 'terminal' and 'graphics', with defaults (false, true respectively) to match existing behaviour

Moves SDL2 deps behind the 'graphics' flag and adds ncurses dep behind 'terminal' flag.

The respective make flags are applied to build for terminal/graphics.

In addition, brogue-ce is bundled into a macOS application when on darwin and graphics are enabled.

authored by amusingimpala75 and committed by Francesco Gazzetta a6915dbe 8ac75907

+27 -4
+27 -4
pkgs/by-name/br/brogue-ce/package.nix
··· 4 4 fetchFromGitHub, 5 5 makeDesktopItem, 6 6 copyDesktopItems, 7 + 8 + ncurses, 7 9 SDL2, 8 10 SDL2_image, 11 + 12 + terminal ? false, 13 + graphics ? true, 9 14 }: 10 15 11 16 stdenv.mkDerivation (finalAttrs: { ··· 28 33 copyDesktopItems 29 34 ]; 30 35 31 - buildInputs = [ 32 - SDL2 33 - SDL2_image 36 + buildInputs = 37 + (lib.optionals graphics [ 38 + SDL2 39 + SDL2_image 40 + ]) 41 + ++ (lib.optionals terminal [ 42 + ncurses 43 + ]); 44 + 45 + makeFlags = [ 46 + "DATADIR=$(out)/opt/brogue-ce" 47 + "TERMINAL=${if terminal then "YES" else "NO"}" 48 + "GRAPHICS=${if graphics then "YES" else "NO"}" 49 + "MAC_APP=${if stdenv.isDarwin then "YES" else "NO"}" 34 50 ]; 35 51 36 - makeFlags = [ "DATADIR=$(out)/opt/brogue-ce" ]; 52 + postBuild = lib.optionalString (stdenv.isDarwin && graphics) '' 53 + make Brogue.app $makeFlags 54 + ''; 37 55 38 56 desktopItems = [ 39 57 (makeDesktopItem { ··· 57 75 install -Dm755 linux/brogue-multiuser.sh $out/bin/brogue-ce 58 76 install -Dm 644 bin/assets/icon.png $out/share/icons/hicolor/256x256/apps/brogue-ce.png 59 77 runHook postInstall 78 + ''; 79 + 80 + postInstall = lib.optionalString (stdenv.isDarwin && graphics) '' 81 + mkdir -p $out/Applications 82 + mv Brogue.app "$out/Applications/Brogue CE.app" 60 83 ''; 61 84 62 85 meta = with lib; {