# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils games GOTY_SUM="966517d2c0d0f4f40adc9aa45f17997e" DESCRIPTION="Unreal Tournament 99 - futuristic shooter" HOMEPAGE="http://www.unrealtournament.com/ http://utpg.org/" # Downloads both small patches, rather than bothering the user with a USE flag SRC_URI="mirror://lokigames/../beta/ut/ut-install-436-GOTY.run mirror://lokigames/../patches/ut/ut-install-436.run http://utpg.org/patches/UTPGPatch${PV}.tar.bz2" LICENSE="as-is" SLOT="0" KEYWORDS="-* ~amd64 ~x86" IUSE="3dfx bonus dedicated nls opengl S3TC" RESTRICT="strip" UIDEPEND="!amd64? ( || ( ( x11-libs/libXext x11-libs/libX11 x11-libs/libXau x11-libs/libXdmcp ) virtual/x11 ) opengl? ( virtual/opengl ) =media-libs/libsdl-1.2* ) amd64? ( app-emulation/emul-linux-x86-sdl app-emulation/emul-linux-x86-baselibs app-emulation/emul-linux-x86-xlibs )" RDEPEND="bonus? ( games-fps/unreal-tournament-bonuspacks ) dedicated? ( games-server/unreal-tournament-ded )" DEPEND="${UIDEPEND} !games-fps/unreal-tournament-goty" S=${WORKDIR} dir=${GAMES_PREFIX_OPT}/${PN/-goty/} Ddir=${D}/${dir} unpack_patches() { # This routine is run twice, to ensure that the patch files # take precedence over the CD files. if [[ -n "${is_goty}" ]] ; then unpack_makeself ut-install-436-GOTY.run else unpack_makeself ut-install-436.run fi # Grab files from the CD, to be able to apply the Loki patch local f lst lst=$(grep "PATCH FILE " setup.data/patch.dat) lst=$(echo "${lst}" | sed -e "s:PATCH FILE ::g") for f in ${lst} ; do cp "${CDROM_ROOT}/${f}" "${S}/${f}" \ || die "cp ${CDROM_ROOT}/${f} failed" done if use 3dfx ; then unpack ./Glide.ini.tar.gz || die "unpack Glide.ini failed" else unpack ./OpenGL.ini.tar.gz || die "unpack OpenGL.ini failed" fi unpack ./{Credits,data,NetGamesUSA.com}.tar.gz # Apply Loki patch cd setup.data cp patch.dat{,.orig} || die "cp patch.dat failed" sed -e 's:sh uz-maps.sh:echo:' patch.dat.orig > patch.dat \ || die "sed patch.dat failed" if ! ./bin/Linux/x86/loki_patch patch.dat "${S}" ; then eerror "Check whether the correct non/GOTY patch is being applied." die "loki_patch failed." fi cd "${S}" # Apply UTPG patch last, to ensure that it overwrites the CD data unpack UTPGPatch${PV}.tar.bz2 rm System/{checkfiles.sh,patch.md5} rm -r UTPG # Fix server vulnerability - part of bug #44351 sed "/^LoadClassMismatch/s:%s.%s:%s:" System/Core.int \ || die "sed Core.int failed" } pkg_setup() { games_pkg_setup cdrom_get_cds System/Core.u local sum sum=$( md5sum "${CDROM_ROOT}"/System/Editor.u | cut -d ' ' -f 1 ) if [[ "${sum}" = "${GOTY_SUM}" ]] ; then is_goty=y echo ewarn 'Switching to the "Game Of The Year" edition on 2 CDs' echo cdrom_get_cds System/Core.u Help/chaosut fi } src_unpack() { mkdir Help Logs Maps Music NetGamesUSA.com Sounds System Textures Web UTPG # CDs cp -rf "${CDROM_ROOT}"/{Help,Logs,Music,Textures} "${S}" \ || die "cp Help, Logs, Music, Textures failed" # Sounds if use nls ; then cp -f "${CDROM_ROOT}"/Sounds/* "${S}"/Sounds \ || die "cp Sounds/* failed" else cp -f "${CDROM_ROOT}"/Sounds/*.uax "${S}"/Sounds \ || die "cp Sounds/*.uax failed" fi # System cp -f "${CDROM_ROOT}"/System/*.u "${S}"/System \ || die "cp System failed" if use nls ; then cp -f "${CDROM_ROOT}"/System/*.{est,frt,itt} "${S}"/System \ || die "cp System (nls) failed" fi # Unpack ucc-bin, for uncompressing maps unpack_patches # Uncompress maps (GOTY edition installs maps as .uz) echo "Uncompressing Maps... this may take some time" cd "${S}"/System export HOME=${T} export UT_DATA_PATH=${S}/System for f in $(find ${CDROM_ROOT}/Maps -name '*.uz' -printf '%f ') ; do "${S}"/System/ucc-bin decompress "${CDROM_ROOT}/Maps/${f}" -nohomedir \ || die "uncompress map ${f} failed" mv -f "${f:0:${#f}-3}" "${S}"/Maps \ || die "mv map ${f} failed" done # Some CDs contain uncompressed maps cp -f "${CDROM_ROOT}"/Maps/*.unr "${S}"/Maps cd "${S}" if [[ -n "${is_goty}" ]] ; then # GOTY Disk 2 cdrom_load_next_cd # GOTY CD 2 - Help, Sounds cp -rf "${CDROM_ROOT}"/{Help,Sounds} "${S}" || die "cp Help Sounds (CD 2) failed" # GOTY S3TC Textures if use S3TC ; then cp -f "${CDROM_ROOT}"/Textures/* "${S}"/Textures \ || die "cp S3TC Textures (CD 2) failed" else cp -f "${CDROM_ROOT}"/Textures/{JezzTex,Jezztex2,SnowDog,chaostex{,2}}.utx \ "${S}"/Textures \ || die "cp Textures (CD 2) failed" fi # System cp -f "${CDROM_ROOT}"/System/*.{int,u} "${S}"/System \ || die "cp System (CD 2) failed" # Uncompress maps echo "Uncompressing GOTY CD 2 Maps... this may take some time" cd "${S}"/System export HOME=${T} export UT_DATA_PATH=${S}/System for f in $(find "${CDROM_ROOT}"/maps -name '*.uz' -printf '%f ') ; do "${S}"/System/ucc-bin decompress "${CDROM_ROOT}/maps/${f}" -nohomedir \ || die "uncompress map ${f} (CD 2) failed" mv -f "System/${f:0:${#f}-3}" "${S}"/Maps \ || die "mv map ${f} (CD 2) failed" done cd "${S}" fi unpack_patches } src_install() { # Files from the client patches insinto "${dir}" doins -r icon.{bmp,xpm} README Help Logs Maps Music NetGamesUSA.com Sounds System Textures Web \ || die "doins random files failed" rm "${Ddir}"/System/*-bin exeinto "${dir}"/System # Deliberately don't install ucc-bin, due to bug #44351. # unreal-tournament-ded contains it instead. doexe System/ut-bin || die "doexe ut-bin failed" # Scripts exeinto "${dir}" doexe bin/x86/u{cc,t} || die "doexe ucc/ut failed" dosed "s:\`FindPath \$0\`:${dir}:" "${dir}"/u{cc,t} # Desktop games_make_wrapper ut ./ut "${dir}" newicon icon.xpm ut.xpm make_desktop_entry ut "Unreal Tournament 99" ut.xpm # Update file datestamps find "${Ddir}" -exec touch '{}' \; prepgamesdirs } pkg_postinst() { games_pkg_postinst if ! use bonus && ! has_version "games-fps/unreal-tournament-bonuspacks" ; then einfo "The 'bonus' USE flag is recommended, to add many popular maps." echo fi if ! use dedicated && ! has_version "games-server/unreal-tournament-ded" ; then einfo "The 'ucc' server executable has been moved to:" einfo " games-server/unreal-tournament-ded" einfo "Because it is insecure - see bug #44351." echo fi }