| 1 | # Copyright 1999-2009 Gentoo Foundation |
1 | # Copyright 1999-2009 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-fakegem.eclass,v 1.6 2009/12/20 23:39:43 flameeyes Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.28 2011/03/05 06:58:00 graaff Exp $ |
| 4 | # |
4 | # |
| 5 | # @ECLASS: ruby-fakegem.eclass |
5 | # @ECLASS: ruby-fakegem.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Ruby herd <ruby@gentoo.org> |
7 | # Ruby herd <ruby@gentoo.org> |
| 8 | # |
8 | # |
| … | |
… | |
| 52 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_BINWRAP |
52 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_BINWRAP |
| 53 | # @DESCRIPTION: |
53 | # @DESCRIPTION: |
| 54 | # Binaries to wrap around (relative to the bin/ directory) |
54 | # Binaries to wrap around (relative to the bin/ directory) |
| 55 | # RUBY_FAKEGEM_BINWRAP="*" |
55 | # RUBY_FAKEGEM_BINWRAP="*" |
| 56 | |
56 | |
|
|
57 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_REQUIRE_PATHS |
|
|
58 | # @DESCRIPTION: |
|
|
59 | # Extra require paths (beside lib) to add to the specification |
|
|
60 | # RUBY_FAKEGEM_REQUIRE_PATHS="" |
|
|
61 | |
|
|
62 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_GEMSPEC |
|
|
63 | # @DESCRIPTION: |
|
|
64 | # Filename of .gemspec file to install instead of generating a generic one. |
|
|
65 | # RUBY_FAKEGEM_GEMSPEC="" |
|
|
66 | |
| 57 | RUBY_FAKEGEM_NAME="${RUBY_FAKEGEM_NAME:-${PN}}" |
67 | RUBY_FAKEGEM_NAME="${RUBY_FAKEGEM_NAME:-${PN}}" |
| 58 | RUBY_FAKEGEM_VERSION="${RUBY_FAKEGEM_VERSION:-${PV}}" |
68 | RUBY_FAKEGEM_VERSION="${RUBY_FAKEGEM_VERSION:-${PV/_pre/.pre}}" |
|
|
69 | RUBY_FAKEGEM_SUFFIX="${RUBY_FAKEGEM_SUFFIX:-}" |
| 59 | |
70 | |
| 60 | RUBY_FAKEGEM_TASK_DOC="${RUBY_FAKEGEM_TASK_DOC-rdoc}" |
71 | RUBY_FAKEGEM_TASK_DOC="${RUBY_FAKEGEM_TASK_DOC-rdoc}" |
| 61 | RUBY_FAKEGEM_TASK_TEST="${RUBY_FAKEGEM_TASK_TEST-test}" |
72 | RUBY_FAKEGEM_TASK_TEST="${RUBY_FAKEGEM_TASK_TEST-test}" |
| 62 | |
73 | |
| 63 | RUBY_FAKEGEM_BINWRAP="${RUBY_FAKEGEM_BINWRAP-*}" |
74 | RUBY_FAKEGEM_BINWRAP="${RUBY_FAKEGEM_BINWRAP-*}" |
| 64 | |
75 | |
| 65 | if [[ ${RUBY_FAKEGEM_TASK_DOC} != "" ]]; then |
76 | if [[ ${RUBY_FAKEGEM_TASK_DOC} != "" ]]; then |
| 66 | IUSE="$IUSE doc" |
77 | IUSE="$IUSE doc" |
| 67 | ruby_add_bdepend doc "dev-ruby/rake" |
78 | ruby_add_bdepend "doc? ( dev-ruby/rake )" |
|
|
79 | fi |
|
|
80 | |
|
|
81 | if [[ -n ${RUBY_FAKEGEM_DOCDIR} ]]; then |
|
|
82 | IUSE="$IUSE doc" |
| 68 | fi |
83 | fi |
| 69 | |
84 | |
| 70 | if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then |
85 | if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then |
| 71 | IUSE="$IUSE test" |
86 | IUSE="$IUSE test" |
| 72 | ruby_add_bdepend test "dev-ruby/rake" |
87 | ruby_add_bdepend "test? ( dev-ruby/rake )" |
| 73 | fi |
88 | fi |
| 74 | |
89 | |
| 75 | SRC_URI="mirror://rubygems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}.gem" |
90 | SRC_URI="mirror://rubygems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}${RUBY_FAKEGEM_SUFFIX:+-${RUBY_FAKEGEM_SUFFIX}}.gem" |
| 76 | |
91 | |
|
|
92 | ruby_add_bdepend dev-ruby/rubygems |
| 77 | ruby_add_rdepend virtual/rubygems |
93 | ruby_add_rdepend dev-ruby/rubygems |
| 78 | |
94 | |
| 79 | # @FUNCTION: ruby_fakegem_gemsdir |
95 | # @FUNCTION: ruby_fakegem_gemsdir |
| 80 | # @RETURN: Returns the gem data directory |
96 | # @RETURN: Returns the gem data directory |
| 81 | # @DESCRIPTION: |
97 | # @DESCRIPTION: |
| 82 | # This function returns the gems data directory for the ruby |
98 | # This function returns the gems data directory for the ruby |
| 83 | # implementation in question. |
99 | # implementation in question. |
| 84 | ruby_fakegem_gemsdir() { |
100 | ruby_fakegem_gemsdir() { |
| 85 | local _gemsitedir=$(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitelibdir"]' | sed -e 's:site_ruby:gems:') |
101 | has "${EAPI}" 2 && ! use prefix && EPREFIX= |
|
|
102 | |
|
|
103 | local _gemsitedir=$(ruby_rbconfig_value 'sitelibdir') |
|
|
104 | _gemsitedir=${_gemsitedir//site_ruby/gems} |
|
|
105 | _gemsitedir=${_gemsitedir#${EPREFIX}} |
| 86 | |
106 | |
| 87 | [[ -z ${_gemsitedir} ]] && { |
107 | [[ -z ${_gemsitedir} ]] && { |
| 88 | eerror "Unable to find the gems dir" |
108 | eerror "Unable to find the gems dir" |
| 89 | die "Unable to find the gems dir" |
109 | die "Unable to find the gems dir" |
| 90 | } |
110 | } |
| … | |
… | |
| 119 | insinto $(ruby_fakegem_gemsdir)/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}${newdirname} |
139 | insinto $(ruby_fakegem_gemsdir)/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}${newdirname} |
| 120 | newins "$1" ${newbasename} |
140 | newins "$1" ${newbasename} |
| 121 | ) || die "failed $0 $@" |
141 | ) || die "failed $0 $@" |
| 122 | } |
142 | } |
| 123 | |
143 | |
|
|
144 | # @FUNCTION: ruby_fakegem_install_gemspec |
|
|
145 | # @DESCRIPTION: |
|
|
146 | # Install a .gemspec file for this package. Either use the file indicated |
|
|
147 | # by the RUBY_FAKEGEM_GEMSPEC variable, or generate one using |
|
|
148 | # ruby_fakegem_genspec. |
|
|
149 | ruby_fakegem_install_gemspec() { |
|
|
150 | local gemspec="${T}"/${RUBY_FAKEGEM_NAME}-${_ruby_implementation} |
|
|
151 | |
|
|
152 | ( |
|
|
153 | if [[ ${RUBY_FAKEGEM_GEMSPEC} != "" ]]; then |
|
|
154 | ruby_fakegem_gemspec_gemspec ${RUBY_FAKEGEM_GEMSPEC} ${gemspec} |
|
|
155 | else |
|
|
156 | local metadata="${WORKDIR}"/${_ruby_implementation}/metadata |
|
|
157 | |
|
|
158 | if [[ -e ${metadata} ]]; then |
|
|
159 | ruby_fakegem_metadata_gemspec ${metadata} ${gemspec} |
|
|
160 | else |
|
|
161 | ruby_fakegem_genspec ${gemspec} |
|
|
162 | fi |
|
|
163 | fi |
|
|
164 | ) || die "Unable to generate gemspec file." |
|
|
165 | |
|
|
166 | insinto $(ruby_fakegem_gemsdir)/specifications |
|
|
167 | newins ${gemspec} ${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}.gemspec || die "Unable to install gemspec file." |
|
|
168 | } |
|
|
169 | |
|
|
170 | # @FUNCTION: ruby_fakegem_gemspec_gemspec |
|
|
171 | # @USAGE: gemspec-input gemspec-output |
|
|
172 | # @DESCRIPTION: |
|
|
173 | # Generates an installable version of the specification indicated by |
|
|
174 | # RUBY_FAKEGEM_GEMSPEC. This file is eval'ed to produce a final specification |
|
|
175 | # in a way similar to packaging the gemspec file. |
|
|
176 | ruby_fakegem_gemspec_gemspec() { |
|
|
177 | ${RUBY} -e "puts eval(File::open('$1').read).to_ruby" > $2 |
|
|
178 | } |
|
|
179 | |
|
|
180 | # @FUNCTION: ruby_fakegem_metadata_gemspec |
|
|
181 | # @USAGE: gemspec-metadata gemspec-output |
|
|
182 | # @DESCRIPTION: |
|
|
183 | # Generates an installable version of the specification indicated by |
|
|
184 | # the metadata distributed by the gem itself. This is similar to how |
|
|
185 | # rubygems creates an installation from a .gem file. |
|
|
186 | ruby_fakegem_metadata_gemspec() { |
|
|
187 | ${RUBY} -r yaml -e "puts Gem::Specification.from_yaml(File::open('$1').read).to_ruby" > $2 |
|
|
188 | } |
|
|
189 | |
| 124 | # @FUNCTION: ruby_fakegem_genspec |
190 | # @FUNCTION: ruby_fakegem_genspec |
|
|
191 | # @USAGE: output-gemspec |
| 125 | # @DESCRIPTION: |
192 | # @DESCRIPTION: |
| 126 | # Generates a gemspec for the package and places it into the "specifications" |
193 | # Generates a gemspec for the package and places it into the "specifications" |
| 127 | # directory of RubyGems. |
194 | # directory of RubyGems. |
|
|
195 | # If the metadata normally distributed with a gem is present then that is |
|
|
196 | # used to generate the gemspec file. |
|
|
197 | # |
|
|
198 | # As a fallback we can generate our own version. |
| 128 | # In the gemspec, the following values are set: name, version, summary, |
199 | # In the gemspec, the following values are set: name, version, summary, |
| 129 | # homepage, and require_paths=["lib"]. |
200 | # homepage, and require_paths=["lib"]. |
| 130 | # See RUBY_FAKEGEM_NAME and RUBY_FAKEGEM_VERSION for setting name and version. |
201 | # See RUBY_FAKEGEM_NAME and RUBY_FAKEGEM_VERSION for setting name and version. |
|
|
202 | # See RUBY_FAKEGEM_REQUIRE_PATHS for setting extra require paths. |
| 131 | ruby_fakegem_genspec() { |
203 | ruby_fakegem_genspec() { |
| 132 | ( |
204 | local required_paths="'lib'" |
|
|
205 | for path in ${RUBY_FAKEGEM_REQUIRE_PATHS}; do |
|
|
206 | required_paths="${required_paths}, '${path}'" |
|
|
207 | done |
|
|
208 | |
| 133 | # We use the _ruby_implementation variable to avoid having stray |
209 | # We use the _ruby_implementation variable to avoid having stray |
| 134 | # copies with different implementations; while for now we're using |
210 | # copies with different implementations; while for now we're using |
| 135 | # the same exact content, we might have differences in the future, |
211 | # the same exact content, we might have differences in the future, |
| 136 | # so better taking this into consideration. |
212 | # so better taking this into consideration. |
| 137 | cat - > "${T}"/${RUBY_FAKEGEM_NAME}-${_ruby_implementation} <<EOF |
213 | local quoted_description=${DESCRIPTION//\"/\\\"} |
|
|
214 | cat - > $1 <<EOF |
|
|
215 | # generated by ruby-fakegem.eclass $Revision: 1.28 $ |
| 138 | Gem::Specification.new do |s| |
216 | Gem::Specification.new do |s| |
| 139 | s.name = "${RUBY_FAKEGEM_NAME}" |
217 | s.name = "${RUBY_FAKEGEM_NAME}" |
| 140 | s.version = "${RUBY_FAKEGEM_VERSION}" |
218 | s.version = "${RUBY_FAKEGEM_VERSION}" |
| 141 | s.summary = "${DESCRIPTION}" |
219 | s.summary = "${quoted_description}" |
| 142 | s.homepage = "${HOMEPAGE}" |
220 | s.homepage = "${HOMEPAGE}" |
| 143 | s.require_paths = ["lib"] |
221 | s.require_paths = [${required_paths}] |
| 144 | end |
222 | end |
| 145 | EOF |
223 | EOF |
| 146 | |
|
|
| 147 | insinto $(ruby_fakegem_gemsdir)/specifications |
|
|
| 148 | newins "${T}"/${RUBY_FAKEGEM_NAME}-${_ruby_implementation} ${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}.gemspec |
|
|
| 149 | ) || die "Unable to install fake gemspec" |
|
|
| 150 | } |
224 | } |
| 151 | |
225 | |
| 152 | # @FUNCTION: ruby_fakegem_binwrapper |
226 | # @FUNCTION: ruby_fakegem_binwrapper |
| 153 | # @USAGE: command [path] |
227 | # @USAGE: command [path] |
| 154 | # @DESCRIPTION: |
228 | # @DESCRIPTION: |
| … | |
… | |
| 157 | ruby_fakegem_binwrapper() { |
231 | ruby_fakegem_binwrapper() { |
| 158 | ( |
232 | ( |
| 159 | local gembinary=$1 |
233 | local gembinary=$1 |
| 160 | local newbinary=${2:-/usr/bin/$gembinary} |
234 | local newbinary=${2:-/usr/bin/$gembinary} |
| 161 | local relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin/${gembinary} |
235 | local relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin/${gembinary} |
|
|
236 | local binpath=$(dirname $newbinary) |
|
|
237 | [[ ${binpath} = . ]] && binpath=/usr/bin |
|
|
238 | |
|
|
239 | # Try to find out whether the package is going to install for |
|
|
240 | # one or multiple implementations; if we're installing for a |
|
|
241 | # *single* implementation, no need to use “/usr/bin/env ruby” |
|
|
242 | # in the shebang, and we can actually avoid errors when |
|
|
243 | # calling the script by default (see for instance the |
|
|
244 | # JRuby-specific commands). |
|
|
245 | local rubycmd= |
|
|
246 | for implementation in ${USE_RUBY}; do |
|
|
247 | # ignore non-enabled implementations |
|
|
248 | use ruby_targets_${implementation} || continue |
|
|
249 | if [ -z $rubycmd ]; then |
|
|
250 | # if no other implementation was set before, set it. |
|
|
251 | rubycmd="$(ruby_implementation_command ${implementation})" |
|
|
252 | else |
|
|
253 | # if another implementation already arrived, then make |
|
|
254 | # it generic and break out of the loop. This ensures |
|
|
255 | # that we do at most two iterations. |
|
|
256 | rubycmd="/usr/bin/env ruby" |
|
|
257 | break |
|
|
258 | fi |
|
|
259 | done |
| 162 | |
260 | |
| 163 | cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF |
261 | cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF |
| 164 | #!/usr/bin/env ruby |
262 | #!${rubycmd} |
| 165 | # This is a simplified version of the RubyGems wrapper |
263 | # This is a simplified version of the RubyGems wrapper |
| 166 | # |
264 | # |
| 167 | # Generated by ruby-fakegem.eclass |
265 | # Generated by ruby-fakegem.eclass $Revision: 1.28 $ |
| 168 | |
266 | |
| 169 | require 'rubygems' |
267 | require 'rubygems' |
| 170 | |
268 | |
| 171 | load Gem::default_path[-1] + "/gems/${relativegembinary}" |
269 | load Gem::default_path[-1] + "/gems/${relativegembinary}" |
| 172 | |
270 | |
| 173 | EOF |
271 | EOF |
| 174 | |
272 | |
| 175 | exeinto $(dirname $newbinary) |
273 | exeinto ${binpath:-/usr/bin} |
| 176 | newexe "${T}"/gembin-wrapper-${gembinary} $(basename $newbinary) |
274 | newexe "${T}"/gembin-wrapper-${gembinary} $(basename $newbinary) |
| 177 | ) || die "Unable to create fakegem wrapper" |
275 | ) || die "Unable to create fakegem wrapper" |
| 178 | } |
276 | } |
| 179 | |
277 | |
| 180 | # @FUNCTION: all_fakegem_compile |
278 | # @FUNCTION: all_fakegem_compile |
| … | |
… | |
| 192 | # Unpack the source archive, including support for unpacking gems. |
290 | # Unpack the source archive, including support for unpacking gems. |
| 193 | all_ruby_unpack() { |
291 | all_ruby_unpack() { |
| 194 | # Special support for extracting .gem files; the file need to be |
292 | # Special support for extracting .gem files; the file need to be |
| 195 | # extracted twice and the mtime from the archive _has_ to be |
293 | # extracted twice and the mtime from the archive _has_ to be |
| 196 | # ignored (it's always set to epoch 0). |
294 | # ignored (it's always set to epoch 0). |
| 197 | # |
295 | for archive in ${A}; do |
| 198 | # This only works if there is exactly one archive and that archive |
296 | case "${archive}" in |
| 199 | # is a .gem file! |
297 | *.gem) |
| 200 | if [[ $(wc -w <<< ${A}) == 1 ]] && |
298 | # Make sure that we're not running unoack for more than |
| 201 | [[ ${A} == *.gem ]]; then |
299 | # one .gem file, since we won't support that at all. |
|
|
300 | [[ -d "${S}" ]] && die "Unable to unpack ${archive}, ${S} exists" |
|
|
301 | |
| 202 | ebegin "Unpacking .gem file..." |
302 | ebegin "Unpacking .gem file..." |
| 203 | tar -mxf ${DISTDIR}/${A} || die |
303 | tar -mxf ${DISTDIR}/${archive} || die |
| 204 | eend $? |
304 | eend $? |
| 205 | |
305 | |
|
|
306 | ebegin "Uncompressing metadata" |
|
|
307 | gunzip metadata.gz || die |
|
|
308 | eend $? |
|
|
309 | |
| 206 | mkdir "${S}" |
310 | mkdir "${S}" |
| 207 | pushd "${S}" |
311 | pushd "${S}" &>/dev/null |
| 208 | |
312 | |
| 209 | ebegin "Unpacking data.tar.gz" |
313 | ebegin "Unpacking data.tar.gz" |
| 210 | tar -mxf "${my_WORKDIR}"/data.tar.gz || die |
314 | tar -mxf "${my_WORKDIR}"/data.tar.gz || die |
| 211 | eend $? |
315 | eend $? |
| 212 | else |
316 | |
| 213 | [[ -n ${A} ]] && unpack ${A} |
317 | popd &>/dev/null |
| 214 | fi |
318 | ;; |
|
|
319 | *.patch.bz2) |
|
|
320 | # We apply the patches with RUBY_PATCHES directly from DISTDIR, |
|
|
321 | # as the WORKDIR variable changes value between the global-scope |
|
|
322 | # and the time all_ruby_unpack/_prepare are called. Since we can |
|
|
323 | # simply decompress them when applying, this is much easier to |
|
|
324 | # deal with for us. |
|
|
325 | einfo "Keeping ${archive} as-is" |
|
|
326 | ;; |
|
|
327 | *) |
|
|
328 | unpack ${archive} |
|
|
329 | ;; |
|
|
330 | esac |
|
|
331 | done |
| 215 | } |
332 | } |
| 216 | |
333 | |
| 217 | # @FUNCTION: all_ruby_compile |
334 | # @FUNCTION: all_ruby_compile |
| 218 | # @DESCRIPTION: |
335 | # @DESCRIPTION: |
| 219 | # Compile the package. |
336 | # Compile the package. |
| … | |
… | |
| 224 | # @FUNCTION: each_fakegem_test |
341 | # @FUNCTION: each_fakegem_test |
| 225 | # @DESCRIPTION: |
342 | # @DESCRIPTION: |
| 226 | # Run tests for the package for each ruby target if the test task is defined. |
343 | # Run tests for the package for each ruby target if the test task is defined. |
| 227 | each_fakegem_test() { |
344 | each_fakegem_test() { |
| 228 | local rubyflags= |
345 | local rubyflags= |
| 229 | |
|
|
| 230 | if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then |
|
|
| 231 | ${RUBY} ${rubyflags} -S rake ${RUBY_FAKEGEM_TASK_TEST} || die "tests failed" |
346 | ${RUBY} ${rubyflags} -S rake ${RUBY_FAKEGEM_TASK_TEST} || die "tests failed" |
| 232 | else |
|
|
| 233 | echo "No test task defined, skipping tests." |
|
|
| 234 | fi |
|
|
| 235 | } |
347 | } |
| 236 | |
348 | |
|
|
349 | if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then |
| 237 | # @FUNCTION: each_ruby_test |
350 | # @FUNCTION: each_ruby_test |
| 238 | # @DESCRIPTION: |
351 | # @DESCRIPTION: |
| 239 | # Run the tests for this package. |
352 | # Run the tests for this package. |
| 240 | each_ruby_test() { |
353 | each_ruby_test() { |
| 241 | each_fakegem_test |
354 | each_fakegem_test |
| 242 | } |
355 | } |
|
|
356 | fi |
| 243 | |
357 | |
| 244 | # @FUNCTION: each_fakegem_install |
358 | # @FUNCTION: each_fakegem_install |
| 245 | # @DESCRIPTION: |
359 | # @DESCRIPTION: |
| 246 | # Install the package for each ruby target. |
360 | # Install the package for each ruby target. |
| 247 | each_fakegem_install() { |
361 | each_fakegem_install() { |
| 248 | ruby_fakegem_genspec |
362 | ruby_fakegem_install_gemspec |
| 249 | |
363 | |
| 250 | local _gemlibdirs= |
364 | local _gemlibdirs="${RUBY_FAKEGEM_EXTRAINSTALL}" |
| 251 | for directory in bin lib ${RUBY_FAKEGEM_EXTRAINSTALL}; do |
365 | for directory in bin lib; do |
| 252 | [[ -d ${directory} ]] && _gemlibdirs="${_gemlibdirs} ${directory}" |
366 | [[ -d ${directory} ]] && _gemlibdirs="${_gemlibdirs} ${directory}" |
| 253 | done |
367 | done |
| 254 | |
368 | |
|
|
369 | [[ -n ${_gemlibdirs} ]] && \ |
| 255 | ruby_fakegem_doins -r ${_gemlibdirs} |
370 | ruby_fakegem_doins -r ${_gemlibdirs} |
| 256 | } |
371 | } |
| 257 | |
372 | |
| 258 | # @FUNCTION: each_ruby_install |
373 | # @FUNCTION: each_ruby_install |
| 259 | # @DESCRIPTION: |
374 | # @DESCRIPTION: |
| 260 | # Install the package for each target. |
375 | # Install the package for each target. |
| … | |
… | |
| 265 | # @FUNCTION: all_fakegem_install |
380 | # @FUNCTION: all_fakegem_install |
| 266 | # @DESCRIPTION: |
381 | # @DESCRIPTION: |
| 267 | # Install files common to all ruby targets. |
382 | # Install files common to all ruby targets. |
| 268 | all_fakegem_install() { |
383 | all_fakegem_install() { |
| 269 | if [[ -n ${RUBY_FAKEGEM_DOCDIR} ]] && use doc; then |
384 | if [[ -n ${RUBY_FAKEGEM_DOCDIR} ]] && use doc; then |
| 270 | pushd ${RUBY_FAKEGEM_DOCDIR} |
385 | for dir in ${RUBY_FAKEGEM_DOCDIR}; do |
|
|
386 | [[ -d ${dir} ]] || continue |
|
|
387 | |
|
|
388 | pushd ${dir} &>/dev/null |
| 271 | dohtml -r * || die "failed to install documentation" |
389 | dohtml -r * || die "failed to install documentation" |
| 272 | popd |
390 | popd &>/dev/null |
|
|
391 | done |
| 273 | fi |
392 | fi |
| 274 | |
393 | |
| 275 | if [[ -n ${RUBY_FAKEGEM_EXTRADOC} ]]; then |
394 | if [[ -n ${RUBY_FAKEGEM_EXTRADOC} ]]; then |
| 276 | dodoc ${RUBY_FAKEGEM_EXTRADOC} || die "failed to install further documentation" |
395 | dodoc ${RUBY_FAKEGEM_EXTRADOC} || die "failed to install further documentation" |
| 277 | fi |
396 | fi |
| … | |
… | |
| 280 | # same binaries, or something is wrong anyway, so... |
399 | # same binaries, or something is wrong anyway, so... |
| 281 | if [[ -n ${RUBY_FAKEGEM_BINWRAP} ]]; then |
400 | if [[ -n ${RUBY_FAKEGEM_BINWRAP} ]]; then |
| 282 | local bindir=$(find "${D}" -type d -path "*/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin" -print -quit) |
401 | local bindir=$(find "${D}" -type d -path "*/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin" -print -quit) |
| 283 | |
402 | |
| 284 | if [[ -d "${bindir}" ]]; then |
403 | if [[ -d "${bindir}" ]]; then |
| 285 | pushd "${bindir}" |
404 | pushd "${bindir}" &>/dev/null |
| 286 | local binaries=$(eval ls ${RUBY_FAKEGEM_BINWRAP}) |
405 | local binaries=$(eval ls ${RUBY_FAKEGEM_BINWRAP}) |
| 287 | for binary in $binaries; do |
406 | for binary in $binaries; do |
| 288 | ruby_fakegem_binwrapper $binary |
407 | ruby_fakegem_binwrapper $binary |
| 289 | done |
408 | done |
| 290 | popd |
409 | popd &>/dev/null |
| 291 | fi |
410 | fi |
| 292 | fi |
411 | fi |
| 293 | } |
412 | } |
| 294 | |
413 | |
| 295 | # @FUNCTION: all_ruby_install |
414 | # @FUNCTION: all_ruby_install |