/[gentoo-x86]/eclass/ruby.eclass
Gentoo

Contents of /eclass/ruby.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (show annotations) (download)
Sun Nov 16 21:36:33 2003 UTC (14 years, 8 months ago) by usata
Branch: MAIN
Changes since 1.15: +5 -5 lines
Pass RUBY as an argument to erubymake when USE_RUBY is specified

1 # Copyright 1999-2003 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /home/cvsroot/gentoo-x86/eclass/ruby.eclass,v 1.15 2003/11/16 19:27:24 usata Exp $
4 #
5 # Author: Mamoru KOMACHI <usata@gentoo.org>
6 #
7 # The ruby eclass is designed to allow easier installation of ruby
8 # softwares, and their incorporation into the Gentoo Linux system.
9
10 # src_unpack, src_compile and src_install call a set of functions to emerge
11 # ruby with SLOT support; econf, emake and einstall is a wrapper for ruby
12 # to automate configuration, make and install process (they override default
13 # econf, emake and einstall defined by ebuild.sh respectively).
14
15 # Variables:
16 # USE_RUBY Space delimited list of supported ruby.
17 # Set it to "any" if it installs only version independent files.
18 # If your ebuild supports both ruby 1.6 and 1.8 but has version
19 # depenedent files such as libraries, set it to something like
20 # "ruby16 ruby18". Possible values are "any ruby16 shim18 ruby18"
21 # Note: USE_RUBY="shim18" doesn't take any effect at the moment.
22 # WITH_RUBY Contains space delimited list of installed ruby which is
23 # supported (supported ruby should be specified in USE_RUBY).
24 # It is automatically defined if your ebuild set DEPEND list
25 # correctly, so usually you shouldn't set this variable by hand.
26 # EXTRA_ECONF You can pass extra arguments to econf by defining this
27 # variable. Note that you cannot specify them by command line
28 # if you are using <sys-apps/portage-2.0.49-r17.
29
30 ECLASS=ruby
31 INHERITED="${INHERITED} ${ECLASS}"
32 EXPORT_FUNCTIONS erubyconf erubymake erubyinstall erubydoc \
33 src_unpack econf emake src_compile einstall src_install
34
35 HOMEPAGE="http://raa.ruby-lang.org/list.rhtml?name=${PN}"
36 SRC_URI="mirror://gentoo/${P}.tar.gz"
37
38 SLOT="0"
39 LICENSE="Ruby"
40
41 newdepend ">=dev-lang/ruby-1.6.8"
42 if has_version '=dev-lang/ruby-1.6*' && [[ "${USE_RUBY/ruby16/}" != "${USE_RUBY}" ]] ; then
43 WITH_RUBY="${WITH_RUBY} ruby16"
44 fi
45 if has_version '=dev-lang/ruby-1.8*' && [[ "${USE_RUBY/ruby18/}" != "${USE_RUBY}" ]] ; then
46 WITH_RUBY="${WITH_RUBY} ruby18"
47 fi
48 if has_version '=dev-lang/ruby-1.6*' && has_version '=dev-lang/ruby-1.8*' \
49 && [[ "${USE_RUBY/any/}" != "${USE_RUBY}" ]] ; then
50 WITH_RUBY="${WITH_RUBY} any"
51 fi
52
53 ruby_src_unpack() {
54 if [[ "${WITH_RUBY/ruby16/}" != "${WITH_RUBY}" && "${WITH_RUBY/ruby18/}" != "${WITH_RUBY}" ]] ; then
55 mkdir -p ${S}/{1.6,1.8}
56 cd ${S}/1.6; unpack ${A}; cd -
57 cd ${S}/1.8; unpack ${A}; cd -
58 else
59 unpack ${A}
60 fi
61 }
62
63 erubyconf() {
64 local RUBY
65 if [ "$1" = ruby16 ] ; then
66 RUBY=ruby16
67 elif [ "$1" = ruby18 ] ; then
68 RUBY=ruby18
69 else
70 RUBY=ruby
71 fi
72 shift
73
74 if [ -f configure ] ; then
75 ./configure \
76 --prefix=/usr \
77 --host=${CHOST} \
78 --mandir=/usr/share/man \
79 --infodir=/usr/share/info \
80 --datadir=/usr/share \
81 --sysconfdir=/etc \
82 --localstatedir=/var/lib \
83 --with-ruby=${RUBY} \
84 ${EXTRA_ECONF} \
85 $@ || die "econf failed"
86 fi
87 if [ -f install.rb ] ; then
88 ${RUBY} install.rb config --prefix=/usr $@ \
89 || die "install.rb config failed"
90 ${RUBY} install.rb setup $@ \
91 || die "install.rb setup failed"
92 fi
93 if [ -f extconf.rb ] ; then
94 ${RUBY} extconf.rb $@ || die "extconf.rb failed"
95 fi
96 }
97
98 ruby_econf() {
99 if [[ "${WITH_RUBY/ruby16/}" != "${WITH_RUBY}" && "${WITH_RUBY/ruby18/}" != "${WITH_RUBY}" ]] ; then
100 einfo "running econf for ruby 1.6 ;)"
101 cd 1.6/${S#${WORKDIR}}
102 erubyconf ruby16 $@ || die
103 cd -
104 einfo "running econf for ruby 1.8 ;)"
105 cd 1.8/${S#${WORKDIR}}
106 erubyconf ruby18 $@ || die
107 cd -
108 elif [[ "${WITH_RUBY/ruby16/}" != "${WITH_RUBY}" ]] ; then
109 einfo "running econf for ruby 1.6 ;)"
110 erubyconf ruby16 $@ || die
111 elif [[ "${WITH_RUBY/ruby18/}" != "${WITH_RUBY}" ]] ; then
112 einfo "running econf for ruby 1.8 ;)"
113 erubyconf ruby18 $@ || die
114 else
115 einfo "running econf for ruby ;)"
116 erubyconf ruby $@ || die
117 fi
118 }
119
120 erubymake() {
121 if [ -f makefiles -o -f GNUmakefile -o -f makefile -o -f Makefile ] ; then
122 make $@ || die "emake for ruby failed"
123 fi
124 }
125
126 ruby_emake() {
127 if [[ "${WITH_RUBY/ruby16/}" != "${WITH_RUBY}" && "${WITH_RUBY/ruby18/}" != "${WITH_RUBY}" ]] ; then
128 einfo "running emake for ruby 1.6 ;)"
129 cd 1.6/${S#${WORKDIR}}
130 erubymake $@ || die
131 cd -
132 einfo "running emake for ruby 1.8 ;)"
133 cd 1.8/${S#${WORKDIR}}
134 erubymake $@ || die
135 cd -
136 elif [[ "${WITH_RUBY/ruby16/}" != "${WITH_RUBY}" ]] ; then
137 einfo "running emake for ruby 1.6 ;)"
138 [[ -x /usr/bin/ruby16 ]] && RUBY=ruby16 || RUBY=ruby
139 erubymake RUBY=${RUBY} $@
140 elif [[ "${WITH_RUBY/ruby18/}" != "${WITH_RUBY}" ]] ; then
141 einfo "running emake for ruby 1.8 ;)"
142 [[ -x /usr/bin/ruby18 ]] && RUBY=ruby18 || RUBY=ruby
143 erubymake RUBY=${RUBY} $@
144 else
145 einfo "running emake for ruby ;)"
146 erubymake $@ || die
147 fi
148 }
149
150 ruby_src_compile() {
151
152 ruby_econf || die
153 ruby_emake $@ || die
154 }
155
156 erubyinstall() {
157 local RUBY siteruby
158 if [ "$1" = ruby16 -a -x /usr/bin/ruby16 ] ; then
159 RUBY=ruby16
160 elif [ "$1" = ruby18 -a -x /usr/bin/ruby18 ] ; then
161 RUBY=ruby18
162 else
163 RUBY=ruby
164 fi
165 shift
166
167 if [ -f install.rb ] ; then
168 ${RUBY} install.rb config --prefix=${D}/usr $@ \
169 || die "install.rb config failed"
170 ${RUBY} install.rb install $@ \
171 || die "install.rb install failed"
172 elif [ -f extconf.rb -o -f Makefile ] ; then
173 make DESTDIR=${D} $@ install || die "make install failed"
174 else
175 if [[ "${WITH_RUBY/ruby16/}" != "${WITH_RUBY}" && "${WITH_RUBY/ruby18/}" != "${WITH_RUBY}" ]] ; then
176 siteruby=$(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitelibdir"]')
177 else
178 siteruby=$(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitedir"]')
179 fi
180 insinto ${siteruby}
181 doins *.rb || "doins failed"
182 fi
183 }
184
185 ruby_einstall() {
186
187 local siteruby=$(ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]')
188
189 if [[ "${WITH_RUBY/ruby16/}" != "${WITH_RUBY}" && "${WITH_RUBY/ruby18/}" != "${WITH_RUBY}" ]] ; then
190 einfo "running einstall for ruby 1.6 ;)"
191 MY_S=${S}/1.6/${S#${WORKDIR}}
192 cd ${MY_S}
193 erubyinstall ruby16 $@
194 einfo "running einstall for ruby 1.8 ;)"
195 MY_S=${S}/1.8/${S#${WORKDIR}}
196 cd ${MY_S}
197 erubyinstall ruby18 $@
198 S=${MY_S}
199 #cd -
200 elif [[ "${WITH_RUBY/ruby16/}" != "${WITH_RUBY}" ]] ; then
201 einfo "running einstall for ruby 1.6 ;)"
202 erubyinstall ruby16 $@
203 elif [[ "${WITH_RUBY/ruby18/}" != "${WITH_RUBY}" ]] ; then
204 einfo "running einstall for ruby 1.8 ;)"
205 erubyinstall ruby18 $@
206 elif [[ "${WITH_RUBY/any/}" != "${WITH_RUBY}" ]] ; then
207 if [ -n "`use ruby18`" ] ; then
208 erubyinstall ruby18 $@
209 if [ -d ${D}${siteruby}/../1.8 ] ; then
210 cd ${D}${siteruby}/../1.8
211 dodir ${siteruby}/../1.6
212 for x in * ; do
213 ln -s ../1.8/$x ../1.6/$x
214 done
215 cd -
216 fi
217 else
218 erubyinstall ruby16 $@
219 if [ -d ${D}${siteruby}/../1.6 ] ; then
220 cd ${D}${siteruby}/../1.6
221 dodir ${siteruby}/../1.8
222 for x in * ; do
223 ln -s ../1.6/$x ../1.8/$x
224 done
225 cd -
226 fi
227 fi
228 erubyinstall
229 else
230 einfo "running einstall for ruby ;)"
231 erubyinstall ruby $@
232 fi
233 }
234
235 erubydoc() {
236 local rdbase=/usr/share/doc/${PF}/rd rdfiles=$(find . -name '*.rd*')
237
238 einfo "running dodoc for ruby ;)"
239
240 insinto ${rdbase}
241 [ -n "${rdfiles}" ] && doins ${rdfiles}
242 rmdir --ignore-fail-on-non-empty ${D}${rdbase}
243 if [ -d doc -o -d docs -o examples ] ; then
244 dohtml -r doc/* docs/* examples/*
245 else
246 dohtml -r *
247 fi
248 if [ -d sample ] ; then
249 dodir /usr/share/doc/${PF}
250 cp -a sample ${D}/usr/share/doc/${PF} || "cp failed"
251 fi
252 for i in ChangeLog* [A-Z][A-Z]* ; do
253 [ -e $i ] && dodoc $i
254 done
255 }
256
257 ruby_src_install() {
258
259 ruby_einstall $@ || die
260
261 erubydoc
262 }

  ViewVC Help
Powered by ViewVC 1.1.20