From 1f047397ab4775f81f619613f62898ff6b46a64c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 26 Mar 2024 22:56:32 +0200 Subject: [PATCH] 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 92cb223d5467..0d98b412e867 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"; }; }