|
21 | 21 |
|
22 | 22 | let |
23 | 23 | version = "469d"; |
24 | | - srcs = { |
| 24 | + srcs = rec { |
25 | 25 | x86_64-linux = fetchurl { |
26 | 26 | url = "https://github.com/OldUnreal/UnrealTournamentPatches/releases/download/v${version}/OldUnreal-UTPatch${version}-Linux-amd64.tar.bz2"; |
27 | 27 | hash = "sha256-aoGzWuakwN/OL4+xUq8WEpd2c1rrNN/DkffI2vDVGjs="; |
|
38 | 38 | url = "https://github.com/OldUnreal/UnrealTournamentPatches/releases/download/v${version}/OldUnreal-UTPatch${version}-macOS-Sonoma.dmg"; |
39 | 39 | hash = "sha256-TbhJbOH4E5WOb6XR9dmqLkXziK3/CzhNjd1ypBkkmvw="; |
40 | 40 | }; |
| 41 | + # fat binary |
| 42 | + aarch64-darwin = x86_64-darwin; |
41 | 43 | }; |
42 | 44 | unpackIso = |
43 | 45 | runCommand "ut1999-iso" |
|
56 | 58 | cp -r Music Sounds Textures Maps $out |
57 | 59 | ''; |
58 | 60 | systemDir = |
59 | | - { |
| 61 | + rec { |
60 | 62 | x86_64-linux = "System64"; |
61 | 63 | aarch64-linux = "SystemARM64"; |
62 | | - x86_64-darwin = "System"; |
63 | 64 | i686-linux = "System"; |
| 65 | + x86_64-darwin = "System"; |
| 66 | + aarch64-darwin = x86_64-darwin; |
64 | 67 | } |
65 | 68 | .${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}"); |
66 | 69 | in |
@@ -98,43 +101,49 @@ stdenv.mkDerivation { |
98 | 101 | in |
99 | 102 | '' |
100 | 103 | runHook preInstall |
101 | | -
|
| 104 | + mkdir -p $out |
| 105 | + '' |
| 106 | + + lib.optionalString (stdenv.hostPlatform.isLinux) '' |
102 | 107 | mkdir -p $out/bin |
| 108 | + '' |
| 109 | + + '' |
103 | 110 | cp -r ${if stdenv.hostPlatform.isDarwin then "UnrealTournament.app" else "./*"} $out |
104 | 111 | chmod -R 755 $out |
105 | 112 | cd ${outPrefix} |
106 | | -
|
107 | | - # NOTE: OldUnreal patch doesn't include these folders but could in the future |
108 | | - rm -rf ./{Music,Sounds,Maps} |
109 | | - ln -s ${unpackIso}/{Music,Sounds,Maps} . |
110 | | -
|
111 | | - # TODO: unpack compressed maps with ucc |
112 | | -
|
| 113 | + # NOTE: OldUnreal patch doesn't include these folders on linux but could in the future |
| 114 | + # on darwin it does, but they are empty |
| 115 | + rm -rf ./{Music,Sounds} |
| 116 | + ln -s ${unpackIso}/{Music,Sounds} . |
| 117 | + '' |
| 118 | + + lib.optionalString (stdenv.hostPlatform.isLinux) '' |
| 119 | + # maps need no post-processing on linux, therefore linking them is ok |
| 120 | + rm -rf ./Maps |
| 121 | + ln -s ${unpackIso}/Maps . |
| 122 | + '' |
| 123 | + + lib.optionalString (stdenv.hostPlatform.isDarwin) '' |
| 124 | + # Maps need post-processing on darwin, therefore need to be copied |
| 125 | + cp -n ${unpackIso}/Maps/* ./Maps || true |
| 126 | + # unpack compressed maps with ucc (needs absolute paths) |
| 127 | + for map in $PWD/Maps/*.uz; do ./UCC decompress $map; done |
| 128 | + mv ${systemDir}/*.unr ./Maps || true |
| 129 | + rm ./Maps/*.uz |
| 130 | + '' |
| 131 | + + '' |
113 | 132 | cp -n ${unpackIso}/Textures/* ./Textures || true |
114 | | - cp -n ${unpackIso}/System/*.{u,int} ./System || true |
115 | 133 | '' |
116 | 134 | + lib.optionalString (stdenv.hostPlatform.isLinux) '' |
| 135 | + cp -n ${unpackIso}/System/*.{u,int} ./System || true |
117 | 136 | ln -s "$out/${systemDir}/ut-bin" "$out/bin/ut1999" |
118 | 137 | ln -s "$out/${systemDir}/ucc-bin" "$out/bin/ut1999-ucc" |
119 | 138 |
|
120 | 139 | install -D "${./ut1999.svg}" "$out/share/pixmaps/ut1999.svg" |
121 | | - ${imagemagick}/bin/magick -background none ${./ut1999.svg} -resize 16x16 ut1999_16x16.png |
122 | | - ${imagemagick}/bin/magick -background none ${./ut1999.svg} -resize 24x24 ut1999_24x24.png |
123 | | - ${imagemagick}/bin/magick -background none ${./ut1999.svg} -resize 32x32 ut1999_32x32.png |
124 | | - ${imagemagick}/bin/magick -background none ${./ut1999.svg} -resize 48x48 ut1999_48x48.png |
125 | | - ${imagemagick}/bin/magick -background none ${./ut1999.svg} -resize 64x64 ut1999_64x64.png |
126 | | - ${imagemagick}/bin/magick -background none ${./ut1999.svg} -resize 128x128 ut1999_128x128.png |
127 | | - ${imagemagick}/bin/magick -background none ${./ut1999.svg} -resize 192x192 ut1999_192x192.png |
128 | | - ${imagemagick}/bin/magick -background none ${./ut1999.svg} -resize 256x256 ut1999_256x256.png |
129 | | - install -D "ut1999_16x16.png" "$out/share/icons/hicolor/16x16/apps/ut1999.png" |
130 | | - install -D "ut1999_24x24.png" "$out/share/icons/hicolor/24x24/apps/ut1999.png" |
131 | | - install -D "ut1999_32x32.png" "$out/share/icons/hicolor/32x32/apps/ut1999.png" |
132 | | - install -D "ut1999_48x48.png" "$out/share/icons/hicolor/48x48/apps/ut1999.png" |
133 | | - install -D "ut1999_64x64.png" "$out/share/icons/hicolor/64x64/apps/ut1999.png" |
134 | | - install -D "ut1999_128x128.png" "$out/share/icons/hicolor/128x128/apps/ut1999.png" |
135 | | - install -D "ut1999_192x192.png" "$out/share/icons/hicolor/192x192/apps/ut1999.png" |
136 | | - install -D "ut1999_256x256.png" "$out/share/icons/hicolor/256x256/apps/ut1999.png" |
| 140 | + for size in 16 24 32 48 64 128 192 256; do |
| 141 | + square=$(printf "%sx%s" $size $size) |
| 142 | + ${imagemagick}/bin/magick -background none ${./ut1999.svg} -resize $square ut1999_$square.png |
| 143 | + install -D "ut1999_$square.png" "$out/share/icons/hicolor/$square/apps/ut1999.png" |
| 144 | + done |
137 | 145 |
|
| 146 | + # TODO consider to remove shared libraries that can be provided by nixpkgs for darwin too |
138 | 147 | # Remove bundled libraries to use native versions instead |
139 | 148 | rm $out/${systemDir}/libmpg123.so* \ |
140 | 149 | $out/${systemDir}/libopenal.so* \ |
|
0 commit comments