| 1 | # Copyright 1999-2009 Gentoo Foundation |
1 | # Copyright 1999-2011 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.11 2010/04/26 15:07:58 a3li Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.39 2011/08/22 04:46:32 vapier Exp $ |
| 4 | # |
4 | |
| 5 | # @ECLASS: ruby-ng.eclass |
5 | # @ECLASS: ruby-ng.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Ruby herd <ruby@gentoo.org> |
7 | # Ruby herd <ruby@gentoo.org> |
| 8 | # |
8 | # @AUTHOR: |
| 9 | # Author: Diego E. Pettenò <flameeyes@gentoo.org> |
9 | # Author: Diego E. Pettenò <flameeyes@gentoo.org> |
| 10 | # |
|
|
| 11 | # Author: Alex Legler <a3li@gentoo.org> |
10 | # Author: Alex Legler <a3li@gentoo.org> |
| 12 | # |
|
|
| 13 | # Author: Hans de Graaff <graaff@gentoo.org> |
11 | # Author: Hans de Graaff <graaff@gentoo.org> |
| 14 | # |
|
|
| 15 | # @BLURB: An eclass for installing Ruby packages with proper support for multiple Ruby slots. |
12 | # @BLURB: An eclass for installing Ruby packages with proper support for multiple Ruby slots. |
| 16 | # @DESCRIPTION: |
13 | # @DESCRIPTION: |
| 17 | # The Ruby eclass is designed to allow an easier installation of Ruby packages |
14 | # The Ruby eclass is designed to allow an easier installation of Ruby packages |
| 18 | # and their incorporation into the Gentoo Linux system. |
15 | # and their incorporation into the Gentoo Linux system. |
| 19 | # |
16 | # |
| … | |
… | |
| 31 | # |
28 | # |
| 32 | # * each_ruby_configure |
29 | # * each_ruby_configure |
| 33 | # * all_ruby_configure |
30 | # * all_ruby_configure |
| 34 | |
31 | |
| 35 | # @ECLASS-VARIABLE: USE_RUBY |
32 | # @ECLASS-VARIABLE: USE_RUBY |
|
|
33 | # @REQUIRED |
| 36 | # @DESCRIPTION: |
34 | # @DESCRIPTION: |
| 37 | # This variable contains a space separated list of targets (see above) a package |
35 | # This variable contains a space separated list of targets (see above) a package |
| 38 | # is compatible to. It must be set before the `inherit' call. There is no |
36 | # is compatible to. It must be set before the `inherit' call. There is no |
| 39 | # default. All ebuilds are expected to set this variable. |
37 | # default. All ebuilds are expected to set this variable. |
| 40 | |
38 | |
| 41 | # @ECLASS-VARIABLE: RUBY_PATCHES |
39 | # @ECLASS-VARIABLE: RUBY_PATCHES |
|
|
40 | # @DEFAULT_UNSET |
| 42 | # @DESCRIPTION: |
41 | # @DESCRIPTION: |
| 43 | # A String or Array of filenames of patches to apply to all implementations. |
42 | # A String or Array of filenames of patches to apply to all implementations. |
| 44 | |
43 | |
| 45 | # @ECLASS-VARIABLE: RUBY_OPTIONAL |
44 | # @ECLASS-VARIABLE: RUBY_OPTIONAL |
| 46 | # @DESCRIPTION: |
45 | # @DESCRIPTION: |
| 47 | # Set the value to "yes" to make the dependency on a Ruby interpreter optional. |
46 | # Set the value to "yes" to make the dependency on a Ruby interpreter |
|
|
47 | # optional and then ruby_implementations_depend() to help populate |
|
|
48 | # DEPEND and RDEPEND. |
|
|
49 | |
|
|
50 | # @ECLASS-VARIABLE: RUBY_S |
|
|
51 | # @DEFAULT_UNSET |
|
|
52 | # @DESCRIPTION: |
|
|
53 | # If defined this variable determines the source directory name after |
|
|
54 | # unpacking. This defaults to the name of the package. Note that this |
|
|
55 | # variable supports a wildcard mechanism to help with github tarballs |
|
|
56 | # that contain the commit hash as part of the directory name. |
|
|
57 | |
|
|
58 | # @ECLASS-VARIABLE: RUBY_QA_ALLOWED_LIBS |
|
|
59 | # @DEFAULT_UNSET |
|
|
60 | # @DESCRIPTION: |
|
|
61 | # If defined this variable contains a whitelist of shared objects that |
|
|
62 | # are allowed to exist even if they don't link to libruby. This avoids |
|
|
63 | # the QA check that makes this mandatory. This is most likely not what |
|
|
64 | # you are looking for if you get the related "Missing links" QA warning, |
|
|
65 | # since the proper fix is almost always to make sure the shared object |
|
|
66 | # is linked against libruby. There are cases were this is not the case |
|
|
67 | # and the shared object is generic code to be used in some other way |
|
|
68 | # (e.g. selenium's firefox driver extension). When set this argument is |
|
|
69 | # passed to "grep -E" to remove reporting of these shared objects. |
| 48 | |
70 | |
| 49 | inherit eutils toolchain-funcs |
71 | inherit eutils toolchain-funcs |
| 50 | |
72 | |
| 51 | EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup |
73 | EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup |
| 52 | |
74 | |
| 53 | case ${EAPI} in |
75 | case ${EAPI} in |
| 54 | 0|1) |
76 | 0|1) |
| 55 | die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; |
77 | die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; |
| 56 | 2) ;; |
78 | 2|3) ;; |
|
|
79 | 4) |
|
|
80 | # S is no longer automatically assigned when it doesn't exist. |
|
|
81 | S="${WORKDIR}" |
|
|
82 | ;; |
| 57 | *) |
83 | *) |
| 58 | die "Unknown EAPI=${EAPI} for ruby-ng.eclass" |
84 | die "Unknown EAPI=${EAPI} for ruby-ng.eclass" |
| 59 | esac |
85 | esac |
| 60 | |
86 | |
| 61 | # @FUNCTION: ruby_implementation_depend |
87 | # @FUNCTION: ruby_implementation_depend |
| … | |
… | |
| 110 | done |
136 | done |
| 111 | |
137 | |
| 112 | echo "[${res%,}]" |
138 | echo "[${res%,}]" |
| 113 | } |
139 | } |
| 114 | |
140 | |
|
|
141 | _ruby_atoms_samelib_generic() { |
|
|
142 | eshopts_push -o noglob |
|
|
143 | echo "RUBYTARGET? (" |
|
|
144 | for token in $*; do |
|
|
145 | case "$token" in |
|
|
146 | "||" | "(" | ")" | *"?") |
|
|
147 | echo "${token}" ;; |
|
|
148 | *]) |
|
|
149 | echo "${token%[*}[RUBYTARGET,${token/*[}" ;; |
|
|
150 | *) |
|
|
151 | echo "${token}[RUBYTARGET]" ;; |
|
|
152 | esac |
|
|
153 | done |
|
|
154 | echo ")" |
|
|
155 | eshopts_pop |
|
|
156 | } |
|
|
157 | |
|
|
158 | # @FUNCTION: ruby_implementation_command |
|
|
159 | # @RETURN: the path to the given ruby implementation |
|
|
160 | # @DESCRIPTION: |
|
|
161 | # Not all implementations have the same command basename as the |
|
|
162 | # target; namely Ruby Enterprise 1.8 uses ree18 and rubyee18 |
|
|
163 | # respectively. This function translate between the two |
| 115 | _ruby_implementation_depend() { |
164 | ruby_implementation_command() { |
| 116 | echo "ruby_targets_${1}? ( ${2}[ruby_targets_${1}] )" |
165 | local _ruby_name=$1 |
| 117 | } |
|
|
| 118 | |
166 | |
| 119 | _ruby_add_bdepend() { |
167 | # Add all USE_RUBY values where the flag name diverts from the binary here |
| 120 | local atom=$1 |
168 | case $1 in |
|
|
169 | ree18) |
|
|
170 | _ruby_name=rubyee18 |
|
|
171 | ;; |
|
|
172 | esac |
|
|
173 | |
|
|
174 | echo $(type -p ${_ruby_name} 2>/dev/null) |
|
|
175 | } |
|
|
176 | |
|
|
177 | _ruby_atoms_samelib() { |
|
|
178 | local atoms=$(_ruby_atoms_samelib_generic "$*") |
|
|
179 | |
|
|
180 | for _ruby_implementation in $USE_RUBY; do |
|
|
181 | echo "${atoms//RUBYTARGET/ruby_targets_${_ruby_implementation}}" |
|
|
182 | done |
|
|
183 | } |
|
|
184 | |
|
|
185 | _ruby_wrap_conditions() { |
| 121 | local conditions=$2 |
186 | local conditions="$1" |
|
|
187 | local atoms="$2" |
| 122 | |
188 | |
| 123 | for condition in $conditions; do |
189 | for condition in $conditions; do |
| 124 | hasq $condition "$IUSE" || IUSE="${IUSE} $condition" |
|
|
| 125 | atom="${condition}? ( ${atom} )" |
190 | atoms="${condition}? ( ${atoms} )" |
| 126 | done |
191 | done |
| 127 | |
192 | |
| 128 | DEPEND="${DEPEND} ${atom}" |
193 | echo "$atoms" |
| 129 | RDEPEND="${RDEPEND}" |
|
|
| 130 | } |
|
|
| 131 | |
|
|
| 132 | _ruby_add_rdepend() { |
|
|
| 133 | local atom=$1 |
|
|
| 134 | local conditions=$2 |
|
|
| 135 | |
|
|
| 136 | for condition in $conditions; do |
|
|
| 137 | hasq $condition "$IUSE" || IUSE="${IUSE} $condition" |
|
|
| 138 | atom="${condition}? ( ${atom} )" |
|
|
| 139 | done |
|
|
| 140 | |
|
|
| 141 | RDEPEND="${RDEPEND} ${atom}" |
|
|
| 142 | _ruby_add_bdepend "$atom" test |
|
|
| 143 | } |
194 | } |
| 144 | |
195 | |
| 145 | # @FUNCTION: ruby_add_rdepend |
196 | # @FUNCTION: ruby_add_rdepend |
| 146 | # @USAGE: [conditions] atom |
197 | # @USAGE: dependencies |
| 147 | # @DESCRIPTION: |
198 | # @DESCRIPTION: |
| 148 | # Adds the specified atom(s) with optional use condition(s) to |
199 | # Adds the specified dependencies, with use condition(s) to RDEPEND, |
| 149 | # RDEPEND, taking the current set of ruby targets into account. This |
200 | # taking the current set of ruby targets into account. This makes sure |
| 150 | # makes sure that all ruby dependencies of the package are installed |
201 | # that all ruby dependencies of the package are installed for the same |
| 151 | # for the same ruby targets. Use this function for all ruby |
202 | # ruby targets. Use this function for all ruby dependencies instead of |
| 152 | # dependencies instead of setting RDEPEND yourself. Both atom and |
203 | # setting RDEPEND yourself. The list of atoms uses the same syntax as |
| 153 | # conditions can be a space-separated list of atoms or conditions. |
204 | # normal dependencies. |
|
|
205 | # |
|
|
206 | # Note: runtime dependencies are also added as build-time test |
|
|
207 | # dependencies. |
| 154 | ruby_add_rdepend() { |
208 | ruby_add_rdepend() { |
| 155 | local atoms= |
|
|
| 156 | local conditions= |
|
|
| 157 | case $# in |
209 | case $# in |
| 158 | 1) |
210 | 1) ;; |
| 159 | atoms=$1 |
|
|
| 160 | ;; |
|
|
| 161 | 2) |
211 | 2) |
| 162 | conditions=$1 |
212 | [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_rdepend for $CATEGORY/$PF" |
| 163 | atoms=$2 |
213 | ruby_add_rdepend "$(_ruby_wrap_conditions "$1" "$2")" |
|
|
214 | return |
| 164 | ;; |
215 | ;; |
| 165 | *) |
216 | *) |
| 166 | die "bad number of arguments to $0" |
217 | die "bad number of arguments to $0" |
| 167 | ;; |
218 | ;; |
| 168 | esac |
219 | esac |
| 169 | |
220 | |
| 170 | for atom in $atoms; do |
221 | local dependency=$(_ruby_atoms_samelib "$1") |
| 171 | _ruby_add_rdepend "${atom}$(ruby_samelib)" "$conditions" |
222 | |
| 172 | done |
223 | RDEPEND="${RDEPEND} $dependency" |
|
|
224 | |
|
|
225 | # Add the dependency as a test-dependency since we're going to |
|
|
226 | # execute the code during test phase. |
|
|
227 | DEPEND="${DEPEND} test? ( ${dependency} )" |
|
|
228 | has test "$IUSE" || IUSE="${IUSE} test" |
| 173 | } |
229 | } |
| 174 | |
230 | |
| 175 | # @FUNCTION: ruby_add_bdepend |
231 | # @FUNCTION: ruby_add_bdepend |
| 176 | # @USAGE: [conditions] atom |
232 | # @USAGE: dependencies |
| 177 | # @DESCRIPTION: |
233 | # @DESCRIPTION: |
| 178 | # Adds the specified atom(s) with optional use condition(s) to both |
234 | # Adds the specified dependencies, with use condition(s) to DEPEND, |
| 179 | # DEPEND and RDEPEND, taking the current set of ruby targets into |
235 | # taking the current set of ruby targets into account. This makes sure |
| 180 | # account. This makes sure that all ruby dependencies of the package |
236 | # that all ruby dependencies of the package are installed for the same |
| 181 | # are installed for the same ruby targets. Use this function for all |
237 | # ruby targets. Use this function for all ruby dependencies instead of |
| 182 | # ruby dependencies instead of setting DEPEND and RDEPEND |
238 | # setting DEPEND yourself. The list of atoms uses the same syntax as |
| 183 | # yourself. Both atom and conditions can be a space-separated list of |
239 | # normal dependencies. |
| 184 | # atoms or conditions. |
|
|
| 185 | ruby_add_bdepend() { |
240 | ruby_add_bdepend() { |
| 186 | local atoms= |
|
|
| 187 | local conditions= |
|
|
| 188 | case $# in |
241 | case $# in |
| 189 | 1) |
242 | 1) ;; |
| 190 | atoms=$1 |
|
|
| 191 | ;; |
|
|
| 192 | 2) |
243 | 2) |
| 193 | conditions=$1 |
244 | [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_bdepend for $CATEGORY/$PF" |
| 194 | atoms=$2 |
245 | ruby_add_bdepend "$(_ruby_wrap_conditions "$1" "$2")" |
|
|
246 | return |
| 195 | ;; |
247 | ;; |
| 196 | *) |
248 | *) |
| 197 | die "bad number of arguments to $0" |
249 | die "bad number of arguments to $0" |
| 198 | ;; |
250 | ;; |
| 199 | esac |
251 | esac |
| 200 | |
252 | |
| 201 | for atom in $atoms; do |
253 | local dependency=$(_ruby_atoms_samelib "$1") |
| 202 | _ruby_add_bdepend "${atom}$(ruby_samelib)" "$conditions" |
|
|
| 203 | done |
|
|
| 204 | } |
|
|
| 205 | |
254 | |
|
|
255 | DEPEND="${DEPEND} $dependency" |
|
|
256 | RDEPEND="${RDEPEND}" |
|
|
257 | } |
|
|
258 | |
|
|
259 | # @FUNCTION: ruby_get_use_implementations |
|
|
260 | # @DESCRIPTION: |
|
|
261 | # Gets an array of ruby use targets enabled by the user |
|
|
262 | ruby_get_use_implementations() { |
|
|
263 | local i implementation |
|
|
264 | for implementation in ${USE_RUBY}; do |
|
|
265 | use ruby_targets_${implementation} && i+=" ${implementation}" |
|
|
266 | done |
|
|
267 | echo $i |
|
|
268 | } |
|
|
269 | |
|
|
270 | # @FUNCTION: ruby_get_use_targets |
|
|
271 | # @DESCRIPTION: |
|
|
272 | # Gets an array of ruby use targets that the ebuild sets |
|
|
273 | ruby_get_use_targets() { |
|
|
274 | local t implementation |
|
|
275 | for implementation in ${USE_RUBY}; do |
|
|
276 | t+=" ruby_targets_${implementation}" |
|
|
277 | done |
|
|
278 | echo $t |
|
|
279 | } |
|
|
280 | |
|
|
281 | if [[ ${EAPI:-0} -ge 4 && ${RUBY_OPTIONAL} != "yes" ]]; then |
|
|
282 | REQUIRED_USE=" || ( $(ruby_get_use_targets) )" |
|
|
283 | fi |
|
|
284 | |
|
|
285 | # @FUNCTION: ruby_implementations_depend |
|
|
286 | # @RETURN: Dependencies suitable for injection into DEPEND and RDEPEND. |
|
|
287 | # @DESCRIPTION: |
|
|
288 | # Produces the dependency string for the various implementations of ruby |
|
|
289 | # which the package is being built against. This should not be used when |
|
|
290 | # RUBY_OPTIONAL is unset but must be used if RUBY_OPTIONAL=yes. Do not |
|
|
291 | # confuse this function with ruby_implementation_depend(). |
|
|
292 | # |
|
|
293 | # @EXAMPLE: |
|
|
294 | # EAPI=4 |
|
|
295 | # RUBY_OPTIONAL=yes |
|
|
296 | # |
|
|
297 | # inherit ruby-ng |
|
|
298 | # ... |
|
|
299 | # DEPEND="ruby? ( $(ruby_implementations_depend) )" |
|
|
300 | # RDEPEND="${DEPEND}" |
|
|
301 | ruby_implementations_depend() { |
|
|
302 | local depend |
|
|
303 | for _ruby_implementation in ${USE_RUBY}; do |
|
|
304 | depend="${depend}${depend+ }ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )" |
|
|
305 | done |
|
|
306 | echo "${depend}" |
|
|
307 | } |
|
|
308 | |
| 206 | for _ruby_implementation in $USE_RUBY; do |
309 | for _ruby_implementation in ${USE_RUBY}; do |
| 207 | IUSE="${IUSE} ruby_targets_${_ruby_implementation}" |
310 | IUSE="${IUSE} ruby_targets_${_ruby_implementation}" |
| 208 | |
|
|
| 209 | # If you specify RUBY_OPTIONAL you also need to take care of |
|
|
| 210 | # ruby useflag and dependency. |
|
|
| 211 | if [[ ${RUBY_OPTIONAL} != "yes" ]]; then |
|
|
| 212 | DEPEND="${DEPEND} ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )" |
|
|
| 213 | RDEPEND="${RDEPEND} ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )" |
|
|
| 214 | fi |
|
|
| 215 | done |
311 | done |
|
|
312 | # If you specify RUBY_OPTIONAL you also need to take care of |
|
|
313 | # ruby useflag and dependency. |
|
|
314 | if [[ ${RUBY_OPTIONAL} != yes ]]; then |
|
|
315 | DEPEND="${DEPEND} $(ruby_implementations_depend)" |
|
|
316 | RDEPEND="${RDEPEND} $(ruby_implementations_depend)" |
|
|
317 | fi |
| 216 | |
318 | |
| 217 | _ruby_invoke_environment() { |
319 | _ruby_invoke_environment() { |
| 218 | old_S=${S} |
320 | old_S=${S} |
|
|
321 | case ${EAPI} in |
|
|
322 | 4) |
|
|
323 | if [ -z ${RUBY_S} ]; then |
|
|
324 | sub_S=${P} |
|
|
325 | else |
|
|
326 | sub_S=${RUBY_S} |
|
|
327 | fi |
|
|
328 | ;; |
|
|
329 | *) |
| 219 | sub_S=${S#${WORKDIR}} |
330 | sub_S=${S#${WORKDIR}/} |
|
|
331 | ;; |
|
|
332 | esac |
|
|
333 | |
|
|
334 | # Special case, for the always-lovely GitHub fetches. With this, |
|
|
335 | # we allow the star glob to just expand to whatever directory it's |
|
|
336 | # called. |
|
|
337 | if [[ ${sub_S} = *"*"* ]]; then |
|
|
338 | case ${EAPI} in |
|
|
339 | 2|3) |
|
|
340 | #The old method of setting S depends on undefined package |
|
|
341 | # manager behaviour, so encourage upgrading to EAPI=4. |
|
|
342 | eqawarn "Using * expansion of S is deprecated. Use EAPI and RUBY_S instead." |
|
|
343 | ;; |
|
|
344 | esac |
|
|
345 | pushd "${WORKDIR}"/all &>/dev/null |
|
|
346 | sub_S=$(eval ls -d ${sub_S} 2>/dev/null) |
|
|
347 | popd &>/dev/null |
|
|
348 | fi |
| 220 | |
349 | |
| 221 | environment=$1; shift |
350 | environment=$1; shift |
| 222 | |
351 | |
| 223 | my_WORKDIR="${WORKDIR}"/${environment} |
352 | my_WORKDIR="${WORKDIR}"/${environment} |
| 224 | S="${my_WORKDIR}"/"${sub_S}" |
353 | S="${my_WORKDIR}"/"${sub_S}" |
| … | |
… | |
| 242 | local invoked=no |
371 | local invoked=no |
| 243 | for _ruby_implementation in ${USE_RUBY}; do |
372 | for _ruby_implementation in ${USE_RUBY}; do |
| 244 | # only proceed if it's requested |
373 | # only proceed if it's requested |
| 245 | use ruby_targets_${_ruby_implementation} || continue |
374 | use ruby_targets_${_ruby_implementation} || continue |
| 246 | |
375 | |
| 247 | local _ruby_name=$_ruby_implementation |
376 | RUBY=$(ruby_implementation_command ${_ruby_implementation}) |
| 248 | |
|
|
| 249 | # Add all USE_RUBY values where the flag name diverts from the binary here |
|
|
| 250 | case $_ruby_implementation in |
|
|
| 251 | ree18) |
|
|
| 252 | _ruby_name=rubyee18 |
|
|
| 253 | ;; |
|
|
| 254 | esac |
|
|
| 255 | |
|
|
| 256 | RUBY=$(type -p $_ruby_name 2>/dev/null) |
|
|
| 257 | invoked=yes |
377 | invoked=yes |
| 258 | |
378 | |
| 259 | if [[ -n "$1" ]]; then |
379 | if [[ -n "$1" ]]; then |
| 260 | _ruby_invoke_environment $_ruby_implementation "$@" |
380 | _ruby_invoke_environment ${_ruby_implementation} "$@" |
| 261 | fi |
381 | fi |
| 262 | |
382 | |
| 263 | unset RUBY |
383 | unset RUBY |
| 264 | done |
384 | done |
| 265 | |
385 | |
| … | |
… | |
| 372 | type all_ruby_test &>/dev/null && \ |
492 | type all_ruby_test &>/dev/null && \ |
| 373 | _ruby_invoke_environment all all_ruby_test |
493 | _ruby_invoke_environment all all_ruby_test |
| 374 | } |
494 | } |
| 375 | |
495 | |
| 376 | _each_ruby_check_install() { |
496 | _each_ruby_check_install() { |
|
|
497 | local scancmd=scanelf |
|
|
498 | # we have a Mach-O object here |
|
|
499 | [[ ${CHOST} == *-darwin ]] && scancmd=scanmacho |
|
|
500 | |
|
|
501 | has "${EAPI}" 2 && ! use prefix && EPREFIX= |
|
|
502 | |
| 377 | local libruby_basename=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["LIBRUBY_SO"]') |
503 | local libruby_basename=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["LIBRUBY_SO"]') |
| 378 | local libruby_soname=$(scanelf -qS "/usr/$(get_libdir)/${libruby_basename}" | awk '{ print $1 }') |
504 | local libruby_soname=$(basename $(${scancmd} -F "%S#F" -qS "${EPREFIX}/usr/$(get_libdir)/${libruby_basename}") 2>/dev/null) |
| 379 | local sitedir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitedir"]') |
505 | local sitedir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitedir"]') |
| 380 | local sitelibdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]') |
506 | local sitelibdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]') |
| 381 | |
507 | |
| 382 | # Look for wrong files in sitedir |
508 | # Look for wrong files in sitedir |
| 383 | if [[ -d "${D}${sitedir}" ]]; then |
509 | # if [[ -d "${D}${sitedir}" ]]; then |
| 384 | local f=$(find "${D}${sitedir}" -mindepth 1 -maxdepth 1 -not -wholename "${D}${sitelibdir}") |
510 | # local f=$(find "${D}${sitedir}" -mindepth 1 -maxdepth 1 -not -wholename "${D}${sitelibdir}") |
| 385 | if [[ -n ${f} ]]; then |
511 | # if [[ -n ${f} ]]; then |
| 386 | eerror "Found files in sitedir, outsite sitelibdir:" |
512 | # eerror "Found files in sitedir, outsite sitelibdir:" |
| 387 | eerror "${f}" |
513 | # eerror "${f}" |
| 388 | die "Misplaced files in sitedir" |
514 | # die "Misplaced files in sitedir" |
| 389 | fi |
515 | # fi |
| 390 | fi |
516 | # fi |
| 391 | |
517 | |
| 392 | # The current implementation lacks libruby (i.e.: jruby) |
518 | # The current implementation lacks libruby (i.e.: jruby) |
| 393 | [[ -z ${libruby_soname} ]] && return 0 |
519 | [[ -z ${libruby_soname} ]] && return 0 |
| 394 | |
520 | |
| 395 | scanelf -qnR "${D}${sitedir}" \ |
521 | # Check also the gems directory, since we could be installing compiled |
|
|
522 | # extensions via ruby-fakegem; make sure to check only in sitelibdir, since |
|
|
523 | # that's what changes between two implementations (otherwise you'd get false |
|
|
524 | # positives now that Ruby 1.9.2 installs with the same sitedir as 1.8) |
|
|
525 | ${scancmd} -qnR "${D}${sitelibdir}" "${D}${sitelibdir/site_ruby/gems}" \ |
| 396 | | fgrep -v "${libruby_soname}" \ |
526 | | fgrep -v "${libruby_soname}" \ |
|
|
527 | | grep -E -v "${RUBY_QA_ALLOWED_LIBS}" \ |
| 397 | > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log |
528 | > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log |
| 398 | |
529 | |
| 399 | if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then |
530 | if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then |
| 400 | ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby}" |
531 | ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby_soname}" |
| 401 | ewarn $(< "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ) |
532 | ewarn $(< "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ) |
| 402 | die "Missing links to ${libruby}" |
533 | die "Missing links to ${libruby_soname}" |
| 403 | fi |
534 | fi |
| 404 | } |
535 | } |
| 405 | |
536 | |
| 406 | # @FUNCTION: ruby-ng_src_install |
537 | # @FUNCTION: ruby-ng_src_install |
| 407 | # @DESCRIPTION: |
538 | # @DESCRIPTION: |
| … | |
… | |
| 429 | # @USAGE: file [file...] |
560 | # @USAGE: file [file...] |
| 430 | # @DESCRIPTION: |
561 | # @DESCRIPTION: |
| 431 | # Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}. |
562 | # Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}. |
| 432 | doruby() { |
563 | doruby() { |
| 433 | [[ -z ${RUBY} ]] && die "\$RUBY is not set" |
564 | [[ -z ${RUBY} ]] && die "\$RUBY is not set" |
|
|
565 | has "${EAPI}" 2 && ! use prefix && EPREFIX= |
| 434 | ( # don't want to pollute calling env |
566 | ( # don't want to pollute calling env |
| 435 | insinto $(ruby_rbconfig_value 'sitelibdir') |
567 | sitelibdir=$(ruby_rbconfig_value 'sitelibdir') |
|
|
568 | insinto ${sitelibdir#${EPREFIX}} |
| 436 | insopts -m 0644 |
569 | insopts -m 0644 |
| 437 | doins "$@" |
570 | doins "$@" |
| 438 | ) || die "failed to install $@" |
571 | ) || die "failed to install $@" |
| 439 | } |
572 | } |
| 440 | |
573 | |