# Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/games-fps/duke3d-data/duke3d-data-1.0.ebuild,v 1.5 2010/04/26 11:55:23 fauli Exp $ EAPI=2 inherit cdrom eutils games subversion DESCRIPTION="Duke Nukem: Nuclear Winter data files" HOMEPAGE="http://www.3drealms.com/ http://hrp.duke4.net/" SRC_URI="" ESVN_REPO_URI="http://svn.eduke32.com/nw_plus/" ESVN_PROJECT="nw_plus" LICENSE="as-is" SLOT="0" KEYWORDS="amd64 ~x86" PROPERTIES="interactive" IUSE="textures" DEPEND="textures? ( app-arch/zip dev-util/bsdiff dev-vcs/subversion games-fps/eduke32[utils] )" RDEPEND="games-fps/duke3d-data" S="${WORKDIR}/nw_plus" dir="${WORKDIR}/nwinter" # Rename all files in current directory to have a lowercase name function lowername() { for i in *; do NAME=$(echo ${i} | tr "[:upper:]" "[:lower:]") # only continue if the name is not already lowercase if [ "${i}" != "${NAME}" ]; then # skip existing files if [ -f "${NAME}" ]; then echo "file exists: ${NAME}" else mv -n "$i" "${NAME}" fi fi done } src_unpack() { cdrom_get_cds gamedata/nwinter.grp # Download files for Plus version if necessary use textures && subversion_src_unpack } src_prepare() { mkdir "${dir}" # Prefix included CON files to prevent conflicts with other expansions # or with 'Plus' files cd "${CDROM_ROOT}"/gamedata for i in *.con; do cp "$i" "${dir}/nwinter${i%.*}.con" done cd "${dir}" sed -e 's/include \([^\.]*\)\.CON/include NWINTER\1\.CON/g' \ -i nwinternwinter.con || die "sed CON include fix failed" # Update Plus/HRP files if necessary if use textures; then # Fix Nuclear Winter Plus directory structure mv "${S}"/nw_plus/* "${S}" # Apply map updates/fixes kextract "${CDROM_ROOT}"/gamedata/nwinter.grp "*.map" lowername for i in $(seq 1 8); do bspatch "e2l${i}.map" "${S}/nwl${i}.map" "${S}/nwl${i}.patch" [ -e "${S}/nwl${i}.patch" ] || die "bspatch failed" done rm -rf "${S}"/{linux_macosx,nw_plus,utils} rm -f "${S}"/*.{bat,ico,url,patch} cd "${S}" # Zip Nuclear Winter Plus for smaller/single file installation echo -e "\n>>> Preparing Nuclear Winter Plus zip file" zip -9 -q -r ../nw_plus.zip . fi } src_install() { insinto "${GAMES_DATADIR}/duke3d" doins "${CDROM_ROOT}"/gamedata/nwinter.grp || die "doins GRP failed" doins "${dir}"/nwinter*.con || die "doins CON failed" dodoc "${CDROM_ROOT}"/readme.txt || die "dodoc failed" if use textures; then doins "${WORKDIR}/nw_plus.zip" || die "doins nw_plus failed" dodoc "${S}"/NWinter+_{Readme,To_Do}.txt newdoc "${S}"/NWINTRO.TXT nwintro.txt fi prepgamesdirs } pkg_postinst() { if ! has_version games-fps/duke3d && ! has_version games-fps/eduke32; then echo einfo "Note: You must also install a game engine, such as games-fps/duke3d or" einfo "(preferably) games-fps/eduke32, in order to play Duke Nukem 3D." echo fi }