# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils flag-o-matic games MY_PN="hexen2" DESCRIPTION="Hexen 2 port - Hammer of Thyrion" HOMEPAGE="http://uhexen2.sourceforge.net/" SRC_URI="mirror://sourceforge/uhexen2/hexen2source-${PV}.tgz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="alsa debug demo dynamic opengl sdlcd timidity" QA_EXECSTACK="${GAMES_BINDIR:1}/hexen2 ${GAMES_BINDIR:1}/hexen2-demo ${GAMES_BINDIR:1}/hwcl" UIDEPEND=">=media-libs/libsdl-1.2.7 >=media-libs/sdl-mixer-1.2.5 amd64? ( >=app-emulation/emul-linux-x86-sdl-2.1 ) alsa? ( >=media-libs/alsa-lib-1.0.7 ) opengl? ( virtual/opengl ) timidity? ( media-sound/timidity++ ) || ( ( x11-libs/libX11 x11-libs/libXau x11-libs/libXdmcp x11-libs/libXext ) virtual/x11 )" RDEPEND="${UIDEPEND} demo? ( games-fps/hexen2-demodata )" DEPEND="${UIDEPEND} x86? ( >=dev-lang/nasm-0.98.38 )" S=${WORKDIR}/${MY_PN}source-${PV} dir=${GAMES_DATADIR}/${MY_PN} pkg_setup () { games_pkg_setup if use amd64 ; then if ! has_m32 ; then eerror "Your compiler seems to be unable to compile 32-bit code." eerror "Make sure you compile gcc with:" eerror " USE=multilib FEATURES=-sandbox" die "Cannot produce 32-bit code." fi if has_multilib_profile ; then export ABI=x86 else append-flags -m32 append-ldflags -m32 fi fi if use timidity ; then if ! built_with_use "media-libs/sdl-mixer" timidity ; then eerror "Recompile media-libs/sdl-mixer with the 'timidity' USE flag." die "sdl-mixer without timidity detected." fi fi } src_unpack() { unpack ${A} cd "${S}" local demo use demo && demo="/demo" # Use default basedir sed -i {hexen2,hexenworld/Client}/common.c \ -e "s:strcpy (com_basedir, host_parms.basedir):strcpy (com_basedir, \"${dir}${demo}\"):" \ || die "sed common.c failed" rm -rf docs/{activision,COMPILE,COPYING,LICENSE,README.win32} } src_compile() { yesno() { useq $1 && echo yes || echo no ; } local gl_prefix link_gl_libs="no" opts use_x86_asm="no" # Prefix to make OpenGL instead of software-rendered binaries use opengl && gl_prefix="gl" use opengl && link_gl_libs=$(yesno dynamic) use debug && opts="${opts} DEBUG=1" use demo && opts="${opts} DEMO=1" use x86 && use_x86_asm="yes" # Hexen cd "${MY_PN}" emake clean || die "emake clean failed" emake \ USE_ALSA=$(yesno alsa) \ USE_MIDI=$(yesno timidity) \ USE_SDLCD=$(yesno sdlcd) \ LINK_GL_LIBS=${link_gl_libs} \ GLH2_BINARY=${MY_PN} \ ${gl_prefix}h2 \ ${opts} \ || die "emake failed" # Hexenworld cd "${S}"/hexenworld ./build.sh || die "build.sh failed" } src_install() { local demo use demo && demo="-demo" newgamesbin "${MY_PN}/${MY_PN}" "${MY_PN}${demo}" \ || die "newgamesbin ${MY_PN} failed" # Hexenworld dogamesbin hexenworld/Server/hwsv \ || die "dogamesbin hwsv failed" dogamesbin hexenworld/Master/hwmaster \ || die "dogamesbin hwmaster failed" newgamesbin "hexenworld/Client/${GL_PREFIX}hwcl" hwcl \ || die "newgamesbin hwcl failed" use demo || keepdir "${dir}"/{data1,portals} dodoc docs/* prepgamesdirs } pkg_postinst() { games_pkg_postinst if ! use timidity ; then einfo "Music requires the 'timidity' USE flag." einfo fi if use demo ; then einfo "uhexen2 has been compiled specifically to play the demo maps." einfo "Example command-line:" einfo " hexen2-demo -sndspeed 44100 -nocdaudio -width 1024 -height 768" echo else einfo "To play the demo, emerge with the 'demo' USE flag." einfo einfo "For the Hexen 2 original game..." einfo "Put the following files into ${GAMES_DATADIR}/hexen2/data1 before playing:" einfo " hexen.rc pak0.pak pak1.pak progs.dat progs2.dat strings.txt" einfo "You may need to patch the data files to version 1.1 using 'update_h2' in:" einfo " http://prdownloads.sourceforge.net/uhexen2/hexen2-1.3.0-linux.i586.tgz" einfo "Then to play: hexen2" einfo einfo "For the 'Portal of Praevus' mission pack..." einfo "Put the following files into ${GAMES_DATADIR}/hexen2/portals before playing:" einfo " default.cfg hexen.rc pak3.pak progs.dat puzzles.txt strings.txt" einfo "Then to play: hexen2 -portals" einfo einfo "Example command-line:" einfo " hexen2 -sndspeed 44100 -nocdaudio -width 1024 -height 768" echo fi }