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

Contents of /eclass/ruby.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations) (download)
Sun Oct 19 16:08:20 2003 UTC (14 years, 11 months ago) by usata
Branch: MAIN
Changes since 1.8: +63 -40 lines
Added ruby_econf and ruby_emake functions

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.8 2003/10/12 21:22:48 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 ECLASS=ruby
11 INHERITED="${INHERITED} ${ECLASS}"
12 EXPORT_FUNCTIONS erubyconf erubymake erubyinstall erubydoc \
13 src_unpack econf emake src_compile einstall src_install
14
15 HOMEPAGE="http://raa.ruby-lang.org/list.rhtml?name=${PN}"
16 SRC_URI="mirror://gentoo/${P}.tar.gz"
17
18 SLOT="0"
19 LICENSE="Ruby"
20
21 newdepend ">=dev-lang/ruby-1.6.8"
22 if has_version '=dev-lang/ruby-1.6*' ; then
23 USE_RUBY_1_6=1
24 fi
25 if has_version '=dev-lang/ruby-1.8*' ; then
26 USE_RUBY_1_8=1
27 fi
28
29 ruby_src_unpack() {
30 if [ "${USE_RUBY_1_6}" -a "${USE_RUBY_1_8}" ] && \
31 [ ! "${WANT_RUBY_1_6}" -a ! "${WANT_RUBY_1_8}" ] ; then
32 mkdir -p ${S}/{1.6,1.8}
33 cd ${S}/1.6; unpack ${A}; cd -
34 cd ${S}/1.8; unpack ${A}; cd -
35 else
36 unpack ${A}
37 fi
38 }
39
40 erubyconf() {
41 local RUBY
42 if [ "$1" = ruby16 ] ; then
43 RUBY=ruby16
44 elif [ "$1" = ruby18 ] ; then
45 RUBY=ruby18
46 else
47 RUBY=ruby
48 fi
49 shift
50
51 if [ -f extconf.rb ] ; then
52 ${RUBY} extconf.rb $@ || die "extconf.rb failed"
53 elif [ -f install.rb ] ; then
54 ${RUBY} install.rb config --prefix=/usr $@ \
55 || die "install.rb config failed"
56 ${RUBY} install.rb setup $@ \
57 || die "install.rb setup failed"
58 elif [ -f configure ] ; then
59 econf --with-ruby=${RUBY} $@ || die "econf failed"
60 fi
61 }
62
63 ruby_econf() {
64 if [ "${USE_RUBY_1_6}" -a "${USE_RUBY_1_8}" ] && \
65 [ ! "${WANT_RUBY_1_6}" -a ! "${WANT_RUBY_1_8}" ] ; then
66 einfo "running econf for ruby 1.6 ;)"
67 cd 1.6/${S#${WORKDIR}}
68 erubyconf ruby16 $@ || die
69 cd -
70 einfo "running econf for ruby 1.8 ;)"
71 cd 1.8/${S#${WORKDIR}}
72 erubyconf ruby18 $@ || die
73 cd -
74 else
75 einfo "running econf for ruby ;)"
76 erubyconf ruby $@ || die
77 fi
78 }
79
80 erubymake() {
81 if [ -f makefiles -o -f GNUmakefile -o -f makefile -o -f Makefile ] ; then
82 make $@ || die "emake for ruby failed"
83 fi
84 }
85
86 ruby_emake() {
87 if [ "${USE_RUBY_1_6}" -a "${USE_RUBY_1_8}" ] && \
88 [ ! "${WANT_RUBY_1_6}" -a ! "${WANT_RUBY_1_8}" ] ; then
89 einfo "running emake for ruby 1.6 ;)"
90 cd 1.6/${S#${WORKDIR}}
91 erubymake $@ || die
92 cd -
93 einfo "running emake for ruby 1.8 ;)"
94 cd 1.8/${S#${WORKDIR}}
95 erubymake $@ || die
96 cd -
97 else
98 einfo "running emake for ruby ;)"
99 erubymake $@ || die
100 fi
101 }
102
103 ruby_src_compile() {
104
105 ruby_econf || die
106 ruby_emake $@ || die
107 }
108
109 erubyinstall() {
110 local RUBY siteruby
111 if [ "$1" = ruby16 ] ; then
112 RUBY=ruby16
113 elif [ "$1" = ruby18 ] ; then
114 RUBY=ruby18
115 else
116 RUBY=ruby
117 fi
118 shift
119
120 if [ -f install.rb ] ; then
121 ${RUBY} install.rb config --prefix=${D}/usr $@ \
122 || die "install.rb config failed"
123 ${RUBY} install.rb install $@ \
124 || die "install.rb install failed"
125 elif [ -f extconf.rb -o -f Makefile ] ; then
126 make DESTDIR=${D} $@ install || die "make install failed"
127 else
128 if [ "${WANT_RUBY_1_6}" -o "${WANT_RUBY_1_8}" ] ; then
129 siteruby=$(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitelibdir"]')
130 else
131 siteruby=$(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitedir"]')
132 fi
133 insinto ${siteruby}
134 doins *.rb || "doins failed"
135 fi
136 }
137
138 ruby_einstall() {
139
140 if [ "${USE_RUBY_1_6}" -a "${USE_RUBY_1_8}" ] && \
141 [ ! "${WANT_RUBY_1_6}" -a ! "${WANT_RUBY_1_8}" ] ; then
142 einfo "running einstall for ruby 1.6 ;)"
143 cd ${S}/1.6/${S#${WORKDIR}}
144 erubyinstall ruby16 $@
145 cd -
146 einfo "running einstall for ruby 1.8 ;)"
147 cd ${S}/1.8/${S#${WORKDIR}}
148 erubyinstall ruby18 $@
149 S=${S}/1.8/${S#${WORKDIR}}
150 #cd -
151 else
152 einfo "running einstall for ruby ;)"
153 erubyinstall ruby $@
154 fi
155 }
156
157 erubydoc() {
158 local rdbase=/usr/share/doc/${PF}/rd rdfiles=$(find . -name '*.rd*')
159
160 einfo "running dodoc for ruby ;)"
161
162 insinto ${rdbase}
163 [ -n "${rdfiles}" ] && doins ${rdfiles}
164 rmdir --ignore-fail-on-non-empty ${D}${rdbase}
165 if [ -d doc -o -d docs -o examples ] ; then
166 dohtml -r doc/* docs/* examples/*
167 else
168 dohtml -r *
169 fi
170 if [ -d sample ] ; then
171 dodir /usr/share/doc/${PF}
172 cp -a sample ${D}/usr/share/doc/${PF} || "cp failed"
173 fi
174 for i in ChangeLog* [A-Z][A-Z]* ; do
175 [ -e $i ] && dodoc $i
176 done
177 }
178
179 ruby_src_install() {
180
181 ruby_einstall $@ || die
182
183 erubydoc
184 }

  ViewVC Help
Powered by ViewVC 1.1.20