# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit games DESCRIPTION="Enhanced OGG Music from Sycraft.org for Vavoom Engine" HOMEPAGE="http://www.sycraft.org" LICENSE="as-is" SLOT="0" KEYWORDS="~x86 ~amd64" IUSE="doom1 doom2 heretic hexen tnt" base_uri="http://sycraft.org/content/audio" doom1_src="Sycraft-D1-high-full.exe" doom2_src="Sycraft-D2-high-full.exe" tnt_src="Sycraft-TNT-high-full.exe" heretic_src="hereticsoundtrackhq.zip" hexen_src="hexensoundtrackhq.zip" SRC_URI=" doom1? ( ${base_uri}/doom/${doom1_src} ) doom2? ( ${base_uri}/doom/${doom2_src} ) tnt? ( ${base_uri}/doom/${tnt_src} ) heretic? ( ${base_uri}/heretic/${heretic_src} ) hexen? ( ${base_uri}/hexen/${hexen_src} )" DEPEND="app-arch/p7zip app-arch/unzip" pkg_setup() { if ( ! use doom1 && \ ! use doom2 && \ ! use heretic && \ ! use hexen && ! \ use tnt); then eerror eerror "You must enable at least one USE flag between" eerror "'doom1','doom2','heretic','hexen','tnt'!" eerror die "No USE enabled" fi games_pkg_setup } src_unpack() { # Do a lot of work 'cause the files are packaged # in a not-so-very-friendly way :( for X in ${IUSE} do if use ${X}; then local src_file pak_file case "${X}" in doom1|doom2|tnt) # Packed in a NSIS self-extracting exe case ${X} in doom1) src_file=${doom1_src} pak_file="d1music.pk3" ;; doom2) src_file=${doom2_src} pak_file="d2music.pk3" ;; tnt) src_file=${tnt_src} pak_file="tntmusic.pk3" ;; esac cd ${WORKDIR} 7z e -o${X} -y ${DISTDIR}/${src_file} \ || die "unpack through 7z failed" # Remove weird double quotes from filenames for i in `find -name '*\"*' -print` do newname=`echo $i | sed -e 's/\"//g'` mv ${i} ${newname} \ || die "renaming files failed" done cd ${X} unzip -j ${pak_file} || die "unzip failed" ;; heretic|hexen) # Packed in ZIP file case ${X} in heretic) src_file=${heretic_src} ;; hexen) src_file=${hexen_src} ;; esac cd ${WORKDIR} unzip -d ${X} ${DISTDIR}/${src_file} \ || die "unzip failed" cd ${X} unzip -j musichq.zip || die "unzip failed" ;; esac fi done } src_install() { for X in ${IUSE} do if use ${X}; then cd ${WORKDIR} insinto ${GAMES_DATADIR}/vavoom/basev/${X}/music doins ${X}/*.ogg || die "doins failed" docinto ${X} case "${X}" in "doom1" | "doom2" | "tnt" ) dodoc ${X}/Sycraft_music_readme.txt \ || die "dodoc failed" ;; "heretic" | "hexen" ) dodoc ${X}/readme.txt || die "dodoc failed" ;; esac fi done prepgamesdirs } pkg_postinst() { games_pkg_postinst if ! has_version "games-fps/vavoom" ; then elog "This is just music data. To play, emerge a client" elog "such as vavoom." fi }