# Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI=3 inherit eutils games MY_PN="vcmi" DESCRIPTION="Data files for the turn based strategy game HOMM3 clone VCMI" HOMEPAGE="http://forum.vcmi.eu/portal.php/" SRC_URI="http://download.vcmi.eu/${PN}_${PV}.tar.gz http://download.vcmi.eu/${MY_PN}32menu.zip http://download.vcmi.eu/dataEN.7z" RESTRICT="mirror" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="vcmimenu" PDEPEND="games-strategy/vcmi" S=${WORKDIR}/${MY_PN} src_unpack() { einfo "The HOMM3 WoG has been installed in ${HOMM3WOG_ROOT}" [ -z "${HOMM3WOG_ROOT}" ] && die "HOMM3WOG_ROOT must be set as the path to where the WoG has been installed!" mkdir -p ${S} pushd ${S} > /dev/null unpack ${PN}_${PV}.tar.gz use vcmimenu && unpack ${MY_PN}32menu.zip cd "${S}"/Data unpack dataEN.7z popd > /dev/null } src_install() { einfo "Copy data files from the HOMM3 directory and ensure the file names are correct ..." einfo "Before installation HOMM3WOG_ROOT must point to the directory of an installed HOMM3" mkdir -p "${D}/${GAMES_DATADIR}/" cp -dR --preserve=mode,timestamps,links "${HOMM3WOG_ROOT}/" \ "${D}/${GAMES_DATADIR}/${MY_PN}" || die "The HOMM3 has not been installed" local pathlst=$(cat ${FILESDIR}/pathnamelst | sed '/^[ ]*#/d' | \ awk -F'/' '{if(NF>=2){ for(i = 1; i < NF;i++){ for(j = 1; j <= i; j++) printf("%s/", $j); printf("\n");}} print $0}' | \ sed 's:/$::; /^$/d' | sort | uniq) for pathname in ${pathlst} do local fdpath=$(echo "${pathname}" | sed "s:^:${D}/${GAMES_DATADIR}/${MY_PN}/:" | sed -r "s:/[/]+:/:g") find ${D} -iwholename "${fdpath}" -exec mv -f -T {} "${fdpath}" \; done einfo "Install the data files for vcmi..." cp -a "${S}"/ "${D}/${GAMES_DATADIR}/" if has_version "games-strategy/heroes3[videos]" ; then einfo "Use the main menu background of VCMI..." dosym "/opt/heroes3/data/video/" /${GAMES_DATADIR}/${MY_PN}/Data/video fi }