/[gentoo-x86]/net-irc/rbot/rbot-9999-r8.ebuild
Gentoo

Contents of /net-irc/rbot/rbot-9999-r8.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Mon Jun 23 15:46:00 2008 UTC (10 years, 1 month ago) by flameeyes
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
FILE REMOVED
Install rbot without rubygems, don't build locale files if they are not requested, remove mandatory dep over ruby-gettext at both build and runtime.
(Portage version: 2.2_rc1/cvs/Linux 2.6.25-gentoo-r4 x86_64)

1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-irc/rbot/rbot-9999-r8.ebuild,v 1.3 2008/06/23 15:08:25 flameeyes Exp $
4
5 inherit ruby gems eutils
6
7 [[ ${PV} == "9999" ]] && inherit git
8
9 DESCRIPTION="rbot is a ruby IRC bot"
10 HOMEPAGE="http://ruby-rbot.org/"
11
12 LICENSE="as-is"
13 SLOT="0"
14 KEYWORDS=""
15 IUSE="spell aspell timezone translator shorturl nls dict figlet
16 fortune cal host"
17 ILINGUAS="zh ru nl de fr it en ja"
18
19 for lang in $ILINGUAS; do
20 IUSE="${IUSE} linguas_${lang}"
21 done
22
23 RDEPEND=">=virtual/ruby-1.8
24 dev-ruby/ruby-bdb
25 timezone? ( dev-ruby/tzinfo )
26 spell? (
27 aspell? ( app-text/aspell )
28 !aspell? ( app-text/ispell )
29 )
30 translator? ( dev-ruby/mechanize )
31 shorturl? ( dev-ruby/shorturl )
32 nls? ( dev-ruby/ruby-gettext )
33 dict? ( dev-ruby/ruby-dict )
34 figlet? ( app-misc/figlet )
35 fortune? ( games-misc/fortune-mod )
36 cal? ( || ( sys-apps/util-linux sys-freebsd/freebsd-ubin ) )
37 host? ( net-dns/bind-tools )"
38 DEPEND=""
39
40 if [[ ${PV} == "9999" ]]; then
41 SRC_URI=""
42 EGIT_REPO_URI="git://ruby-rbot.org/rbot.git"
43
44 DEPEND="${DEPEND}
45 dev-ruby/rake
46 app-arch/zip
47 dev-ruby/ruby-gettext"
48
49 IUSE="${IUSE} snapshot"
50 else
51 SRC_URI="http://www.linuxbrit.co.uk/downloads/${P}.gem"
52 fi
53
54 pkg_setup() {
55 enewuser rbot -1 -1 /var/lib/rbot nobody
56 }
57
58 src_unpack() {
59 [[ ${PV} == "9999" ]] || return 0
60 git_src_unpack
61
62 cd "${S}"
63 sed -i -e "/s.version =/s:'.\+':'9999':" Rakefile \
64 || die "Unable to fix Rakefile version."
65 sed -i -e '/\$version=/s:".\+":"'9999'":' bin/rbot \
66 || die "Unable to fix rbot script version."
67 }
68
69 src_compile() {
70 [[ ${PV} == "9999" ]] || return 0
71 rake makemo || die "locale generation failed"
72 rake || die "Gem generation failed"
73 }
74
75 src_install() {
76 if [[ ${PV} == "9999" ]]; then
77 GEM_SRC="${S}/pkg/rbot-9999.gem"
78 MY_P="${PN}-9999"
79 else
80 MY_P="${P}"
81 fi
82 gems_src_install
83
84 diropts -o rbot -g nobody -m 0700
85 keepdir /var/lib/rbot
86
87 newinitd "${FILESDIR}/rbot.init" rbot
88 newconfd "${FILESDIR}/rbot.conf" rbot
89
90 local rbot_datadir="${D}/${GEMSDIR}"/gems/${MY_P}/data/rbot
91
92 disable_rbot_plugin() {
93 mv "${rbot_datadir}"/plugins/$1.rb{,.disabled}
94 }
95
96 if ! use spell; then
97 disable_rbot_plugin spell || die "Unable to disable spell plugin"
98 elif use aspell; then
99 # This is not officially supported, but as ispell is quite a
100 # bad piece of code, at least give an opportunity to use
101 # something that works a bit better.
102 sed -i -e 's:ispell:ispell-aspell:' \
103 "${rbot_datadir}"/plugins/spell.rb \
104 || die "Unable to replace ispell with aspell."
105 fi
106
107 use timezone || disable_rbot_plugin time
108 use translator || disable_rbot_plugin translator
109 use shorturl || disable_rbot_plugin shortenurls
110 use dict || disable_rbot_plugin dictclient
111 use figlet || disable_rbot_plugin figlet
112 use fortune || disable_rbot_plugin fortune
113 use cal || disable_rbot_plugin cal
114 use host || disable_rbot_plugin host
115
116 # This is unfortunately pretty manual at the moment, but it's just
117 # to avoid having to run special scripts to package new versions
118 # of rbot. The default if new languages are added that are not
119 # considered for an opt-out here is to install them, so you just
120 # need to add them later.
121 strip-linguas ${ILINGUAS}
122 if [[ -n ${LINGUAS} ]]; then
123 # As the the language name used by the rbot data files does
124 # not correspond to the ISO codes we usually use for LINGUAS,
125 # the following list of local varables will work as a
126 # dictionary to get the name used by rbot from the ISO code.
127 local lang_rbot_zh="traditional_chinese"
128 local lang_rbot_ru="russian"
129 local lang_rbot_nl="dutch"
130 local lang_rbot_de="german"
131 local lang_rbot_fr="french"
132 local lang_rbot_it="italian"
133 local lang_rbot_en="english"
134 local lang_rbot_ja="japanese"
135
136 for lang in ${ILINGUAS}; do
137 use linguas_${lang} && continue
138
139 lang="lang_rbot_${lang}"
140 lang_rbot=${!lang}
141
142 rm \
143 ${rbot_datadir}/languages/${lang_rbot}.lang \
144 ${rbot_datadir}/templates/lart/larts-${lang_rbot} \
145 ${rbot_datadir}/templates/lart/praises-${lang_rbot} \
146 ${rbot_datadir}/templates/salut/salut-${lang_rbot}
147 done
148 fi
149 }
150
151 pkg_postinst() {
152 einfo
153 elog "rbot now can be started as a normal service."
154 elog "Check /etc/conf.d/rbot file for more information about this feature."
155 einfo
156 }

  ViewVC Help
Powered by ViewVC 1.1.20