Skip to content

Commit

Permalink
games-fps/ut2004: Port to EAPI 7
Browse files Browse the repository at this point in the history
Closes: https://bugs.gentoo.org/601402
Package-Manager: Portage-2.3.77, Repoman-2.3.17
Signed-off-by: David Seifert <[email protected]>
Signed-off-by: James Le Cuirot <[email protected]>
  • Loading branch information
SoapGentoo authored and chewi committed Oct 27, 2019
1 parent d1d13e3 commit 8c0d066
Showing 1 changed file with 32 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=5
inherit eutils multilib games
EAPI=7

inherit desktop eutils

MY_P="${PN}-lnxpatch${PV%.*}-2.tar.bz2"

MY_P="ut2004-lnxpatch${PV%.*}-2.tar.bz2"
DESCRIPTION="Editor's Choice Edition plus Mega Pack for the well-known first-person shooter"
HOMEPAGE="http://www.unrealtournament2004.com/"
SRC_URI="
http://treefort.icculus.org/${PN}/${MY_P}
http://ut2004.ut-files.com/index.php?dir=Patches/Linux/&file=${MY_P} -> ${MY_P}
http://storage.guntoo.de/downs/downloads/Patch/ut2004-v${PV/./-}-linux-dedicated.7z
mirror://gentoo/ut2004-v${PV/./-}-linux-dedicated.7z"

Expand All @@ -18,32 +20,36 @@ KEYWORDS="~amd64 ~x86"
IUSE="dedicated opengl"
RESTRICT="bindist mirror strip"

UIDEPEND="=virtual/libstdc++-3.3
UIDEPEND="
~virtual/libstdc++-3.3
virtual/opengl
x11-libs/libXext
x11-libs/libX11
x11-libs/libXau
x11-libs/libXdmcp
media-libs/libsdl
media-libs/openal"
RDEPEND="sys-libs/glibc
RDEPEND="
sys-libs/glibc
games-fps/ut2004-data
games-fps/ut2004-bonuspack-ece
games-fps/ut2004-bonuspack-mega
dedicated? ( !games-server/ut2004-ded )
opengl? ( ${UIDEPEND} )
!dedicated? ( !opengl? ( ${UIDEPEND} ) )"
DEPEND="app-arch/p7zip"
BDEPEND="app-arch/p7zip"

S=${WORKDIR}/UT2004-Patch
dir=${GAMES_PREFIX_OPT}/${PN}
S="${WORKDIR}/${PN^^}-Patch"

# The executable pages are required #114733
QA_PREBUILT="${dir:1}/System/ut2004-bin
${dir:1}/System/ucc-bin"
QA_PREBUILT="
/opt/${PN}/System/ut2004-bin
/opt/${PN}/System/ucc-bin"

src_prepare() {
cd "${S}"/System
default

cd System || die

# These files are owned by ut2004-bonuspack-mega
rm -f Manifest.in{i,t} Packages.md5 ucc-bin* || die
Expand All @@ -54,7 +60,7 @@ src_prepare() {
rm -f ut2004-bin-linux-amd64 || die
fi

cd "${WORKDIR}"/ut2004-ucc-bin-09192008
cd "${WORKDIR}"/ut2004-ucc-bin-09192008 || die
if use amd64 ; then
mv -f ucc-bin-linux-amd64 "${S}"/System/ucc-bin || die
else
Expand All @@ -67,34 +73,30 @@ src_prepare() {
}

src_install() {
insinto "${dir}"
doins -r *
fperms +x "${dir}"/System/ucc-bin
insinto /opt/${PN}
doins -r .
fperms +x /opt/${PN}/System/ucc-bin

if use opengl || ! use dedicated ; then
fperms +x "${dir}"/System/ut2004-bin
fperms +x /opt/${PN}/System/ut2004-bin

dosym /usr/$(get_libdir)/libopenal.so "${dir}"/System/openal.so
dosym /usr/$(get_libdir)/libSDL-1.2.so.0 "${dir}"/System/libSDL-1.2.so.0
dosym ../../../usr/$(get_libdir)/libopenal.so /opt/${PN}/System/openal.so
dosym ../../../usr/$(get_libdir)/libSDL-1.2.so.0 /opt/${PN}/System/libSDL-1.2.so.0

games_make_wrapper ut2004 ./ut2004 "${dir}" "${dir}"
make_wrapper ut2004 ./ut2004 /opt/${PN} /opt/${PN}
make_desktop_entry ut2004 "Unreal Tournament 2004"
fi

if use dedicated ; then
games_make_wrapper ut2004-ded "./ucc-bin server" "${dir}"/System
make_wrapper ut2004-ded "./ucc-bin server" /opt/${PN}/System
fi

prepgamesdirs
}

pkg_postinst() {
games_pkg_postinst

# Here is where we check for the existence of a cdkey...
# If we don't find one, we ask the user for it
if [[ -f ${dir}/System/cdkey ]] ; then
einfo "A cdkey file is already present in ${dir}/System"
if [[ -f "${EROOT}"/opt/${PN}/System/cdkey ]] ; then
einfo "A cdkey file is already present in /opt/${PN}/System"
else
ewarn "You MUST run this before playing the game:"
ewarn "emerge --config =${CATEGORY}/${PF}"
Expand All @@ -110,15 +112,15 @@ pkg_postinst() {
}

pkg_postrm() {
ewarn "This package leaves a cdkey file in ${dir}/System that you need"
ewarn "This package leaves a cdkey file in ${EROOT}/opt/${PN}/System that you need"
ewarn "to remove to completely get rid of this game's files."
}

pkg_config() {
ewarn "Your CD key is NOT checked for validity here so"
ewarn "make sure you type it in correctly."
ewarn "If you CTRL+C out of this, the game will not run!"
echo
ewarn
einfo "CD key format is: XXXXX-XXXXX-XXXXX-XXXXX"
while true ; do
einfo "Please enter your CD key:"
Expand All @@ -129,7 +131,7 @@ pkg_config() {
echo "You entered a blank CD key. Try again."
else
if [[ ${CDKEY1} == ${CDKEY2} ]] ; then
echo "${CDKEY1}" | tr [:lower:] [:upper:] > "${dir}"/System/cdkey
echo "${CDKEY1}" | tr [:lower:] [:upper:] > "${EROOT}"/opt/${PN}/System/cdkey || die
einfo "Thank you!"
break
else
Expand Down

0 comments on commit 8c0d066

Please sign in to comment.