geolizer-2.01.10_p20070115-r1.ebuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. # Copyright 1999-2012 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # uses webapp.eclass to create directories with right permissions
  4. # probably slight overkill but works well
  5. EAPI="2"
  6. inherit versionator confutils eutils webapp db-use autotools
  7. WEBAPP_MANUAL_SLOT="yes"
  8. MY_PV="$(get_version_component_range 1-2)-$(get_version_component_range 3)"
  9. WEBALIZER_P="webalizer-${MY_PV}"
  10. GEOLIZER_P="${PN}_${MY_PV}-patch.${PV/*_p/}"
  11. DESCRIPTION="Webserver log file analyzer"
  12. HOMEPAGE="http://sysd.org/stas/node/10"
  13. SRC_URI="ftp://ftp.mrunix.net/pub/webalizer/old/${WEBALIZER_P}-src.tar.bz2
  14. http://sysd.org/stas/files/active/0/${GEOLIZER_P}.tar.gz
  15. mirror://gentoo/webalizer.conf.gz"
  16. LICENSE="GPL-2"
  17. KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
  18. IUSE="nls"
  19. SLOT="0"
  20. DEPEND=">=sys-libs/db-4.2
  21. >=sys-libs/zlib-1.1.4
  22. >=media-libs/libpng-1.2
  23. >=media-libs/gd-1.8.3
  24. dev-libs/geoip"
  25. S="${WORKDIR}"/${WEBALIZER_P}
  26. pkg_setup() {
  27. webapp_pkg_setup
  28. confutils_require_built_with_all media-libs/gd png
  29. # USE=nls has no real meaning if LINGUAS isn't set
  30. if use nls && [[ -z "${LINGUAS}" ]]; then
  31. ewarn "you must set LINGUAS in /etc/make.conf"
  32. ewarn "if you want to USE=nls"
  33. die "please either set LINGUAS or do not use nls"
  34. fi
  35. }
  36. src_prepare() {
  37. epatch "${WORKDIR}"/${PN}_${MY_PV}-patch/${PN}.patch \
  38. "${FILESDIR}"/${P}-etc-geolizer-conf.patch \
  39. "${FILESDIR}"/${P}-strip.patch
  40. sed -i configure.in -e 's|libGeoIP.a|libGeoIP.so|g' || die
  41. eautoreconf
  42. }
  43. src_configure() {
  44. # really dirty hack; necessary due to a really gross ./configure
  45. # basically, it just sets the natural language the program uses
  46. # unfortunatly, this program only allows for one lang, so only the first
  47. # entry in LINGUAS is used
  48. if use nls; then
  49. local longlang="$(grep ^${LINGUAS:0:2} "${FILESDIR}"/geolizer-language-list.txt)"
  50. local myconf="${myconf} --with-language=${longlang:3}"
  51. else
  52. local myconf="${myconf} --with-language=english"
  53. fi
  54. econf --enable-dns \
  55. --with-db=$(db_includedir) \
  56. --with-dblib=$(db_libname) \
  57. ${myconf} \
  58. || die "econf failed"
  59. }
  60. src_install() {
  61. webapp_src_preinst
  62. newbin webalizer geolizer
  63. fperms 755 /usr/bin/geolizer
  64. dosym geolizer /usr/bin/geozolver || die 'dosym failed'
  65. newman webalizer.1 geolizer.1 || die 'newman failed'
  66. insinto /etc
  67. newins "${WORKDIR}"/webalizer.conf geolizer.conf || die 'doins failed'
  68. dosed "s/apache/apache2/g" /etc/geolizer.conf || die 'dosed failed'
  69. dodoc CHANGES *README* INSTALL sample.conf "${FILESDIR}"/apache.geolizer || die 'dodoc failed'
  70. webapp_src_install
  71. }
  72. pkg_postinst() {
  73. elog
  74. elog "It is suggested that you restart apache before using geolizer"
  75. elog "You may want to review /etc/geolizer.conf and ensure that"
  76. elog "OutputDir is set correctly"
  77. elog
  78. elog "Then just type geolizer to generate your stats."
  79. elog "You can also use cron to generate them e.g. every day."
  80. elog "They can be accessed via http://localhost/geolizer"
  81. elog
  82. elog "A sample Apache config file has been installed into"
  83. elog "/usr/share/doc/${PF}/apache.geolizer"
  84. elog "Please edit and install it as necessary"
  85. elog
  86. if [[ ${#LINGUAS} -gt 2 ]] && use nls; then
  87. ewarn
  88. ewarn "You have more than one language in LINGUAS"
  89. ewarn "Due to the limitations of this packge, it was built"
  90. ewarn "only with ${LINGUAS:0:2} support. If this is not what"
  91. ewarn "you intended, please place the language you desire"
  92. ewarn "_first_ in the list of LINGUAS in /etc/make.conf"
  93. ewarn
  94. fi
  95. webapp_pkg_postinst
  96. }