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.
This commit is contained in:
committed by
Francesco Gazzetta
parent
8ac7590763
commit
a6915dbedb
@@ -4,8 +4,13 @@
|
||||
fetchFromGitHub,
|
||||
makeDesktopItem,
|
||||
copyDesktopItems,
|
||||
|
||||
ncurses,
|
||||
SDL2,
|
||||
SDL2_image,
|
||||
|
||||
terminal ? false,
|
||||
graphics ? true,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
@@ -28,12 +33,25 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
copyDesktopItems
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
SDL2
|
||||
SDL2_image
|
||||
buildInputs =
|
||||
(lib.optionals graphics [
|
||||
SDL2
|
||||
SDL2_image
|
||||
])
|
||||
++ (lib.optionals terminal [
|
||||
ncurses
|
||||
]);
|
||||
|
||||
makeFlags = [
|
||||
"DATADIR=$(out)/opt/brogue-ce"
|
||||
"TERMINAL=${if terminal then "YES" else "NO"}"
|
||||
"GRAPHICS=${if graphics then "YES" else "NO"}"
|
||||
"MAC_APP=${if stdenv.isDarwin then "YES" else "NO"}"
|
||||
];
|
||||
|
||||
makeFlags = [ "DATADIR=$(out)/opt/brogue-ce" ];
|
||||
postBuild = lib.optionalString (stdenv.isDarwin && graphics) ''
|
||||
make Brogue.app $makeFlags
|
||||
'';
|
||||
|
||||
desktopItems = [
|
||||
(makeDesktopItem {
|
||||
@@ -59,6 +77,11 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postInstall = lib.optionalString (stdenv.isDarwin && graphics) ''
|
||||
mkdir -p $out/Applications
|
||||
mv Brogue.app "$out/Applications/Brogue CE.app"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Community-lead fork of the minimalist roguelike game Brogue";
|
||||
mainProgram = "brogue-ce";
|
||||
|
||||
Reference in New Issue
Block a user