# Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="2" inherit eutils games MY_PN="Wolf4SDL" DESCRIPTION="Port of Wolfenstein 3D for SDL" HOMEPAGE="http://www.stud.uni-karlsruhe.de/~uvaue/chaos/" SRC_URI="http://www.stud.uni-karlsruhe.de/~uvaue/chaos/bins/Wolf4SDL-${PV}-src.zip" LICENSE="as-is" SLOT="0" KEYWORDS="amd64 ~x86" IUSE="smooth strafe ver_apogee ver_id +ver_shareware" # joystick support is required for compilation; can this be patched out? DEPEND="media-libs/libsdl[joystick] media-libs/sdl-mixer" RDEPEND="${DEPEND}" S="${WORKDIR}/${MY_PN}-${PV}-src" pkg_setup() { # Validate USE flags if (use ver_shareware && use ver_apogee) \ || (use ver_shareware && use ver_id) \ || (use ver_apogee && use ver_id); then die "You must specify the USE flag for only one version of the game." elif ! use ver_shareware && ! use ver_apogee && ! use ver_id; then die "You must specify the USE flag for your version of the game." elif use smooth && ! use strafe; then die "You must enable the strafe USE flag in order to use smooth." fi } src_prepare() { # Wolf4SDL must be compiled based on version of game data # Use USE flags to determine version, with shareware as default # Note: In all cases this assumes you're using v1.4 (the final version) if use ver_shareware; then version="shareware" einfo "Configuring for $version version" sed -i -e 's;^\(#define GOODTIMES\);//\1;' \ -e 's;^//\(#define UPLOAD\);\1;' version.h \ || die "configure version failed" elif use ver_apogee; then version="Apogee/3D Realms" einfo "Configuring for $version version" sed -i -e 's;^\(#define GOODTIMES\);//\1;' version.h \ || die "configure version failed" elif use ver_id; then version="ID/GT/Activision" einfo "Configuring for $version version" fi # Fix Linux compilation error einfo "Fixing GCC compilation errors" sed -i -e 's/open(filename, O_CREAT | O_WRONLY | O_BINARY);/open(filename, O_CREAT | O_WRONLY | O_BINARY, 0644);/' id_ca.cpp \ || die "GCC fix failed" # Apply patch to support per-user configuration files epatch "${FILESDIR}/configdir.patch" \ || die "configdir patch failed" # Apply patch to support auto-grabbing mouse in window mode epatch "${FILESDIR}/windowmouse.patch" \ || die "window mouse patch failed" # Apply patch to provide quake-style strafing if use strafe; then epatch "${FILESDIR}/strafe.patch" \ || die "strafe patch failed" # Apply patch to smooth gameplay experience, particularly mouse control if use smooth; then epatch "${FILESDIR}/smooth.patch" \ || die "smooth patch failed" fi fi } src_install() { local binary="wolf3d" insinto "${GAMES_DATADIR}/${PN}" exeinto "${GAMES_DATADIR}/${PN}" || die "binary installation failed" doexe $binary games_make_wrapper ${PN} "${GAMES_DATADIR}/${PN}/$binary" "${GAMES_DATADIR}/${PN}" doicon "${FILESDIR}/${PN}.xpm" make_desktop_entry ${PN} ${MY_PN} prepgamesdirs } pkg_postinst() { games_pkg_postinst ewarn ewarn "Note: You must copy your game data files (*.wl6 or *.wl1) for the" ewarn "$version version to: ${GAMES_DATADIR}/${PN}" ewarn ewarn "Run '${PN} --help' for info regarding resolution and fullscreen settings." }