awstats-7.1_p20121017.ebuild 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=4
  4. inherit eutils
  5. MY_P=${PN}-${PV%_p*}
  6. DESCRIPTION="AWStats is short for Advanced Web Statistics"
  7. HOMEPAGE="http://www.awstats.org/"
  8. if [ ${MY_P} != ${P} ]; then
  9. SRC_URI="https://dev.gentoo.org/~flameeyes/awstats/${P}.tar.gz"
  10. # The following SRC_URI is useful only when fetching for the first time
  11. # after bump; upstream does not bump the version when they change it, so
  12. # we rename it to include the date and upload to our mirrors instead.
  13. #SRC_URI="http://www.awstats.org/files/${MY_P}.tar.gz -> ${P}.tar.gz"
  14. else
  15. SRC_URI="http://www.awstats.org/files/${P}.tar.gz"
  16. fi
  17. S=${WORKDIR}/${MY_P}
  18. LICENSE="GPL-2"
  19. KEYWORDS="~alpha amd64 hppa ppc ~sparc x86 ~x86-fbsd"
  20. IUSE="geoip ipv6"
  21. SLOT="0"
  22. RDEPEND=">=dev-lang/perl-5.6.1
  23. virtual/perl-Time-Local
  24. dev-perl/URI
  25. geoip? ( dev-perl/Geo-IP )
  26. ipv6? ( dev-perl/Net-IP dev-perl/Net-DNS )"
  27. DEPEND=""
  28. src_prepare() {
  29. epatch "${FILESDIR}"/${PN}-7.1-gentoo.diff
  30. # change default installation directory
  31. find . -type f -exec sed \
  32. -e "s#/usr/local/awstats/wwwroot#/usr/share/awstats/wwwroot#g" \
  33. -e '/PossibleLibDir/s:(.*):("/usr/share/awstats/wwwroot/cgi-bin/lib"):' \
  34. -i {} + || die "find/sed failed"
  35. # set default values for directories; use apache log as an example
  36. sed \
  37. -e "s|^\(LogFile=\).*$|\1\"/var/log/apache2/access_log\"|" \
  38. -e "s|^\(SiteDomain=\).*$|\1\"localhost\"|" \
  39. -e "s|^\(DirIcons=\).*$|\1\"/awstats/icon\"|" \
  40. -i "${S}"/wwwroot/cgi-bin/awstats.model.conf || die "sed failed"
  41. # enable plugins
  42. if use ipv6; then
  43. sed -e "s|^#\(LoadPlugin=\"ipv6\"\)$|\1|" \
  44. -i "${S}"/wwwroot/cgi-bin/awstats.model.conf || die "sed failed"
  45. fi
  46. if use geoip; then
  47. sed -e '/LoadPlugin="geoip /aLoadPlugin="geoip GEOIP_STANDARD /usr/share/GeoIP/GeoIP.dat"' \
  48. -i "${S}"/wwwroot/cgi-bin/awstats.model.conf || die "sed failed"
  49. fi
  50. find "${S}" '(' -type f -not -name '*.pl' ')' -exec chmod -x {} + || die
  51. }
  52. src_install() {
  53. dohtml -r docs/*
  54. dodoc README.TXT
  55. newdoc wwwroot/cgi-bin/plugins/example/example.pm example_plugin.pm
  56. dodoc -r tools/xslt
  57. keepdir /var/lib/awstats
  58. insinto /etc/awstats
  59. doins "${S}"/wwwroot/cgi-bin/awstats.model.conf
  60. # remove extra content that we don't want to install
  61. rm -r "${S}"/wwwroot/cgi-bin/awstats.model.conf \
  62. "${S}"/wwwroot/classes/src || die
  63. insinto /usr/share/awstats
  64. doins -r wwwroot
  65. chmod +x "${D}"/usr/share/awstats/wwwroot/cgi-bin/*.pl
  66. cd "${S}"/tools
  67. dobin awstats_buildstaticpages.pl awstats_exportlib.pl \
  68. awstats_updateall.pl
  69. newbin logresolvemerge.pl awstats_logresolvemerge.pl
  70. newbin maillogconvert.pl awstats_maillogconvert.pl
  71. newbin urlaliasbuilder.pl awstats_urlaliasbuilder.pl
  72. dosym ../share/awstats/wwwroot/cgi-bin/awstats.pl /usr/bin/awstats.pl || die
  73. }
  74. pkg_postinst() {
  75. elog "The AWStats-Manual is available either inside"
  76. elog "the /usr/share/doc/${PF} - folder, or at"
  77. elog "http://awstats.sourceforge.net/docs/index.html ."
  78. elog
  79. elog "Copy the /etc/awstats/awstats.model.conf to"
  80. elog "/etc/awstats/awstats.<yourdomain>.conf and edit it."
  81. elog ""
  82. ewarn "This ebuild does no longer use webapp-config to install"
  83. ewarn "instead you should point your configuration to the stable"
  84. ewarn "directory tree in the following path:"
  85. ewarn " /usr/share/awstats"
  86. }