summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-irc/rbot/rbot-9999-r9.ebuild')
-rw-r--r--net-irc/rbot/rbot-9999-r9.ebuild152
1 files changed, 152 insertions, 0 deletions
diff --git a/net-irc/rbot/rbot-9999-r9.ebuild b/net-irc/rbot/rbot-9999-r9.ebuild
new file mode 100644
index 000000000000..aca7a4e6f24c
--- /dev/null
+++ b/net-irc/rbot/rbot-9999-r9.ebuild
@@ -0,0 +1,152 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-irc/rbot/rbot-9999-r9.ebuild,v 1.1 2008/06/23 15:46:00 flameeyes Exp $
+
+inherit ruby eutils
+
+[[ ${PV} == "9999" ]] && inherit git
+
+DESCRIPTION="rbot is a ruby IRC bot"
+HOMEPAGE="http://ruby-rbot.org/"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS=""
+IUSE="spell aspell timezone translator shorturl nls dict figlet
+ fortune cal host nls"
+ILINGUAS="zh_CN zh_TW ru nl de fr it ja"
+
+for lang in $ILINGUAS; do
+ IUSE="${IUSE} linguas_${lang}"
+done
+
+RDEPEND=">=virtual/ruby-1.8
+ dev-ruby/ruby-bdb
+ timezone? ( dev-ruby/tzinfo )
+ spell? (
+ aspell? ( app-text/aspell )
+ !aspell? ( app-text/ispell )
+ )
+ translator? ( dev-ruby/mechanize )
+ shorturl? ( dev-ruby/shorturl )
+ nls? ( dev-ruby/ruby-gettext )
+ dict? ( dev-ruby/ruby-dict )
+ figlet? ( app-misc/figlet )
+ fortune? ( games-misc/fortune-mod )
+ cal? ( || ( sys-apps/util-linux sys-freebsd/freebsd-ubin ) )
+ host? ( net-dns/bind-tools )
+ nls? ( dev-ruby/ruby-gettext )"
+DEPEND="nls? ( dev-ruby/ruby-gettext )"
+
+if [[ ${PV} == "9999" ]]; then
+ SRC_URI=""
+ EGIT_REPO_URI="git://ruby-rbot.org/rbot.git"
+else
+ # wait for the new releases...
+ SRC_URI=""
+fi
+
+pkg_setup() {
+ enewuser rbot -1 -1 /var/lib/rbot nobody
+}
+
+src_unpack() {
+ [[ ${PV} == "9999" ]] || return 0
+ git_src_unpack
+
+ cd "${S}"
+ sed -i -e "/s.version =/s:'.\+':'9999':" Rakefile \
+ || die "Unable to fix Rakefile version."
+ sed -i -e '/\$version=/s:".\+":"'9999'":' bin/rbot \
+ || die "Unable to fix rbot script version."
+}
+
+src_compile() {
+ disable_rbot_plugin() {
+ mv "${S}"/data/rbot/plugins/$1.rb{,.disabled}
+ }
+ use_rbot_plugin() {
+ use $1 && return
+ disable_rbot_plugin "$2"
+ }
+
+ if ! use spell; then
+ disable_rbot_plugin spell || die "Unable to disable spell plugin"
+ elif use aspell; then
+ # This is not officially supported, but as ispell is quite a
+ # bad piece of code, at least give an opportunity to use
+ # something that works a bit better.
+ sed -i -e 's:ispell:ispell-aspell:' \
+ "${S}"/data/rbot/plugins/spell.rb \
+ || die "Unable to replace ispell with aspell."
+ fi
+
+ use_rbot_plugin timezone time
+ use_rbot_plugin translator translator
+ use_rbot_plugin shorturl shortenurls
+ use_rbot_plugin dict dictclient
+ use_rbot_plugin figlet figlet
+ use_rbot_plugin fortune fortune
+ use_rbot_plugin cal cal
+ use_rbot_plugin host host
+
+ local rbot_datadir="${D}"/usr/share/rbot
+
+ # This is unfortunately pretty manual at the moment, but it's just
+ # to avoid having to run special scripts to package new versions
+ # of rbot. The default if new languages are added that are not
+ # considered for an opt-out here is to install them, so you just
+ # need to add them later.
+ if use nls; then
+ strip-linguas ${ILINGUAS}
+ if [[ -n ${LINGUAS} ]]; then
+ # As the the language name used by the rbot data files does
+ # not correspond to the ISO codes we usually use for LINGUAS,
+ # the following list of local varables will work as a
+ # dictionary to get the name used by rbot from the ISO code.
+ local lang_rbot_zh_CN="traditional_chinese"
+ local lang_rbot_ru="russian"
+ local lang_rbot_nl="dutch"
+ local lang_rbot_de="german"
+ local lang_rbot_fr="french"
+ local lang_rbot_it="italian"
+ local lang_rbot_ja="japanese"
+
+ for lang in ${ILINGUAS}; do
+ use linguas_${lang} && continue
+
+ lang_varname="lang_rbot_${lang}"
+ lang_rbot=${!lang_varname}
+
+ rm -r \
+ "${S}"/data/rbot/languages/${lang_rbot}.lang \
+ "${S}"/data/rbot/templates/lart/larts-${lang_rbot} \
+ "${S}"/data/rbot/templates/lart/praises-${lang_rbot} \
+ "${S}"/data/rbot/templates/salut/salut-${lang_rbot} \
+ "${S}"/po/${lang}
+ done
+ fi
+
+ rake makemo || die "locale generation failed"
+ fi
+
+ ruby_econf || die "ruby_econf failed"
+}
+
+src_install() {
+ ${RUBY} setup.rb install --prefix="${D}" \
+ || die "setup.rb install failed"
+
+ diropts -o rbot -g nobody -m 0700
+ keepdir /var/lib/rbot
+
+ newinitd "${FILESDIR}/rbot.init" rbot
+ newconfd "${FILESDIR}/rbot.conf" rbot
+}
+
+pkg_postinst() {
+ einfo
+ elog "rbot now can be started as a normal service."
+ elog "Check /etc/conf.d/rbot file for more information about this feature."
+ einfo
+}