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

Contents of /eclass/ruby.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.50 - (hide annotations) (download)
Sun Jan 1 01:14:59 2006 UTC (12 years, 11 months ago) by swegener
Branch: MAIN
Changes since 1.49: +2 -2 lines
Apply whitespace checks from repoman to eclasses.

1 vapier 1.35 # Copyright 1999-2004 Gentoo Foundation
2 agriffis 1.1 # Distributed under the terms of the GNU General Public License v2
3 swegener 1.50 # $Header: /var/cvsroot/gentoo-x86/eclass/ruby.eclass,v 1.49 2005/11/04 23:45:36 caleb Exp $
4 agriffis 1.1 #
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 usata 1.12 # 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 usata 1.22 # 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 usata 1.12 # Variables:
29 usata 1.15 # 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 usata 1.22 # "ruby16 ruby18". Possible values are "any ruby16 ruby18 ruby19"
34 vapier 1.40 # RUBY_ECONF You can pass extra arguments to econf by defining this
35 usata 1.12 # variable. Note that you cannot specify them by command line
36     # if you are using <sys-apps/portage-2.0.49-r17.
37 usata 1.22 # PATCHES Space delimited list of patch files.
38 usata 1.12
39 usata 1.41 inherit eutils toolchain-funcs
40 agriffis 1.32
41 agriffis 1.44 EXPORT_FUNCTIONS src_unpack src_compile src_install econf emake einstall
42 agriffis 1.1
43     HOMEPAGE="http://raa.ruby-lang.org/list.rhtml?name=${PN}"
44     SRC_URI="mirror://gentoo/${P}.tar.gz"
45    
46 caleb 1.49 IUSE="examples"
47 usata 1.30
48 agriffis 1.1 SLOT="0"
49     LICENSE="Ruby"
50    
51 usata 1.28 DEPEND="virtual/ruby"
52 usata 1.22
53 usata 1.24 [[ -z "${RUBY}" ]] && export RUBY=/usr/bin/ruby
54 usata 1.6
55     ruby_src_unpack() {
56 usata 1.17
57     unpack ${A}
58 usata 1.34 cd ${S}
59 usata 1.17 # apply bulk patches
60 usata 1.19 if [[ -n "${PATCHES}" ]] ; then
61     for p in ${PATCHES} ; do
62     epatch $p
63     done
64     fi
65 usata 1.6 }
66    
67 usata 1.22 ruby_econf() {
68 agriffis 1.1
69 vapier 1.40 RUBY_ECONF="${RUBY_ECONF} ${EXTRA_ECONF}"
70 usata 1.10 if [ -f configure ] ; then
71     ./configure \
72     --prefix=/usr \
73     --host=${CHOST} \
74     --mandir=/usr/share/man \
75     --infodir=/usr/share/info \
76     --datadir=/usr/share \
77     --sysconfdir=/etc \
78     --localstatedir=/var/lib \
79     --with-ruby=${RUBY} \
80 vapier 1.40 ${RUBY_ECONF} \
81 usata 1.26 "$@" || die "econf failed"
82 usata 1.10 fi
83     if [ -f install.rb ] ; then
84 usata 1.26 ${RUBY} install.rb config --prefix=/usr "$@" \
85 vapier 1.40 ${RUBY_ECONF} || die "install.rb config failed"
86 usata 1.26 ${RUBY} install.rb setup "$@" \
87 vapier 1.40 ${RUBY_ECONF} || die "install.rb setup failed"
88 usata 1.10 fi
89 usata 1.21 if [ -f setup.rb ] ; then
90 usata 1.26 ${RUBY} setup.rb config --prefix=/usr "$@" \
91 vapier 1.40 ${RUBY_ECONF} || die "setup.rb config failed"
92 usata 1.26 ${RUBY} setup.rb setup "$@" \
93 vapier 1.40 ${RUBY_ECONF} || die "setup.rb setup failed"
94 usata 1.21 fi
95 usata 1.10 if [ -f extconf.rb ] ; then
96 usata 1.36 ${RUBY} extconf.rb "$@" \
97 vapier 1.40 ${RUBY_ECONF} || die "extconf.rb failed"
98 usata 1.9 fi
99     }
100    
101 usata 1.22 ruby_emake() {
102 usata 1.9 if [ -f makefiles -o -f GNUmakefile -o -f makefile -o -f Makefile ] ; then
103 usata 1.41 make CC="$(tc-getCC)" CXX="$(tc-getCXX)" ${MAKEOPTS} ${EXTRA_EMAKE} "$@" || die "emake for ruby failed"
104 usata 1.6 fi
105     }
106    
107 usata 1.9 ruby_src_compile() {
108    
109 vapier 1.40 # You can pass configure options via RUBY_ECONF
110 usata 1.9 ruby_econf || die
111 usata 1.26 ruby_emake "$@" || die
112 usata 1.9 }
113    
114 usata 1.22 ruby_einstall() {
115     local siteruby
116 agriffis 1.1
117 vapier 1.40 RUBY_ECONF="${RUBY_ECONF} ${EXTRA_ECONF}"
118 usata 1.4 if [ -f install.rb ] ; then
119 usata 1.26 ${RUBY} install.rb config --prefix=${D}/usr "$@" \
120 vapier 1.40 ${RUBY_ECONF} || die "install.rb config failed"
121 usata 1.26 ${RUBY} install.rb install "$@" \
122 vapier 1.40 ${RUBY_ECONF} || die "install.rb install failed"
123 usata 1.21 elif [ -f setup.rb ] ; then
124 usata 1.26 ${RUBY} setup.rb config --prefix=${D}/usr "$@" \
125 vapier 1.40 ${RUBY_ECONF} || die "setup.rb config failed"
126 usata 1.26 ${RUBY} setup.rb install "$@" \
127 vapier 1.40 ${RUBY_ECONF} || die "setup.rb install failed"
128 usata 1.4 elif [ -f extconf.rb -o -f Makefile ] ; then
129 usata 1.26 make DESTDIR=${D} "$@" install || die "make install failed"
130 agriffis 1.1 else
131 usata 1.22 siteruby=$(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitedir"]')
132 usata 1.5 insinto ${siteruby}
133 squinky86 1.31 doins *.rb || die "doins failed"
134 agriffis 1.1 fi
135 usata 1.6 }
136    
137 usata 1.7 erubydoc() {
138     local rdbase=/usr/share/doc/${PF}/rd rdfiles=$(find . -name '*.rd*')
139 usata 1.9
140     einfo "running dodoc for ruby ;)"
141    
142 usata 1.7 insinto ${rdbase}
143     [ -n "${rdfiles}" ] && doins ${rdfiles}
144 usata 1.41 rmdir ${D}${rdbase} 2>/dev/null || true
145 usata 1.33 if [ -d doc -o -d docs ] ; then
146     dohtml -x html -r {doc,docs}/*
147     dohtml -r {doc,docs}/html/*
148 usata 1.7 else
149     dohtml -r *
150     fi
151 caleb 1.49
152 swegener 1.50 if ( use examples ); then
153 caleb 1.49 for dir in sample example examples; do
154     if [ -d ${dir} ] ; then
155     dodir /usr/share/doc/${PF}
156     cp -pPR ${dir} ${D}/usr/share/doc/${PF} || die "cp failed"
157     fi
158     done
159     fi
160    
161 usata 1.7 for i in ChangeLog* [A-Z][A-Z]* ; do
162     [ -e $i ] && dodoc $i
163     done
164     }
165    
166 usata 1.6 ruby_src_install() {
167    
168 usata 1.26 ruby_einstall "$@" || die
169 agriffis 1.1
170 usata 1.7 erubydoc
171 agriffis 1.1 }
172 usata 1.22
173     # erubyconf, erubymake and erubyinstall are kept for compatibility
174     erubyconf() {
175 usata 1.26 ruby_econf "$@"
176 usata 1.22 }
177    
178     erubymake() {
179 usata 1.26 ruby_emake "$@"
180 usata 1.22 }
181    
182     erubyinstall() {
183 usata 1.26 ruby_einstall "$@"
184 usata 1.22 }
185    
186     # prepall adds SLOT support for ruby.eclass
187     prepall() {
188    
189     [[ ! -x /usr/bin/ruby16 ]] && export USE_RUBY=${USE_RUBY/ruby16/}
190     [[ ! -x /usr/bin/ruby18 ]] && export USE_RUBY=${USE_RUBY/ruby18/}
191     [[ ! -x /usr/bin/ruby19 ]] && export USE_RUBY=${USE_RUBY/ruby19/}
192    
193 usata 1.37 local ruby_slots=$(echo "${USE_RUBY}" | wc -w)
194    
195 usata 1.43 if [ "$ruby_slots" -ge 2 ] || (use ppc-macos && [ "$ruby_slots" -ge 1 ])
196 agriffis 1.38 then
197 usata 1.22 einfo "Now we are building the package for ${USE_RUBY}"
198     for rb in ${USE_RUBY} ruby ; do
199     einfo "Using $rb"
200     export RUBY=/usr/bin/$rb
201 usata 1.25 ruby() { /usr/bin/$rb "$@" ; }
202 usata 1.22 mkdir -p ${S}
203     cd ${WORKDIR}
204     einfo "Unpacking for $rb"
205     src_unpack || die "src_unpack failed"
206     cd ${S}
207 usata 1.29 find . -name '*.[ao]' -exec rm {} \;
208 usata 1.22 einfo "Building for $rb"
209     src_compile || die "src_compile failed"
210     cd ${S}
211     einfo "Installing for $rb"
212     src_install || die "src_install failed"
213     done
214     elif [ "${USE_RUBY}" == "any" ] ; then
215     siteruby=$(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitelibdir"]')
216     # in case no directories found in siteruby
217     shopt -sq nullglob
218    
219     for x in ${D}/${siteruby}/* ; do
220     mv $x ${D}/${siteruby}/..
221     done
222     if [ -d ${D}${siteruby} ] ; then
223     rmdir --ignore-fail-on-non-empty ${D}/${siteruby}
224     fi
225     fi
226    
227     prepallman
228     prepallinfo
229     prepallstrip
230     }
231    

  ViewVC Help
Powered by ViewVC 1.1.20