From 1f047397ab4775f81f619613f62898ff6b46a64c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 26 Mar 2024 22:56:32 +0200 Subject: ut1999: add support for i686-linux --- pkgs/by-name/ut/ut1999/package.nix | 40 +++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/pkgs/by-name/ut/ut1999/package.nix b/pkgs/by-name/ut/ut1999/package.nix index 92cb223d54675..0d98b412e867c 100644 --- a/pkgs/by-name/ut/ut1999/package.nix +++ b/pkgs/by-name/ut/ut1999/package.nix @@ -2,6 +2,17 @@ , runCommand, libgcc, wxGTK32, innoextract, libGL, SDL2, openal, libmpg123, libxmp }: let + version = "469d"; + srcs = { + x86_64-linux = fetchurl { + url = "https://github.com/OldUnreal/UnrealTournamentPatches/releases/download/v${version}/OldUnreal-UTPatch${version}-Linux-amd64.tar.bz2"; + hash = "sha256-aoGzWuakwN/OL4+xUq8WEpd2c1rrNN/DkffI2vDVGjs="; + }; + i686-linux = fetchurl { + url = "https://github.com/OldUnreal/UnrealTournamentPatches/releases/download/v${version}/OldUnreal-UTPatch${version}-Linux-x86.tar.bz2"; + hash = "sha256-1JsFKuAAj/LtYvOUPFu0Hn+zvY3riW0YlJbLd4UnaKU="; + }; + }; unpackGog = runCommand "ut1999-gog" { src = requireFile rec { name = "setup_ut_goty_2.0.0.5.exe"; @@ -21,14 +32,15 @@ let mkdir $out cp -r app/* $out ''; -in stdenv.mkDerivation rec { + systemDir = { + x86_64-linux = "System64"; + i686-linux = "System"; + }.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}"); +in stdenv.mkDerivation { name = "ut1999"; - version = "469d"; + inherit version; sourceRoot = "."; - src = fetchurl { - url = "https://github.com/OldUnreal/UnrealTournamentPatches/releases/download/v${version}/OldUnreal-UTPatch${version}-Linux-amd64.tar.bz2"; - hash = "sha256-aoGzWuakwN/OL4+xUq8WEpd2c1rrNN/DkffI2vDVGjs="; - }; + src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); buildInputs = [ libgcc @@ -54,10 +66,10 @@ in stdenv.mkDerivation rec { cp -r ./* $out # Remove bundled libraries to use native versions instead - rm $out/System64/libmpg123.so* \ - $out/System64/libopenal.so* \ - $out/System64/libSDL2* \ - $out/System64/libxmp.so* + rm $out/${systemDir}/libmpg123.so* \ + $out/${systemDir}/libopenal.so* \ + $out/${systemDir}/libSDL2* \ + $out/${systemDir}/libxmp.so* chmod -R 755 $out @@ -67,8 +79,8 @@ in stdenv.mkDerivation rec { ln -s ${unpackGog}/Maps $out cp -n ${unpackGog}/System/*.{u,int} $out/System || true - ln -s "$out/System64/ut-bin" "$out/bin/ut1999" - ln -s "$out/System64/ucc-bin" "$out/bin/ut1999-ucc" + ln -s "$out/${systemDir}/ut-bin" "$out/bin/ut1999" + ln -s "$out/${systemDir}/ucc-bin" "$out/bin/ut1999-ucc" convert "${unpackGog}/gfw_high.ico" "ut1999.png" install -D ut1999-5.png "$out/share/icons/hicolor/256x256/apps/ut1999.png" @@ -90,9 +102,9 @@ in stdenv.mkDerivation rec { meta = with lib; { description = "Unreal Tournament GOTY (1999) with the OldUnreal patch."; license = licenses.unfree; - platforms = [ "x86_64-linux" ]; + platforms = attrNames srcs; maintainers = with maintainers; [ eliandoran ]; - sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; mainProgram = "ut1999"; }; } -- cgit 1.4.1 From 15e0d5515e1c0288ff07a26c0912344237054c9e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 28 Mar 2024 22:46:07 +0200 Subject: innoextract: Enable on darwin --- pkgs/tools/archivers/innoextract/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/archivers/innoextract/default.nix b/pkgs/tools/archivers/innoextract/default.nix index 7c66dcb84d00d..470cde6eb426f 100644 --- a/pkgs/tools/archivers/innoextract/default.nix +++ b/pkgs/tools/archivers/innoextract/default.nix @@ -31,7 +31,7 @@ stdenv.mkDerivation rec { homepage = "https://constexpr.org/innoextract/"; license = licenses.zlib; maintainers = with maintainers; [ abbradar ]; - platforms = platforms.linux; + platforms = platforms.unix; mainProgram = "innoextract"; }; } -- cgit 1.4.1 From e0ff218af8c7e5ca258073f23c1cc2fd89eb823e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 28 Mar 2024 22:46:37 +0200 Subject: ut1999: Enable darwin support --- pkgs/by-name/ut/ut1999/package.nix | 41 +++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/pkgs/by-name/ut/ut1999/package.nix b/pkgs/by-name/ut/ut1999/package.nix index 0d98b412e867c..dcb9058ac0028 100644 --- a/pkgs/by-name/ut/ut1999/package.nix +++ b/pkgs/by-name/ut/ut1999/package.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, requireFile, autoPatchelfHook, fetchurl, makeDesktopItem, copyDesktopItems, imagemagick +{ lib, stdenv, requireFile, autoPatchelfHook, undmg, fetchurl, makeDesktopItem, copyDesktopItems, imagemagick , runCommand, libgcc, wxGTK32, innoextract, libGL, SDL2, openal, libmpg123, libxmp }: let @@ -12,6 +12,10 @@ let url = "https://github.com/OldUnreal/UnrealTournamentPatches/releases/download/v${version}/OldUnreal-UTPatch${version}-Linux-x86.tar.bz2"; hash = "sha256-1JsFKuAAj/LtYvOUPFu0Hn+zvY3riW0YlJbLd4UnaKU="; }; + x86_64-darwin = fetchurl { + url = "https://github.com/OldUnreal/UnrealTournamentPatches/releases/download/v${version}/OldUnreal-UTPatch${version}-macOS-Sonoma.dmg"; + hash = "sha256-TbhJbOH4E5WOb6XR9dmqLkXziK3/CzhNjd1ypBkkmvw="; + }; }; unpackGog = runCommand "ut1999-gog" { src = requireFile rec { @@ -35,6 +39,7 @@ let systemDir = { x86_64-linux = "System64"; i686-linux = "System"; + x86_64-darwin = "System"; }.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}"); in stdenv.mkDerivation { name = "ut1999"; @@ -53,38 +58,42 @@ in stdenv.mkDerivation { stdenv.cc.cc ]; - nativeBuildInputs = [ + nativeBuildInputs = lib.optionals stdenv.isLinux [ copyDesktopItems autoPatchelfHook imagemagick + ] ++ lib.optionals stdenv.isDarwin [ + undmg ]; - installPhase = '' + installPhase = let + outPrefix = if stdenv.isDarwin then "$out/UnrealTournament.app/Contents/MacOS" else "$out"; + in '' runHook preInstall mkdir -p $out/bin - cp -r ./* $out - - # Remove bundled libraries to use native versions instead - rm $out/${systemDir}/libmpg123.so* \ - $out/${systemDir}/libopenal.so* \ - $out/${systemDir}/libSDL2* \ - $out/${systemDir}/libxmp.so* - + cp -r ${if stdenv.isDarwin then "UnrealTournament.app" else "./*"} $out chmod -R 755 $out + cd ${outPrefix} - ln -s ${unpackGog}/Music $out - ln -s ${unpackGog}/Sounds $out - cp -n ${unpackGog}/Textures/* $out/Textures || true - ln -s ${unpackGog}/Maps $out - cp -n ${unpackGog}/System/*.{u,int} $out/System || true + rm -rf ./{Music,Sounds,Maps} + ln -s ${unpackGog}/{Music,Sounds,Maps} . + cp -n ${unpackGog}/Textures/* ./Textures || true + cp -n ${unpackGog}/System/*.{u,int} ./System || true + '' + lib.optionalString (stdenv.isLinux) '' ln -s "$out/${systemDir}/ut-bin" "$out/bin/ut1999" ln -s "$out/${systemDir}/ucc-bin" "$out/bin/ut1999-ucc" convert "${unpackGog}/gfw_high.ico" "ut1999.png" install -D ut1999-5.png "$out/share/icons/hicolor/256x256/apps/ut1999.png" + # Remove bundled libraries to use native versions instead + rm $out/${systemDir}/libmpg123.so* \ + $out/${systemDir}/libopenal.so* \ + $out/${systemDir}/libSDL2* \ + $out/${systemDir}/libxmp.so* + '' + '' runHook postInstall ''; -- cgit 1.4.1 From 9c9dc1f366eecb285100d4b87dec4faa02c43a4a Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 30 Mar 2024 19:19:19 +0200 Subject: ut1999: add aarch64_linux support --- pkgs/by-name/ut/ut1999/package.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/ut/ut1999/package.nix b/pkgs/by-name/ut/ut1999/package.nix index dcb9058ac0028..acc719a42cfd6 100644 --- a/pkgs/by-name/ut/ut1999/package.nix +++ b/pkgs/by-name/ut/ut1999/package.nix @@ -8,6 +8,10 @@ let url = "https://github.com/OldUnreal/UnrealTournamentPatches/releases/download/v${version}/OldUnreal-UTPatch${version}-Linux-amd64.tar.bz2"; hash = "sha256-aoGzWuakwN/OL4+xUq8WEpd2c1rrNN/DkffI2vDVGjs="; }; + aarch64-linux = fetchurl { + url = "https://github.com/OldUnreal/UnrealTournamentPatches/releases/download/v${version}/OldUnreal-UTPatch${version}-Linux-arm64.tar.bz2"; + hash = "sha256-2e9lHB12jLTR8UYofLWL7gg0qb2IqFk6eND3T5VqAx0="; + }; i686-linux = fetchurl { url = "https://github.com/OldUnreal/UnrealTournamentPatches/releases/download/v${version}/OldUnreal-UTPatch${version}-Linux-x86.tar.bz2"; hash = "sha256-1JsFKuAAj/LtYvOUPFu0Hn+zvY3riW0YlJbLd4UnaKU="; @@ -30,7 +34,7 @@ let ''; }; - buildInputs = [ innoextract ]; + nativeBuildInputs = [ innoextract ]; } '' innoextract --extract --exclude-temp "$src" mkdir $out @@ -38,8 +42,9 @@ let ''; systemDir = { x86_64-linux = "System64"; - i686-linux = "System"; + aarch64-linux = "SystemARM64"; x86_64-darwin = "System"; + i686-linux = "System"; }.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}"); in stdenv.mkDerivation { name = "ut1999"; @@ -97,6 +102,11 @@ in stdenv.mkDerivation { runHook postInstall ''; + # .so files in the SystemARM64 directory are not loaded properly on aarch64-linux + appendRunpaths = lib.optionals (stdenv.hostPlatform.system == "aarch64-linux") [ + "${placeholder "out"}/${systemDir}" + ]; + desktopItems = [ (makeDesktopItem { name = "ut1999"; -- cgit 1.4.1