tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
wesnoth: add darwin app bundle
Niklas Korz
9 months ago
a0891b0b
effa279e
+30
-1
1 changed file
expand all
collapse all
unified
split
pkgs
games
wesnoth
default.nix
+30
-1
pkgs/games/wesnoth/default.nix
···
1
{
2
lib,
3
stdenv,
0
4
fetchFromGitHub,
5
cmake,
6
pkg-config,
···
91
"-DENABLE_SYSTEM_LUA=ON"
92
];
93
94
-
NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-framework AppKit";
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
95
96
meta = with lib; {
97
description = "Battle for Wesnoth, a free, turn-based strategy game with a fantasy theme";
···
107
license = licenses.gpl2Plus;
108
maintainers = with maintainers; [ abbradar ];
109
platforms = platforms.unix;
0
110
};
111
}
···
1
{
2
lib,
3
stdenv,
4
+
stdenvNoCC,
5
fetchFromGitHub,
6
cmake,
7
pkg-config,
···
92
"-DENABLE_SYSTEM_LUA=ON"
93
];
94
95
+
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
96
+
app_name="The Battle for Wesnoth"
97
+
app_bundle="$out/Applications/$app_name.app"
98
+
app_contents="$app_bundle/Contents"
99
+
mkdir -p "$app_contents"
100
+
echo "APPL????" > "$app_contents/PkgInfo"
101
+
mv $out/bin "$app_contents/MacOS"
102
+
mv $out/share/wesnoth "$app_contents/Resources"
103
+
pushd ../projectfiles/Xcode
104
+
substitute Info.plist "$app_contents/Info.plist" \
105
+
--replace-fail ''\'''${EXECUTABLE_NAME}' wesnoth \
106
+
--replace-fail '$(PRODUCT_BUNDLE_IDENTIFIER)' org.wesnoth.Wesnoth \
107
+
--replace-fail ''\'''${PRODUCT_NAME}' "$app_name"
108
+
cp -r Resources/SDLMain.nib "$app_contents/Resources/"
109
+
install -m0644 Resources/{container-migration.plist,icon.icns} "$app_contents/Resources"
110
+
popd
111
+
112
+
# Make the game and dedicated server binary available for shell users
113
+
mkdir -p "$out/bin"
114
+
ln -s "$app_contents/MacOS/wesnothd" "$out/bin/wesnothd"
115
+
# Symlinking the game binary is unsifficient as it would be unable to
116
+
# find the bundle resources
117
+
cat << EOF > "$out/bin/wesnoth"
118
+
#!${stdenvNoCC.shell}
119
+
open -na "$app_bundle" --args "\$@"
120
+
EOF
121
+
chmod +x "$out/bin/wesnoth"
122
+
'';
123
124
meta = with lib; {
125
description = "Battle for Wesnoth, a free, turn-based strategy game with a fantasy theme";
···
135
license = licenses.gpl2Plus;
136
maintainers = with maintainers; [ abbradar ];
137
platforms = platforms.unix;
138
+
mainProgram = "wesnoth";
139
};
140
}