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

Diff of /eclass/ruby-fakegem.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.10 Revision 1.12
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.10 2010/01/09 21:16:37 flameeyes Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.12 2010/01/21 10:18:59 flameeyes 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#
168ruby_fakegem_binwrapper() { 168ruby_fakegem_binwrapper() {
169 ( 169 (
170 local gembinary=$1 170 local gembinary=$1
171 local newbinary=${2:-/usr/bin/$gembinary} 171 local newbinary=${2:-/usr/bin/$gembinary}
172 local relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin/${gembinary} 172 local relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin/${gembinary}
173 local binpath=$(dirname $newbinary)
174 [[ ${binpath} = . ]] && binpath=/usr/bin
173 175
174 cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF 176 cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF
175#!/usr/bin/env ruby 177#!/usr/bin/env ruby
176# This is a simplified version of the RubyGems wrapper 178# This is a simplified version of the RubyGems wrapper
177# 179#
181 183
182load Gem::default_path[-1] + "/gems/${relativegembinary}" 184load Gem::default_path[-1] + "/gems/${relativegembinary}"
183 185
184EOF 186EOF
185 187
186 exeinto $(dirname $newbinary) 188 exeinto ${binpath:-/usr/bin}
187 newexe "${T}"/gembin-wrapper-${gembinary} $(basename $newbinary) 189 newexe "${T}"/gembin-wrapper-${gembinary} $(basename $newbinary)
188 ) || die "Unable to create fakegem wrapper" 190 ) || die "Unable to create fakegem wrapper"
189} 191}
190 192
191# @FUNCTION: all_fakegem_compile 193# @FUNCTION: all_fakegem_compile
213 ebegin "Unpacking .gem file..." 215 ebegin "Unpacking .gem file..."
214 tar -mxf ${DISTDIR}/${A} || die 216 tar -mxf ${DISTDIR}/${A} || die
215 eend $? 217 eend $?
216 218
217 mkdir "${S}" 219 mkdir "${S}"
218 pushd "${S}" 220 pushd "${S}" &>/dev/null
219 221
220 ebegin "Unpacking data.tar.gz" 222 ebegin "Unpacking data.tar.gz"
221 tar -mxf "${my_WORKDIR}"/data.tar.gz || die 223 tar -mxf "${my_WORKDIR}"/data.tar.gz || die
222 eend $? 224 eend $?
225 popd &>/dev/null
223 else 226 else
224 [[ -n ${A} ]] && unpack ${A} 227 [[ -n ${A} ]] && unpack ${A}
225 fi 228 fi
226} 229}
227 230
256# @DESCRIPTION: 259# @DESCRIPTION:
257# Install the package for each ruby target. 260# Install the package for each ruby target.
258each_fakegem_install() { 261each_fakegem_install() {
259 ruby_fakegem_genspec 262 ruby_fakegem_genspec
260 263
261 local _gemlibdirs= 264 local _gemlibdirs="${RUBY_FAKEGEM_EXTRAINSTALL}"
262 for directory in bin lib ${RUBY_FAKEGEM_EXTRAINSTALL}; do 265 for directory in bin lib; do
263 [[ -d ${directory} ]] && _gemlibdirs="${_gemlibdirs} ${directory}" 266 [[ -d ${directory} ]] && _gemlibdirs="${_gemlibdirs} ${directory}"
264 done 267 done
265 268
266 [[ -n ${_gemlibdirs} ]] && \ 269 [[ -n ${_gemlibdirs} ]] && \
267 ruby_fakegem_doins -r ${_gemlibdirs} 270 ruby_fakegem_doins -r ${_gemlibdirs}
278# @DESCRIPTION: 281# @DESCRIPTION:
279# Install files common to all ruby targets. 282# Install files common to all ruby targets.
280all_fakegem_install() { 283all_fakegem_install() {
281 if [[ -n ${RUBY_FAKEGEM_DOCDIR} ]] && [[ ${RUBY_FAKEGEM_TASK_DOC} != "" ]] && use doc; then 284 if [[ -n ${RUBY_FAKEGEM_DOCDIR} ]] && [[ ${RUBY_FAKEGEM_TASK_DOC} != "" ]] && use doc; then
282 for dir in ${RUBY_FAKEGEM_DOCDIR}; do 285 for dir in ${RUBY_FAKEGEM_DOCDIR}; do
283 pushd ${dir} 286 pushd ${dir} &>/dev/null
284 dohtml -r * || die "failed to install documentation" 287 dohtml -r * || die "failed to install documentation"
285 popd 288 popd &>/dev/null
286 done 289 done
287 fi 290 fi
288 291
289 if [[ -n ${RUBY_FAKEGEM_EXTRADOC} ]]; then 292 if [[ -n ${RUBY_FAKEGEM_EXTRADOC} ]]; then
290 dodoc ${RUBY_FAKEGEM_EXTRADOC} || die "failed to install further documentation" 293 dodoc ${RUBY_FAKEGEM_EXTRADOC} || die "failed to install further documentation"
294 # same binaries, or something is wrong anyway, so... 297 # same binaries, or something is wrong anyway, so...
295 if [[ -n ${RUBY_FAKEGEM_BINWRAP} ]]; then 298 if [[ -n ${RUBY_FAKEGEM_BINWRAP} ]]; then
296 local bindir=$(find "${D}" -type d -path "*/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin" -print -quit) 299 local bindir=$(find "${D}" -type d -path "*/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin" -print -quit)
297 300
298 if [[ -d "${bindir}" ]]; then 301 if [[ -d "${bindir}" ]]; then
299 pushd "${bindir}" 302 pushd "${bindir}" &>/dev/null
300 local binaries=$(eval ls ${RUBY_FAKEGEM_BINWRAP}) 303 local binaries=$(eval ls ${RUBY_FAKEGEM_BINWRAP})
301 for binary in $binaries; do 304 for binary in $binaries; do
302 ruby_fakegem_binwrapper $binary 305 ruby_fakegem_binwrapper $binary
303 done 306 done
304 popd 307 popd &>/dev/null
305 fi 308 fi
306 fi 309 fi
307} 310}
308 311
309# @FUNCTION: all_ruby_install 312# @FUNCTION: all_ruby_install

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.20