sgt-puzzles-99999999.ebuild 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit eutils gnome2-utils toolchain-funcs autotools
  5. if [[ ${PV} == "99999999" ]] ; then
  6. inherit git-r3
  7. EGIT_REPO_URI="git://git.tartarus.org/simon/puzzles.git"
  8. GENTOO_ICONS="20160315"
  9. SRC_URI="https://dev.gentoo.org/~np-hardass/distfiles/${PN}/${PN}-icons-${GENTOO_ICONS}.tar.xz"
  10. KEYWORDS=""
  11. else
  12. MAGIC=1f613ba
  13. SRC_URI="http://www.chiark.greenend.org.uk/~sgtatham/puzzles/puzzles-${PV}.${MAGIC}.tar.gz"
  14. S=${WORKDIR}/puzzles-${PV}.${MAGIC}
  15. KEYWORDS="~amd64 ~x86"
  16. fi
  17. DESCRIPTION="Simon Tatham's Portable Puzzle Collection"
  18. HOMEPAGE="http://www.chiark.greenend.org.uk/~sgtatham/puzzles/"
  19. LICENSE="MIT"
  20. SLOT="0"
  21. IUSE="+doc gtk3"
  22. COMMON_DEPEND="
  23. !gtk3? ( x11-libs/gtk+:2 )
  24. gtk3? ( x11-libs/gtk+:3 )"
  25. RDEPEND="${COMMON_DEPEND}
  26. x11-misc/xdg-utils" # Used by builtin help patch
  27. DEPEND="${COMMON_DEPEND}
  28. dev-lang/perl
  29. virtual/pkgconfig
  30. doc? ( >=app-doc/halibut-1.0 )"
  31. PATCHES=( "${FILESDIR}/${PN}-20161207-builtin-help.patch" )
  32. src_unpack() {
  33. default
  34. if [[ ${PV} == "99999999" ]]; then
  35. git-r3_src_unpack
  36. fi
  37. }
  38. src_prepare() {
  39. default
  40. sed -i \
  41. -e 's/-O2 -Wall -Werror -ansi -pedantic -g//' \
  42. -e "s/libstr =/libstr = '\$(LDFLAGS) ' ./" \
  43. mkfiles.pl || die
  44. ./mkfiles.pl || die
  45. eautoreconf
  46. # Import icons from latest Gentoo tarball for live
  47. if [[ ${PV} == "99999999" ]]; then
  48. cp -R ../${PN}-icons/icons . || die
  49. fi
  50. }
  51. src_configure() {
  52. econf \
  53. --program-prefix="${PN}_" \
  54. --with-gtk=$(usex gtk3 3 2)
  55. }
  56. src_compile() {
  57. emake CC="$(tc-getCC)"
  58. if use doc ; then
  59. halibut --text --html --info --pdf --ps puzzles.but || die
  60. fi
  61. }
  62. src_install() {
  63. default
  64. local file name
  65. for file in *.R ; do
  66. [[ ${file} == "nullgame.R" ]] && continue
  67. name=$(awk -F: '/exe:/ { print $3 }' "${file}")
  68. file=${file%.R}
  69. newicon -s 48 icons/${file}-48d24.png ${PN}_${file}.png
  70. make_desktop_entry "${PN}_${file}" "${name}" "${PN}_${file}" "Game;LogicGame;${PN};"
  71. done
  72. if use doc ; then
  73. DOCS=( puzzles.{pdf,ps,txt} )
  74. HTML_DOCS=( *.html )
  75. einstalldocs
  76. doinfo puzzles.info{,-1,-2,-3}
  77. fi
  78. insinto /etc/xdg/menus/applications-merged
  79. doins "${FILESDIR}/${PN}.menu"
  80. insinto /usr/share/desktop-directories
  81. doins "${FILESDIR}/${PN}.directory"
  82. }
  83. pkg_preinst() {
  84. gnome2_icon_savelist
  85. }
  86. pkg_postinst() {
  87. gnome2_icon_cache_update
  88. }
  89. pkg_postrm() {
  90. gnome2_icon_cache_update
  91. }