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