# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="3" inherit check-reqs eutils games MY_PN="${PN^}" DESCRIPTION="An original action role-playing game set in a lush imaginative world" HOMEPAGE="http://supergiantgames.com/" HIB_HOMEPAGE="http://www.humblebundle.com/" SRC_URI="Bastion-HIB-${PV:0:4}-${PV:4:2}-${PV:6:2}-${PR//[[:alpha:]]}.sh" LICENSE="as-is" SLOT="0" KEYWORDS="-* ~amd64 ~x86" IUSE="bundled-libs" RESTRICT="fetch strip" DEPEND="app-arch/tar app-arch/xz-utils" RDEPEND="media-libs/freealut media-libs/openal media-libs/sdl-gfx media-libs/sdl-image media-libs/sdl-mixer media-libs/sdl-net media-libs/sdl-ttf media-libs/smpeg virtual/opencl virtual/opengl x11-libs/libX11 !bundled-libs? ( dev-lang/mono media-libs/fmod:1 media-libs/libsdl )" ARCH_SUFFIX="$(usex "amd64" "x86_64" "x86")" S="${WORKDIR}" GAMEDIR="${GAMES_PREFIX_OPT}/${PN}" pkg_nofetch() { einfo "" einfo "Please download \"${SRC_URI}\" from:" einfo " ${HIB_HOMEPAGE}" einfo "and move/link it to \"${DISTDIR}\"" einfo "" } src_unpack() { CHECKREQS_DISK_BUILD="2400M" check-reqs_pkg_setup local archive="${DISTDIR}/${A}" local data_size="$(grep --binary-file=text --max-count=1 --regexp="filesizes=\"[0-9]*\"" "${archive}" | cut --delimiter='"' --fields=2)" local data_files="./instarchive_all ./instarchive_linux_${ARCH_SUFFIX}" if [[ "${?}" == "0" && "${data_size}" =~ ^[0-9]+$ ]] then echo ">>> Unpacking ${A} to ${PWD}" ( tail --bytes=${data_size} "${archive}" | tar --extract --gzip --file - --transform="s/.*instarchive.*/&.tar.lzma/" ${data_files} ) || die "unpacking \"${archive}\" failed" unpack ./*.tar.lzma || die "unpacking archives failed" rm -f ./*.tar.lzma || die "removing archives failed" fi || die "processing \"${archive}\" failed" } src_install() { # Install exec, libs, icon and readme first, so only data remains: insinto "${GAMEDIR}" || die "insinto \"${GAMEDIR}\" failed" exeinto "${GAMEDIR}" || die "exeinto \"${GAMEDIR}\" failed" local executable="${MY_PN}.bin.${ARCH_SUFFIX}" # Install executables and libraries: doexe "${executable}" || die "doexe \"${executable}\" failed" rm -f "${executable}" || die "removing \"${executable}\" failed" if use bundled-libs then exeinto "${GAMEDIR}/lib" || die "exeinto \"${GAMEDIR}/lib\" failed" doexe lib*/* || die "doexe lib failed" fi rm -fr lib* || die "removing libs failed" # Make game wrapper: games_make_wrapper "${PN}" "./${executable}" "${GAMEDIR}" "$( usex "bundled-libs" "${GAMEDIR}/lib" "" )" || die "games_make_wrapper \"${PN}\" failed" # Install icon: newicon "${MY_PN}.png" "${PN}.png" || die "newicon \"${PN}.png\" failed" rm -f *.png || die "removing icon failed" # Make desktop file: make_desktop_entry "${PN}" "${MY_PN}" "/usr/share/pixmaps/${PN}.png" || die "make_desktop_entry failed" # Install docs: dodoc README* || die "dodoc failed" rm -f README* || die "removing documentation failed" # Install data files: doins -r * || die "doins data failed" # Setting permissions prepgamesdirs } pkg_postinst() { echo "" games_pkg_postinst einfo "${MY_PN} savegames and configurations are stored in:" einfo " \${HOME}/.SupergiantGames/${MY_PN}" echo "" }