| 1 |
# Copyright 1999-2013 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/net-irc/rbot/rbot-0.9.15.ebuild,v 1.7 2012/06/01 03:58:21 zmedico Exp $ |
| 4 |
|
| 5 |
EAPI="2" |
| 6 |
# ruby19 needs ruby-gettext on 19 first |
| 7 |
USE_RUBY="ruby18" |
| 8 |
|
| 9 |
inherit ruby-ng eutils user |
| 10 |
|
| 11 |
DESCRIPTION="rbot is a ruby IRC bot" |
| 12 |
HOMEPAGE="http://ruby-rbot.org/" |
| 13 |
SRC_URI="http://ruby-rbot.org/download/${P}.tgz" |
| 14 |
|
| 15 |
LICENSE="|| ( feh GPL-2 )" |
| 16 |
SLOT="0" |
| 17 |
KEYWORDS="~amd64 ~ppc x86 ~x86-fbsd" |
| 18 |
IUSE="spell aspell timezone translator shorturl nls dict figlet |
| 19 |
fortune cal host toilet" |
| 20 |
ILINGUAS="zh_CN zh_TW ru nl de fi fr it ja" |
| 21 |
|
| 22 |
for lang in $ILINGUAS; do |
| 23 |
IUSE="${IUSE} linguas_${lang}" |
| 24 |
done |
| 25 |
|
| 26 |
RDEPEND=" |
| 27 |
spell? ( |
| 28 |
aspell? ( app-text/aspell ) |
| 29 |
!aspell? ( app-text/hunspell ) |
| 30 |
) |
| 31 |
figlet? ( app-misc/figlet ) |
| 32 |
toilet? ( app-misc/toilet ) |
| 33 |
fortune? ( games-misc/fortune-mod ) |
| 34 |
cal? ( || ( sys-apps/util-linux sys-freebsd/freebsd-ubin ) ) |
| 35 |
host? ( net-dns/bind-tools )" |
| 36 |
|
| 37 |
ruby_add_rdepend " |
| 38 |
dev-ruby/ruby-bdb |
| 39 |
timezone? ( dev-ruby/tzinfo ) |
| 40 |
translator? ( dev-ruby/mechanize ) |
| 41 |
shorturl? ( dev-ruby/shorturl ) |
| 42 |
nls? ( dev-ruby/ruby-gettext >=dev-ruby/locale-2.0.5-r2 ) |
| 43 |
dict? ( dev-ruby/ruby-dict )" |
| 44 |
|
| 45 |
# gettext does not yet work on 1.9, so generate locales on 1.8 |
| 46 |
DEPEND=" |
| 47 |
nls? ( |
| 48 |
>=dev-ruby/ruby-gettext-2[ruby_targets_ruby18] |
| 49 |
dev-ruby/rake[ruby_targets_ruby18] |
| 50 |
)" |
| 51 |
|
| 52 |
pkg_setup() { |
| 53 |
enewuser rbot -1 -1 /var/lib/rbot nobody |
| 54 |
} |
| 55 |
|
| 56 |
all_ruby_compile() { |
| 57 |
disable_rbot_plugin() { |
| 58 |
mv "${S}"/data/rbot/plugins/$1.rb{,.disabled} |
| 59 |
} |
| 60 |
use_rbot_plugin() { |
| 61 |
use $1 && return |
| 62 |
disable_rbot_plugin "$2" |
| 63 |
} |
| 64 |
rbot_conf() { |
| 65 |
echo "$1: $2" >> "${T}"/rbot.conf |
| 66 |
} |
| 67 |
use_rbot_conf_path() { |
| 68 |
use "$1" \ |
| 69 |
&& rbot_conf "$2" "$3" \ |
| 70 |
|| rbot_conf "$2" /bin/false |
| 71 |
} |
| 72 |
|
| 73 |
local spell_program="/usr/bin/hunspell -i" |
| 74 |
if use !spell; then |
| 75 |
disable_rbot_plugin spell |
| 76 |
spell_program="/bin/false" |
| 77 |
elif use aspell; then |
| 78 |
spell_program="/usr/bin/ispell-aspell" |
| 79 |
fi |
| 80 |
|
| 81 |
rbot_conf spell.program "${spell_program}" |
| 82 |
|
| 83 |
if use !figlet && use !toilet; then |
| 84 |
disable_rbot_plugin figlet |
| 85 |
fi |
| 86 |
|
| 87 |
use_rbot_conf_path figlet figlet.path /usr/bin/figlet |
| 88 |
use_rbot_conf_path toilet toilet.path /usr/bin/toilet |
| 89 |
|
| 90 |
use_rbot_plugin timezone time |
| 91 |
use_rbot_plugin translator translator |
| 92 |
use_rbot_plugin shorturl shortenurls |
| 93 |
use_rbot_plugin dict dictclient |
| 94 |
|
| 95 |
use_rbot_plugin fortune fortune |
| 96 |
use_rbot_conf_path fortune fortune.path /usr/bin/fortune |
| 97 |
|
| 98 |
use_rbot_plugin cal cal |
| 99 |
use_rbot_conf_path cal cal.path /usr/bin/cal |
| 100 |
|
| 101 |
use_rbot_plugin host host |
| 102 |
use_rbot_conf_path host host.path /usr/bin/host |
| 103 |
|
| 104 |
local rbot_datadir="${D}"/usr/share/rbot |
| 105 |
|
| 106 |
# This is unfortunately pretty manual at the moment, but it's just |
| 107 |
# to avoid having to run special scripts to package new versions |
| 108 |
# of rbot. The default if new languages are added that are not |
| 109 |
# considered for an opt-out here is to install them, so you just |
| 110 |
# need to add them later. |
| 111 |
if use nls; then |
| 112 |
strip-linguas ${ILINGUAS} |
| 113 |
if [[ -n ${LINGUAS} ]]; then |
| 114 |
# As the the language name used by the rbot data files does |
| 115 |
# not correspond to the ISO codes we usually use for LINGUAS, |
| 116 |
# the following list of local varables will work as a |
| 117 |
# dictionary to get the name used by rbot from the ISO code. |
| 118 |
local lang_rbot_zh_CN="traditional_chinese" |
| 119 |
local lang_rbot_ru="russian" |
| 120 |
local lang_rbot_nl="dutch" |
| 121 |
local lang_rbot_de="german" |
| 122 |
local lang_rbot_fi="finnish" |
| 123 |
local lang_rbot_fr="french" |
| 124 |
local lang_rbot_it="italian" |
| 125 |
local lang_rbot_ja="japanese" |
| 126 |
|
| 127 |
for lang in ${ILINGUAS}; do |
| 128 |
use linguas_${lang} && continue |
| 129 |
|
| 130 |
lang_varname="lang_rbot_${lang}" |
| 131 |
lang_rbot=${!lang_varname} |
| 132 |
|
| 133 |
rm -r \ |
| 134 |
"${S}"/data/rbot/languages/${lang_rbot}.lang \ |
| 135 |
"${S}"/data/rbot/templates/lart/larts-${lang_rbot} \ |
| 136 |
"${S}"/data/rbot/templates/lart/praises-${lang_rbot} \ |
| 137 |
"${S}"/data/rbot/templates/salut/salut-${lang_rbot} \ |
| 138 |
"${S}"/po/${lang} &>/dev/null |
| 139 |
done |
| 140 |
fi |
| 141 |
|
| 142 |
ruby18 /usr/bin/rake makemo || die "locale generation failed" |
| 143 |
fi |
| 144 |
} |
| 145 |
|
| 146 |
each_ruby_compile() { |
| 147 |
${RUBY} setup.rb config --prefix="/usr" \ |
| 148 |
|| die "setup.rb install failed" |
| 149 |
} |
| 150 |
|
| 151 |
each_ruby_install() { |
| 152 |
${RUBY} setup.rb install --prefix="${D}" \ |
| 153 |
|| die "setup.rb install failed" |
| 154 |
} |
| 155 |
|
| 156 |
all_ruby_install() { |
| 157 |
diropts -o rbot -g nobody -m 0700 |
| 158 |
keepdir /var/lib/rbot |
| 159 |
|
| 160 |
insinto /etc |
| 161 |
doins "${T}"/rbot.conf |
| 162 |
|
| 163 |
newinitd "${FILESDIR}/rbot.init2" rbot |
| 164 |
newconfd "${FILESDIR}/rbot.conf2" rbot |
| 165 |
} |
| 166 |
|
| 167 |
pkg_postinst() { |
| 168 |
einfo |
| 169 |
elog "rbot can be started as a normal service." |
| 170 |
elog "Check /etc/conf.d/rbot file for more information about this feature." |
| 171 |
einfo |
| 172 |
} |