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 fetchFromGitHub, 5 makeDesktopItem, 6 copyDesktopItems, 7 SDL2, 8 SDL2_image, 9 }: 10 11 stdenv.mkDerivation (finalAttrs: { ··· 28 copyDesktopItems 29 ]; 30 31 - buildInputs = [ 32 - SDL2 33 - SDL2_image 34 ]; 35 36 - makeFlags = [ "DATADIR=$(out)/opt/brogue-ce" ]; 37 38 desktopItems = [ 39 (makeDesktopItem { ··· 57 install -Dm755 linux/brogue-multiuser.sh $out/bin/brogue-ce 58 install -Dm 644 bin/assets/icon.png $out/share/icons/hicolor/256x256/apps/brogue-ce.png 59 runHook postInstall 60 ''; 61 62 meta = with lib; {
··· 4 fetchFromGitHub, 5 makeDesktopItem, 6 copyDesktopItems, 7 + 8 + ncurses, 9 SDL2, 10 SDL2_image, 11 + 12 + terminal ? false, 13 + graphics ? true, 14 }: 15 16 stdenv.mkDerivation (finalAttrs: { ··· 33 copyDesktopItems 34 ]; 35 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"}" 50 ]; 51 52 + postBuild = lib.optionalString (stdenv.isDarwin && graphics) '' 53 + make Brogue.app $makeFlags 54 + ''; 55 56 desktopItems = [ 57 (makeDesktopItem { ··· 75 install -Dm755 linux/brogue-multiuser.sh $out/bin/brogue-ce 76 install -Dm 644 bin/assets/icon.png $out/share/icons/hicolor/256x256/apps/brogue-ce.png 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" 83 ''; 84 85 meta = with lib; {