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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Mon Dec 17 22:13:09 2007 UTC (10 years, 2 months ago) by flameeyes
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Add a new revision with USE flags for shorturl and translator plugins, with their dependencies added.
(Portage version: 2.1.4_rc10)

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

  ViewVC Help
Powered by ViewVC 1.1.20