updated on Wed Jan 11 12:00:27 UTC 2012
[aur-mirror.git] / ut1999 / PKGBUILD
bloba08d01a4ac60ca5f18a1886489d73ed2baed63bc
1 # Contributor: quantax -- contact via Arch Linux forum or AUR
3 pkgname=ut1999
4 pkgver=451
5 pkgrel=1
6 pkgdesc="The classic Unreal Tournament form 1999. Retail CD or DVD required."
7 arch=('i686')
8 url="http://www.unrealtournament2004.com/utgoty/"
9 license=('custom')
10 groups=(ut1999-goty)
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 \
16         ut.desktop \
17         disk.list \
18         utpg.list)
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.
33 _detect_cdpath() {
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}"
41             break
42         fi
43     done
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.
55 __EOF__
56         return 1
57     else
58         echo "    ${_cdpath} looks promising."
59     fi
62 # Determine which method should be used for extracting the files from the
63 # install medium.
64 _detect_cdversion() {
65     echo "Determining install method... "
67     if [ -f "${_cdpath}/SYSTEM/UnrealTournament.exe" ]; then
68         _cdversion="default"
69     elif [ -f "${_cdpath}/Disk1/data1.hdr" ]; then
70         _cdversion="anthology"
71     else
72         echo "Could not determine _cdversion." >&2
73         return 1
74     fi
75     echo "    Using \"${_cdversion}\" method."
78 # Install files from most UT99 CDs.
79 _build_default() {
80     echo "Extracting files from ${_cdpath}..."
81     cd "${srcdir}"
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" \
91             || return 1
92     /bin/grep "Maps/" disk.list \
93             | _unreal_move_files "${pkgdir}/opt/ut/System" "${pkgdir}/opt/ut" \
94             || return 1
95     /bin/rm -f -- "${pkgdir}/opt/ut/System/ucc.log"
98 # Install files from the Unreal Anthology DVD.
99 _build_anthology() {
100     echo "Extracting files from ${_cdpath}..."
101     cd "${srcdir}"
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 \
108             || return 1
109     /usr/bin/unshield x -g 3_UnrealTournament_Sounds_English -d dvd data1.hdr \
110             || return 1
111     /usr/bin/unshield x -g 3_UnrealTournament_System_All -d dvd data1.hdr \
112             || return 1
113     /usr/bin/unshield x -g 3_UnrealTournament_System_English -d dvd data1.hdr \
114             || return 1
115     /usr/bin/unshield x -g 3_UnrealTournament_Textures -d dvd data1.hdr \
116             || return 1
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.
124 _install_patches() {
125     echo "Adding Loki's Linux runtime files..."
126     cd "${srcdir}"
128     /bin/sh ./ut436.run --tar xfC 436 || return 1
129     /bin/sh ./ut436goty.run --tar xfC 436goty || return 1
131     cd 436goty
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.
152     cd "${srcdir}"
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"
170 build() {
171     source /usr/lib/makepkg/unreal.sh || return 1
173     if [ -z "${_cdpath}" ]; then
174         _detect_cdpath || return 1
175     else
176         echo "Using ${_cdpath} as install medium."
177     fi
178     if [ -z "${_cdversion}" ]; then
179         _detect_cdversion || return 1
180     else
181         echo "Using \"${_cdversion}\" install method."
182     fi
184     /bin/install --directory -- ${srcdir}/{436,436goty,451utpg} \
185             ${pkgdir}/usr/bin \
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
192         ("default")
193             _build_default || return 1
194             ;;
195         ("anthology")
196             _build_anthology || return 1
197             ;;
198         (*)
199             echo "Unknown _cdversion: ${_cdversion}" >&2
200             return 1
201             ;;
202     esac