nethack-3.6.0-r3.ebuild 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit eutils toolchain-funcs flag-o-matic user
  5. MY_PV=${PV//.}
  6. DESCRIPTION="The ultimate old-school single player dungeon exploration game"
  7. HOMEPAGE="http://www.nethack.org/"
  8. SRC_URI="mirror://sourceforge/nethack/${PN}-${MY_PV}-src.tgz"
  9. LICENSE="nethack"
  10. SLOT="0"
  11. KEYWORDS="~amd64 ~arm ~hppa ~ppc ~sparc ~x86 ~x86-fbsd"
  12. IUSE="experimental X"
  13. RDEPEND="sys-libs/ncurses:0=
  14. X? (
  15. x11-libs/libXaw
  16. x11-libs/libXpm
  17. x11-libs/libXt
  18. )"
  19. DEPEND="${RDEPEND}
  20. virtual/pkgconfig
  21. X? (
  22. x11-proto/xproto
  23. x11-apps/bdftopcf
  24. x11-apps/mkfontdir
  25. )"
  26. BINDIR="/usr/bin"
  27. STATEDIR="/var/games/${PN}"
  28. NETHACK_GROUP="gamestat"
  29. pkg_setup() {
  30. HACKDIR="/usr/$(get_libdir)/${PN}"
  31. enewgroup gamestat 36
  32. }
  33. src_prepare() {
  34. eapply "${FILESDIR}/${P}-recover.patch"
  35. eapply "${FILESDIR}/${P}-x11-color.patch"
  36. eapply_user
  37. cp "${FILESDIR}/${P}-hint-$(usex X x11 tty)" hint || die "Failed to copy hint file"
  38. sys/unix/setup.sh hint || die "Failed to run setup.sh"
  39. }
  40. src_compile() {
  41. append-cflags -I../include -DDLB -DSECURE -DLINUX -DTIMED_DELAY -DVISION_TABLES
  42. append-cflags '-DCOMPRESS=\"/bin/gzip\"' '-DCOMPRESS_EXTENSION=\".gz\"'
  43. append-cflags "-DHACKDIR=\\\"${HACKDIR}\\\"" "-DVAR_PLAYGROUND=\\\"${STATEDIR}\\\""
  44. append-cflags "-DDEF_PAGER=\\\"${PAGER}\\\""
  45. append-cflags -DSYSCF "-DSYSCF_FILE=\\\"/etc/nethack.sysconf\\\""
  46. use X && append-cflags -DX11_GRAPHICS -DUSE_XPM
  47. use experimental &&
  48. append-cflags -DSTATUS_VIA_WINDOWPORT -DSTATUS_HILITES -DSCORE_ON_BOTL
  49. makeopts=(
  50. CC="$(tc-getCC)" CFLAGS="${CFLAGS}" LFLAGS="${LDFLAGS}"
  51. WINTTYLIB="$($(tc-getPKG_CONFIG) --libs ncurses)"
  52. HACKDIR="${HACKDIR}" INSTDIR="${D}/${HACKDIR}"
  53. SHELLDIR="${D}/${BINDIR}" VARDIR="${D}/${STATEDIR}"
  54. )
  55. emake "${makeopts[@]}" nethack recover Guidebook spec_levs
  56. # Upstream still has some parallel compilation bugs
  57. emake -j1 "${makeopts[@]}" all
  58. }
  59. src_install() {
  60. emake "${makeopts[@]}" install
  61. exeinto "${BINDIR}"
  62. newexe util/recover recover-nethack
  63. rm "${D}/${HACKDIR}/recover" || die "Failed to remove HACKDIR/recover"
  64. doman doc/nethack.6
  65. newman doc/recover.6 recover-nethack.6
  66. dodoc doc/Guidebook.txt
  67. insinto /etc
  68. newins sys/unix/sysconf nethack.sysconf
  69. insinto /etc/skel
  70. newins "${FILESDIR}/${P}-nethackrc" .nethackrc
  71. if use X ; then
  72. cd "${S}/win/X11" || die "Failed to enter win/X11 directory"
  73. # copy nethack x application defaults
  74. insinto /etc/X11/app-defaults
  75. newins NetHack.ad NetHack
  76. rm "${D}/${HACKDIR}/NetHack.ad" || die "Failed to remove NetHack.ad"
  77. newicon nh_icon.xpm nethack.xpm
  78. make_desktop_entry ${PN} Nethack
  79. # install nethack fonts
  80. bdftopcf -o nh10.pcf nh10.bdf || die "Converting fonts failed"
  81. bdftopcf -o ibm.pcf ibm.bdf || die "Converting fonts failed"
  82. insinto "${HACKDIR}/fonts"
  83. doins *.pcf
  84. cd "${D}/${HACKDIR}/fonts" || die "Failed to enter fonts directory"
  85. mkfontdir || die "The action mkfontdir ${HACKDIR}/fonts failed"
  86. fi
  87. rm -r "${D}/${STATEDIR}" || die "Failed to clean STATEDIR"
  88. keepdir "${STATEDIR}/save"
  89. fowners -R "root:${NETHACK_GROUP}" "${STATEDIR}"
  90. fperms 770 "${STATEDIR}" "${STATEDIR}/save"
  91. fowners "root:${NETHACK_GROUP}" "${HACKDIR}/nethack"
  92. fperms g+s "${HACKDIR}/nethack"
  93. }
  94. pkg_postinst() {
  95. cd "${ROOT}/${STATEDIR}" || die "Failed to enter ${STATEDIR} directory"
  96. touch logfile perm record xlogfile || die "Failed to create log files"
  97. chown -R root:"${NETHACK_GROUP}" . &&
  98. chmod -R 660 . &&
  99. chmod 770 . save ||
  100. die "Adjustment of file permissions in ${ROOT}/${STATEDIR} failed"
  101. touch -c bones* save/* # non-critical
  102. elog "A minimal default .nethackrc has been placed in /etc/skel/"
  103. elog "The sysconf file is at /etc/nethack.sysconf"
  104. if has_version "<${CATEGORY}/${PN}-3.6.0" ; then
  105. elog
  106. elog "Nethack 3.6 includes many new features."
  107. elog "You might want to review your options and local patchset."
  108. elog "Have a look at http://www.nethack.org/v360/release.html"
  109. fi
  110. }