wesnoth: simplified wrapping (#521733)

This commit is contained in:
Niklas Korz
2026-05-19 18:28:13 +00:00
committed by GitHub
+14 -15
View File
@@ -1,7 +1,6 @@
{
lib,
stdenv,
stdenvNoCC,
fetchFromGitHub,
cmake,
pkg-config,
@@ -9,6 +8,7 @@
SDL2_image,
SDL2_mixer,
SDL2_net,
makeBinaryWrapper,
SDL2_ttf,
pango,
gettext,
@@ -55,7 +55,8 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
cmake
pkg-config
];
]
++ lib.optionals stdenv.hostPlatform.isDarwin [ makeBinaryWrapper ];
buildInputs = [
SDL2
@@ -78,7 +79,7 @@ stdenv.mkDerivation (finalAttrs: {
];
cmakeFlags = [
"-DENABLE_SYSTEM_LUA=ON"
(lib.cmakeBool "ENABLE_SYSTEM_LUA" true)
"-DBINARY_SUFFIX=${suffix}"
];
@@ -110,25 +111,24 @@ stdenv.mkDerivation (finalAttrs: {
echo "APPL????" > "$app_contents/PkgInfo"
mv $out/bin "$app_contents/MacOS"
mv $out/share/wesnoth "$app_contents/Resources"
pushd ../projectfiles/Xcode
substitute Info.plist "$app_contents/Info.plist" \
--replace-fail ''\'''${EXECUTABLE_NAME}' wesnoth${suffix} \
--replace-fail '$(PRODUCT_BUNDLE_IDENTIFIER)' org.wesnoth.Wesnoth${suffix} \
--replace-fail ''\'''${PRODUCT_NAME}' "$app_name"
cp -r Resources/SDLMain.nib "$app_contents/Resources/"
install -m0644 Resources/{container-migration.plist,icon.icns} "$app_contents/Resources"
substitute Info.plist "$app_contents/Info.plist" \
--replace-fail ''\'''${EXECUTABLE_NAME}' wesnoth${suffix} \
--replace-fail '$(PRODUCT_BUNDLE_IDENTIFIER)' org.wesnoth.Wesnoth${suffix} \
--replace-fail ''\'''${PRODUCT_NAME}' "$app_name"
cp -r Resources/SDLMain.nib "$app_contents/Resources/"
install -m0644 Resources/{container-migration.plist,icon.icns} "$app_contents/Resources"
popd
# Make the game and dedicated server binary available for shell users
mkdir -p "$out/bin"
ln -s "$app_contents/MacOS/wesnothd${suffix}" "$out/bin/wesnothd${suffix}"
# Symlinking the game binary is unsifficient as it would be unable to
# find the bundle resources
cat << EOF > "$out/bin/wesnoth${suffix}"
#!${stdenvNoCC.shell}
open -na "$app_bundle" --args "\$@"
EOF
chmod +x "$out/bin/wesnoth${suffix}"
makeBinaryWrapper "$app_bundle/Contents/MacOS/wesnoth${suffix}" "$out/bin/wesnoth${suffix}"
'';
passthru.updateScript = nix-update-script {
@@ -154,7 +154,6 @@ stdenv.mkDerivation (finalAttrs: {
reclaim the throne of Wesnoth, or take hand in any number of other
adventures.
'';
homepage = "https://www.wesnoth.org/";
changelog = "https://github.com/wesnoth/wesnoth/blob/${finalAttrs.version}/changelog.md";
license = lib.licenses.gpl2Plus;