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

Contents of /eclass/ruby.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.28 - (show annotations) (download)
Sat Apr 10 13:02:38 2004 UTC (14 years, 3 months ago) by usata
Branch: MAIN
Changes since 1.27: +2 -2 lines
newdepend is deprecated; use DEPEND/RDEPEND instead, see bug #25013

1 # Copyright 1999-2004 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.27 2004/04/10 10:01:12 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 # Functions:
16 # src_unpack Unpacks source archive(s) and apply patches if any.
17 # src_compile Invokes econf and emake.
18 # src_install Runs einstall and erubydoc.
19 # econf Detects setup.rb, install.rb, extconf.rb and configure,
20 # and then runs the configure script.
21 # emake Runs make if any Makefile exists.
22 # einstall Calls install script or Makefile. If both not present,
23 # installs programs under sitedir.
24 # erubydoc Finds any documents and puts them in the right place.
25 # erubydoc needs more sophistication to handle all types of
26 # appropriate documents.
27
28 # Variables:
29 # USE_RUBY Space delimited list of supported ruby.
30 # Set it to "any" if it installs only version independent files.
31 # If your ebuild supports both ruby 1.6 and 1.8 but has version
32 # depenedent files such as libraries, set it to something like
33 # "ruby16 ruby18". Possible values are "any ruby16 ruby18 ruby19"
34 # EXTRA_ECONF You can pass extra arguments to econf by defining this
35 # variable. Note that you cannot specify them by command line
36 # if you are using <sys-apps/portage-2.0.49-r17.
37 # PATCHES Space delimited list of patch files.
38
39 ECLASS=ruby
40 INHERITED="${INHERITED} ${ECLASS}"
41 EXPORT_FUNCTIONS src_unpack src_compile src_install prepall \
42 econf emake einstall erubyconf erubymake erubyinstall erubydoc
43
44 HOMEPAGE="http://raa.ruby-lang.org/list.rhtml?name=${PN}"
45 SRC_URI="mirror://gentoo/${P}.tar.gz"
46
47 SLOT="0"
48 LICENSE="Ruby"
49
50 DEPEND="virtual/ruby"
51
52 [[ -z "${RUBY}" ]] && export RUBY=/usr/bin/ruby
53
54 ruby_src_unpack() {
55
56 unpack ${A}
57 # apply bulk patches
58 if [[ -n "${PATCHES}" ]] ; then
59 for p in ${PATCHES} ; do
60 epatch $p
61 done
62 fi
63 }
64
65 ruby_econf() {
66
67 if [ -f configure ] ; then
68 ./configure \
69 --prefix=/usr \
70 --host=${CHOST} \
71 --mandir=/usr/share/man \
72 --infodir=/usr/share/info \
73 --datadir=/usr/share \
74 --sysconfdir=/etc \
75 --localstatedir=/var/lib \
76 --with-ruby=${RUBY} \
77 ${EXTRA_ECONF} \
78 "$@" || die "econf failed"
79 fi
80 if [ -f install.rb ] ; then
81 ${RUBY} install.rb config --prefix=/usr "$@" \
82 || die "install.rb config failed"
83 ${RUBY} install.rb setup "$@" \
84 || die "install.rb setup failed"
85 fi
86 if [ -f setup.rb ] ; then
87 ${RUBY} setup.rb config --prefix=/usr "$@" \
88 || die "setup.rb config failed"
89 ${RUBY} setup.rb setup "$@" \
90 || die "setup.rb setup failed"
91 fi
92 if [ -f extconf.rb ] ; then
93 ${RUBY} extconf.rb "$@" || die "extconf.rb failed"
94 fi
95 }
96
97 ruby_emake() {
98 if [ -f makefiles -o -f GNUmakefile -o -f makefile -o -f Makefile ] ; then
99 make CC=${CC:-gcc} CXX=${CXX:-g++} "$@" || die "emake for ruby failed"
100 fi
101 }
102
103 ruby_src_compile() {
104
105 # You can pass configure options via EXTRA_ECONF
106 ruby_econf || die
107 ruby_emake "$@" || die
108 }
109
110 ruby_einstall() {
111 local siteruby
112
113 if [ -f install.rb ] ; then
114 ${RUBY} install.rb config --prefix=${D}/usr "$@" \
115 || die "install.rb config failed"
116 ${RUBY} install.rb install "$@" \
117 || die "install.rb install failed"
118 elif [ -f setup.rb ] ; then
119 ${RUBY} setup.rb config --prefix=${D}/usr "$@" \
120 || die "setup.rb config failed"
121 ${RUBY} setup.rb install "$@" \
122 || die "setup.rb install failed"
123 elif [ -f extconf.rb -o -f Makefile ] ; then
124 make DESTDIR=${D} "$@" install || die "make install failed"
125 else
126 siteruby=$(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitedir"]')
127 insinto ${siteruby}
128 doins *.rb || "doins failed"
129 fi
130 }
131
132 erubydoc() {
133 local rdbase=/usr/share/doc/${PF}/rd rdfiles=$(find . -name '*.rd*')
134
135 einfo "running dodoc for ruby ;)"
136
137 insinto ${rdbase}
138 [ -n "${rdfiles}" ] && doins ${rdfiles}
139 rmdir --ignore-fail-on-non-empty ${D}${rdbase}
140 if [ -d doc -o -d docs -o examples ] ; then
141 dohtml -x html -r {doc,docs,examples}/*
142 dohtml -r {doc,docs,examples}/html/*
143 else
144 dohtml -r *
145 fi
146 if [ -d sample ] ; then
147 dodir /usr/share/doc/${PF}
148 cp -a sample ${D}/usr/share/doc/${PF} || "cp failed"
149 fi
150 for i in ChangeLog* [A-Z][A-Z]* ; do
151 [ -e $i ] && dodoc $i
152 done
153 }
154
155 ruby_src_install() {
156
157 ruby_einstall "$@" || die
158
159 erubydoc
160 }
161
162 # erubyconf, erubymake and erubyinstall are kept for compatibility
163 erubyconf() {
164 ruby_econf "$@"
165 }
166
167 erubymake() {
168 ruby_emake "$@"
169 }
170
171 erubyinstall() {
172 ruby_einstall "$@"
173 }
174
175 # prepall adds SLOT support for ruby.eclass
176 prepall() {
177
178 [[ ! -x /usr/bin/ruby16 ]] && export USE_RUBY=${USE_RUBY/ruby16/}
179 [[ ! -x /usr/bin/ruby18 ]] && export USE_RUBY=${USE_RUBY/ruby18/}
180 [[ ! -x /usr/bin/ruby19 ]] && export USE_RUBY=${USE_RUBY/ruby19/}
181
182 if [ -n "${USE_RUBY}" -a "${USE_RUBY}" != "any" ] ; then
183 einfo "Now we are building the package for ${USE_RUBY}"
184 for rb in ${USE_RUBY} ruby ; do
185 einfo "Using $rb"
186 export RUBY=/usr/bin/$rb
187 ruby() { /usr/bin/$rb "$@" ; }
188 mkdir -p ${S}
189 cd ${WORKDIR}
190 einfo "Unpacking for $rb"
191 src_unpack || die "src_unpack failed"
192 cd ${S}
193 einfo "Building for $rb"
194 src_compile || die "src_compile failed"
195 cd ${S}
196 einfo "Installing for $rb"
197 src_install || die "src_install failed"
198 done
199 elif [ "${USE_RUBY}" == "any" ] ; then
200 siteruby=$(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitelibdir"]')
201 # in case no directories found in siteruby
202 shopt -sq nullglob
203
204 for x in ${D}/${siteruby}/* ; do
205 mv $x ${D}/${siteruby}/..
206 done
207 if [ -d ${D}${siteruby} ] ; then
208 rmdir --ignore-fail-on-non-empty ${D}/${siteruby}
209 fi
210 fi
211
212 prepallman
213 prepallinfo
214 prepallstrip
215 }
216

  ViewVC Help
Powered by ViewVC 1.1.20