defcon-demo-1.60.ebuild 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # Copyright 1999-2012 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils toolchain-funcs gnome2-utils games
  5. MY_PN=defcon
  6. MY_PV=${PV:0:3}
  7. MY_PVR=1
  8. MY_P=defcon_${MY_PV}-${MY_PVR}
  9. DESCRIPTION="Global thermonuclear war simulation with multiplayer support"
  10. HOMEPAGE="http://www.introversion.co.uk/defcon/"
  11. SRC_URI="x86? ( http://www.introversion.co.uk/defcon/downloads/${MY_P}_i386.deb )
  12. amd64? ( http://www.introversion.co.uk/defcon/downloads/${MY_P}_amd64.deb )"
  13. LICENSE="Introversion"
  14. SLOT="0"
  15. KEYWORDS="-* ~amd64 ~x86"
  16. IUSE="+system-libs"
  17. RESTRICT="mirror strip"
  18. # glibc discussion:
  19. # http://forums.introversion.co.uk/defcon/viewtopic.php?t=4016
  20. RDEPEND="
  21. media-libs/libogg
  22. media-libs/libvorbis
  23. >=sys-libs/glibc-2.3
  24. x11-libs/libX11
  25. x11-libs/libXau
  26. x11-libs/libXext
  27. x11-libs/libXdmcp
  28. system-libs? ( media-libs/libsdl[sound,video] )"
  29. DEPEND=""
  30. QA_PREBUILT="${GAMES_PREFIX_OPT:1}/${PN}/lib/${MY_PN}.bin.x86"
  31. S=${WORKDIR}/usr/local/games/${MY_PN}
  32. src_unpack() {
  33. default
  34. unpack ./data.tar.gz
  35. cd "${S}" || die
  36. # maintain compatibility with old installation/script
  37. [[ -e lib64 ]] && { mv lib64 lib || die ;}
  38. [[ -e ${MY_PN}.bin.x86_64 ]] && { mv ${MY_PN}.bin.x86_64 ${MY_PN}.bin.x86 || die ;}
  39. }
  40. src_prepare() {
  41. # FindPath scripts are ugly and unnecessary
  42. if use system-libs ; then
  43. rm -f lib/lib*
  44. fi
  45. sed \
  46. -e "s:GAMEDIR:${GAMES_PREFIX_OPT}/${PN}:g" \
  47. "${FILESDIR}"/${MY_PN} > "${T}"/${MY_PN} || die
  48. echo "int chdir(const char *d) { return 0; }" > chdir.c || die
  49. }
  50. src_compile() {
  51. echo "$(tc-getCC) ${CFLAGS} ${LDFLAGS} -fPIC -shared -o lib/chdir.so chdir.c"
  52. $(tc-getCC) ${CFLAGS} ${LDFLAGS} -fPIC -shared -o lib/chdir.so chdir.c || die
  53. }
  54. src_install() {
  55. local dir=${GAMES_PREFIX_OPT}/${PN}
  56. insinto "${dir}/lib"
  57. doins *.dat
  58. exeinto "${dir}"/lib
  59. doexe lib/*.so
  60. doexe ${MY_PN}.bin.x86
  61. doicon -s 128 ${MY_PN}.png
  62. # Can be upgraded to full version, so is not installed as "demo"
  63. dogamesbin "${T}"/${MY_PN}
  64. make_desktop_entry ${MY_PN} "Defcon"
  65. prepgamesdirs
  66. }
  67. pkg_preinst() {
  68. games_pkg_preinst
  69. gnome2_icon_savelist
  70. }
  71. pkg_postinst() {
  72. games_pkg_postinst
  73. gnome2_icon_cache_update
  74. elog "Screenshots will appear in ~/.${MY_PN}/lib"
  75. }
  76. pkg_postrm() {
  77. gnome2_icon_cache_update
  78. }