1 # Contributor: quantax -- contact via Arch Linux forum or AUR
6 pkgdesc="The classic Unreal Tournament form 1999. Retail CD or DVD required."
8 url="http://www.unrealtournament2004.com/utgoty/"
11 makedepends=(makepkg-lib-unreal unshield)
12 replaces=(ut ut-server)
13 source=(ut436.run::'http://www.liflg.org/?what=dl&catid=6&gameid=51&filename=unreal.tournament_436-multilanguage.run' \
14 ut436goty.run::'http://www.liflg.org/?what=dl&catid=6&gameid=51&filename=unreal.tournament_436-multilanguage.goty.run' \
15 http://www.utpg.org/patches/UTPGPatch451.tar.bz2 \
19 md5sums=('726aede817997a2aefccb8c20601d760' \
20 '7012dc6caaa9453dcf8951474556912a' \
21 '77a735a78b1eb819042338859900b83b' \
22 '0c94a4c1fda89a53a905756d4c15c5a9' \
23 '7fbe728f7cef23d53bdfe6be17b7129a' \
24 '72efce99d512b1a71587c2c127dccd06')
25 noextract=(UTPGPatch451.tar.bz2)
27 # You can uncomment and set these two variables in order to override the auto
28 # detection done in build() by _detect_cdpath() and _detect_cdversion().
29 #_cdpath="" # path to your mounted UT CD or DVD
30 #_cdversion="" # "default" or "anthology"
32 # Detect the mount point of the install medium.
34 echo "Searching for mount point of install medium... "
36 for mountpoint in $(/bin/egrep "(iso9660|udf)" /etc/mtab \
37 | /bin/awk '{print $2}'); do
38 if [ -f "${mountpoint}/SYSTEM/UnrealTournament.exe" ] \
39 || [ -f "${mountpoint}/Disk1/data1.hdr" ]; then
40 _cdpath="${mountpoint}"
45 if [ -z "${_cdpath}" ]; then
46 /bin/cat << __EOF__ >&2
47 No mounted valid Unreal Tournament CD or Unreal Anthology
48 DVD has been detected while scanning all "iso9660"
49 and all "udf" filesystems in "/etc/mtab" for the file
50 "SYSTEM/UnrealTournament.exe" or the file "Disk1/data1.hdr".
51 Make sure you mounted the right disk correctly. If it still
52 doesn't work you can try setting the "_cdpath" and/or the
53 "_cdversion" variable in this PKGBUILD to your mount point and
54 your version of UT manually.
58 echo " ${_cdpath} looks promising."
62 # Determine which method should be used for extracting the files from the
65 echo "Determining install method... "
67 if [ -f "${_cdpath}/SYSTEM/UnrealTournament.exe" ]; then
69 elif [ -f "${_cdpath}/Disk1/data1.hdr" ]; then
70 _cdversion="anthology"
72 echo "Could not determine _cdversion." >&2
75 echo " Using \"${_cdversion}\" method."
78 # Install files from most UT99 CDs.
80 echo "Extracting files from ${_cdpath}..."
83 _unreal_install_files "${_cdpath}" "${pkgdir}/opt/ut" "*./System400/.*" \
84 < disk.list || return 1
86 _install_patches || return 1
88 echo "Decompressing maps from ${_cdpath}..."
89 /bin/grep "Maps/" disk.list | /bin/sed -e "s/$/\.uz/" \
90 | _unreal_decompress_files "${_cdpath}" "${pkgdir}/opt/ut" \
92 /bin/grep "Maps/" disk.list \
93 | _unreal_move_files "${pkgdir}/opt/ut/System" "${pkgdir}/opt/ut" \
95 /bin/rm -f -- "${pkgdir}/opt/ut/System/ucc.log"
98 # Install files from the Unreal Anthology DVD.
100 echo "Extracting files from ${_cdpath}..."
103 /bin/ln -fs -- ${_cdpath}/Disk*/data* -t . || return 1
104 /usr/bin/unshield x -g 3_UnrealTournament_Help -d dvd data1.hdr || return 1
105 /usr/bin/unshield x -g 3_UnrealTournament_Maps -d dvd data1.hdr || return 1
106 /usr/bin/unshield x -g 3_UnrealTournament_Music -d dvd data1.hdr || return 1
107 /usr/bin/unshield x -g 3_UnrealTournament_Sounds_All -d dvd data1.hdr \
109 /usr/bin/unshield x -g 3_UnrealTournament_Sounds_English -d dvd data1.hdr \
111 /usr/bin/unshield x -g 3_UnrealTournament_System_All -d dvd data1.hdr \
113 /usr/bin/unshield x -g 3_UnrealTournament_System_English -d dvd data1.hdr \
115 /usr/bin/unshield x -g 3_UnrealTournament_Textures -d dvd data1.hdr \
118 _unreal_move_files dvd "${pkgdir}/opt/ut" < disk.list || return 1
119 _install_patches || return 1
122 # Add files for running UT on Linux, apply the patches shipped by Loki and add
123 # some third party fixes.
125 echo "Adding Loki's Linux runtime files..."
128 /bin/sh ./ut436.run --tar xfC 436 || return 1
129 /bin/sh ./ut436goty.run --tar xfC 436goty || return 1
132 /bin/install --mode=644 -D -- ut.xpm "${pkgdir}/usr/share/pixmaps/ut.xpm"
133 /bin/install --mode=644 -- README "${pkgdir}/opt/ut/Help/README"
134 /bin/install --mode=644 -- README.Loki "${pkgdir}/opt/ut/Help/README.Loki"
135 /bin/install --mode=755 -- bin/Linux/x86/ucc "${pkgdir}/opt/ut/ucc"
136 /bin/install --mode=755 -- bin/ut "${pkgdir}/opt/ut/ut"
137 /bin/ln -fs -- /opt/ut/ut "${pkgdir}/usr/bin/ut"
139 /bin/tar xfC data.tar.gz "${pkgdir}/opt/ut" \
140 --exclude=System/UnrealTournament.ini.PATCH || return 1
141 /bin/chmod 644 -- "${pkgdir}/opt/ut/System/OpenGLDrv.int"
142 /bin/install --mode=644 -D -- "${pkgdir}/opt/ut/System/License.int" \
143 "${pkgdir}/usr/share/licenses/${pkgname}/License.int"
145 /bin/tar xfC UT436-OpenGLDrv-Linux-090602.tar.gz "${pkgdir}/opt/ut" || return 1
146 /bin/tar xfC OpenGL.ini.tar.gz "${pkgdir}/opt/ut" || return 1
147 /bin/tar xfC Credits.tar.gz "${pkgdir}/opt/ut" || return 1
148 /bin/tar xfC NetGamesUSA.com.tar.gz "${pkgdir}/opt/ut" || return 1
150 # As there is no distinction between GOTY and non-GOTY CDs yet, we just try
151 # to patch everything that applies. Also Loki's patcher is too unreliable.
153 echo "Trying to apply Loki's 436 Xdelta patches..."
154 _unreal_fail_safe_patcher 436/setup.data/data "${pkgdir}/opt/ut"
155 _unreal_fail_safe_patcher 436goty/setup.data/data "${pkgdir}/opt/ut"
156 # ./436/setup.data/bin/Linux/x86/loki_patch \
157 # ./436/setup.data/patch.dat "${pkgdir}/opt/ut"
158 # ./436goty/setup.data/bin/Linux/x86/loki_patch \
159 # ./436goty/setup.data/patch.dat "${pkgdir}/opt/ut"
161 echo "Applying 451 UTPG patch..."
162 /bin/tar xfC UTPGPatch451.tar.bz2 451utpg || return 1
163 _unreal_move_files 451utpg "${pkgdir}/opt/ut" < utpg.list || return 1
165 # Fix a small bug until next UTPG release. Thanks for the hint, elsixdiab.
166 /bin/sed -i '/^LoadClassMismatch/s/\.%s$//' \
167 "${pkgdir}/opt/ut/System/Core.int"
171 source /usr/lib/makepkg/unreal.sh || return 1
173 if [ -z "${_cdpath}" ]; then
174 _detect_cdpath || return 1
176 echo "Using ${_cdpath} as install medium."
178 if [ -z "${_cdversion}" ]; then
179 _detect_cdversion || return 1
181 echo "Using \"${_cdversion}\" install method."
184 /bin/install --directory -- ${srcdir}/{436,436goty,451utpg} \
186 ${pkgdir}/opt/ut/{Help,Logs,Maps,Music,Sounds,System,Textures} \
187 ${pkgdir}/opt/ut/Web/{images,inc,plaintext/inc} || return 1
188 /bin/install --mode=644 -D -- "${srcdir}/ut.desktop" \
189 "${pkgdir}/usr/share/applications/ut.desktop"
191 case "${_cdversion}" in
193 _build_default || return 1
196 _build_anthology || return 1
199 echo "Unknown _cdversion: ${_cdversion}" >&2