# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils games DESCRIPTION="Unreal Tournament 99 - futuristic deathmatch 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} Ddir=${D}/${dir} set_dirs() { # The top-level directory names can change per CD if [[ -e "${CDROM_ROOT}/System" ]] ; then help_dir="Help" logs_dir="Logs" music_dir="Music" sounds_dir="Sounds" system_dir="System" textures_dir="Textures" web_dir="Web" else help_dir="HELP" logs_dir="LOGS" music_dir="MUSIC" sounds_dir="SOUNDS" system_dir="SYSTEM" textures_dir="TEXTURES" web_dir="WEB" fi if [[ -e "${CDROM_ROOT}/Maps" ]] ; then maps_dir="Maps" elif [[ -e "${CDROM_ROOT}/MAPS" ]] ; then maps_dir="MAPS" else maps_dir="maps" fi } 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 cd_f lst=$(grep "PATCH FILE " setup.data/patch.dat) lst=$(echo "${lst}" | sed -e "s:PATCH FILE ::g") for f in ${lst} ; do cd_f=${CDROM_ROOT}/${system_dir}/$(basename ${f}) cp -f "${cd_f}" "${S}/System/$(basename ${f})" \ || die "cp ${cd_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 -f 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 # Can't use cdrom_get_cds initially, because some CDs have # all the top-level directories in upper-case. if [[ -z "${CDROM_ROOT}" ]] && [[ -z "${CDROM_ROOT_1}" ]] ; then eerror "Please set CDROM_ROOT or CDROM_ROOT_1 to point to the CD, e.g.:" eerror " export CDROM_ROOT=/mnt/cdrom" die "Installation CD not found" fi local r for r in ${CDROM_ROOT} ${CDROM_ROOT_1} ; do if [[ -e "${r}/Help/BonusPackReadme.txt" ]] ; then is_goty="y" einfo "Found UT99 \"Game Of The Year\" edition" cdrom_get_cds Help/BonusPackReadme.txt Help/chaosut break elif [[ -e "${r}/HELP/BonusPackReadme.txt" ]] ; then is_goty="y" einfo "Found UT99 \"Game Of The Year\" edition (with upper-case dirs)" # "Help" on the *2nd* CD is still lower-case. cdrom_get_cds HELP/BonusPackReadme.txt Help/chaosut break elif [[ -e "${r}/System/Core.u" ]] \ || [[ -e "${r}/SYSTEM/Core.u" ]] ; then is_standard="y" einfo "Found UT99 standard edition" cdrom_get_cds System/Core.u break fi done if [[ -z "${is_goty}" ]] && [[ -z "${is_standard}" ]] ; then eerror "Please set CDROM_ROOT or CDROM_ROOT_1 to point to the CD, e.g.:" eerror " export CDROM_ROOT=/mnt/cdrom" die "Unreal Tournament 99 files not found" fi set_dirs } src_unpack() { mkdir Help Logs Maps Music NetGamesUSA.com Sounds System Textures Web UTPG cp -rf "${CDROM_ROOT}"/{${help_dir},${logs_dir},${music_dir},${textures_dir}} "${S}" \ || die "cp Help, Logs, Music, Textures failed" # Sounds if use nls ; then cp -f "${CDROM_ROOT}"/${sounds_dir}/* "${S}"/Sounds \ || die "cp Sounds/* failed" else cp -f "${CDROM_ROOT}"/${sounds_dir}/*.uax "${S}"/Sounds \ || die "cp Sounds/*.uax failed" fi # System cp -f "${CDROM_ROOT}"/${system_dir}/*.u "${S}"/System \ || die "cp System failed" if use nls ; then cp -f "${CDROM_ROOT}"/${system_dir}/*.{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_dir}" -name '*.uz' -printf '%f ' ) ; do "${S}"/System/ucc-bin decompress "${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_dir}"/*.unr "${S}"/Maps cd "${S}" if [[ -n "${is_goty}" ]] ; then # GOTY Disk 2 cdrom_load_next_cd set_dirs # GOTY CD 2 - Help, Sounds cp -rf "${CDROM_ROOT}"/{${help_dir},${sounds_dir}} "${S}" || die "cp Help Sounds (CD 2) failed" # GOTY S3TC Textures if use S3TC ; then cp -f "${CDROM_ROOT}/${textures_dir}"/* "${S}"/Textures \ || die "cp S3TC Textures (CD 2) failed" else cp -f "${CDROM_ROOT}/${textures_dir}"/{JezzTex,Jezztex2,SnowDog,chaostex{,2}}.utx \ "${S}"/Textures \ || die "cp Textures (CD 2) failed" fi # System cp -f "${CDROM_ROOT}/${system_dir}"/*.{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_dir}" -name '*.uz' -printf '%f ' ) ; do "${S}"/System/ucc-bin decompress "${f}" -nohomedir \ || die "uncompress map ${f} failed" mv -f "${f:0:${#f}-3}" "${S}"/Maps \ || die "mv map ${f} failed" done cd "${S}" fi # Extract the patches a second time, to ensure they overwrite the CD files unpack_patches } src_install() { 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 }