ut-1999: fix build in darwin build sandbox (#446726)

This commit is contained in:
Philip Taron
2025-10-07 13:24:18 +00:00
committed by GitHub

View File

@@ -1,7 +1,6 @@
{ {
lib, lib,
stdenv, stdenv,
requireFile,
autoPatchelfHook, autoPatchelfHook,
undmg, undmg,
fetchurl, fetchurl,
@@ -18,6 +17,8 @@
openal, openal,
libmpg123, libmpg123,
libxmp, libxmp,
libiconv,
darwin,
}: }:
let let
@@ -84,6 +85,9 @@ stdenv.mkDerivation (finalAttrs: {
libmpg123 libmpg123
libxmp libxmp
stdenv.cc.cc stdenv.cc.cc
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
libiconv
]; ];
nativeBuildInputs = nativeBuildInputs =
@@ -94,6 +98,7 @@ stdenv.mkDerivation (finalAttrs: {
++ lib.optionals stdenv.hostPlatform.isDarwin [ ++ lib.optionals stdenv.hostPlatform.isDarwin [
makeWrapper makeWrapper
undmg undmg
darwin.autoSignDarwinBinariesHook
]; ];
installPhase = installPhase =
@@ -116,6 +121,15 @@ stdenv.mkDerivation (finalAttrs: {
cp -r "UnrealTournament.app" $out/Applications/ cp -r "UnrealTournament.app" $out/Applications/
makeWrapper $out/Applications/UnrealTournament.app/Contents/MacOS/UnrealTournament \ makeWrapper $out/Applications/UnrealTournament.app/Contents/MacOS/UnrealTournament \
$out/bin/${finalAttrs.meta.mainProgram} $out/bin/${finalAttrs.meta.mainProgram}
# If the darwin build sandbox is enabled, system libiconv is not available
# https://github.com/OldUnreal/UnrealTournamentPatches/issues/1902
# Even though ut1999 is able to unpack the map files at runtime, upstream advised to still do it at install time
# which is why the UCC binary is fixed to access a copy of iconv from the nix store
install_name_tool -change /usr/lib/libiconv.2.dylib \
${libiconv}/lib/libiconv.2.dylib \
$out/Applications/UnrealTournament.app/Contents/MacOS/UCC
# Needs manual re-signing, as UCC is used during the build, and the auto signer is part of the fixup phase
signDarwinBinariesInAllOutputs
'' ''
+ '' + ''
chmod -R 755 $out chmod -R 755 $out