| 1 |
flameeyes |
1.1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
ago |
1.3 |
# $Header: /var/cvsroot/gentoo-x86/dev-ruby/hpricot/hpricot-0.8.6-r1.ebuild,v 1.2 2012/07/08 16:23:37 jer Exp $ |
| 4 |
flameeyes |
1.1 |
|
| 5 |
|
|
EAPI=4 |
| 6 |
|
|
|
| 7 |
|
|
USE_RUBY="ruby18 ree18 ruby19 jruby" |
| 8 |
|
|
|
| 9 |
|
|
RUBY_FAKEGEM_DOCDIR="doc" |
| 10 |
|
|
RUBY_FAKEGEM_EXTRADOC="CHANGELOG README.md" |
| 11 |
|
|
|
| 12 |
|
|
inherit ruby-fakegem eutils |
| 13 |
|
|
|
| 14 |
|
|
DESCRIPTION="A fast and liberal HTML parser for Ruby." |
| 15 |
|
|
HOMEPAGE="http://wiki.github.com/hpricot/hpricot" |
| 16 |
|
|
|
| 17 |
|
|
LICENSE="MIT" |
| 18 |
|
|
SLOT="0" |
| 19 |
ago |
1.3 |
KEYWORDS="amd64 ~hppa ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~x86-solaris" |
| 20 |
flameeyes |
1.1 |
IUSE="" |
| 21 |
|
|
|
| 22 |
|
|
ruby_add_bdepend "dev-ruby/rake |
| 23 |
|
|
dev-ruby/rake-compiler |
| 24 |
|
|
test? ( virtual/ruby-test-unit )" |
| 25 |
|
|
|
| 26 |
|
|
# dev-ruby/fast_xs does not cover JRuby so still bundle it here for now |
| 27 |
|
|
USE_RUBY="${USE_RUBY/jruby/}" \ |
| 28 |
|
|
ruby_add_rdepend "dev-ruby/fast_xs" |
| 29 |
|
|
|
| 30 |
|
|
# Probably needs the same jdk as JRuby but I'm not sure how to express |
| 31 |
|
|
# that just yet. |
| 32 |
|
|
DEPEND+=" |
| 33 |
|
|
dev-util/ragel |
| 34 |
|
|
ruby_targets_jruby? ( >=virtual/jdk-1.5 )" |
| 35 |
|
|
|
| 36 |
|
|
all_ruby_prepare() { |
| 37 |
|
|
sed -i -e '/[Bb]undler/ s:^:#:' Rakefile || die |
| 38 |
|
|
|
| 39 |
|
|
# Fix encoding assumption of environment for Ruby 1.9. |
| 40 |
|
|
# https://github.com/hpricot/hpricot/issues/52 |
| 41 |
|
|
# sed -i -e '1 iEncoding.default_external=Encoding::UTF_8 if RUBY_VERSION =~ /1.9/' test/load_files.rb || die |
| 42 |
|
|
} |
| 43 |
|
|
|
| 44 |
|
|
each_ruby_prepare() { |
| 45 |
|
|
# dev-ruby/fast_xs does not cover JRuby so still bundle it here for now |
| 46 |
|
|
[[ ${RUBY} == */jruby ]] && return |
| 47 |
|
|
|
| 48 |
|
|
pushd .. &>/dev/null |
| 49 |
|
|
epatch "${FILESDIR}"/${P}-fast_xs.patch |
| 50 |
|
|
popd .. &>/dev/null |
| 51 |
|
|
} |
| 52 |
|
|
|
| 53 |
|
|
each_ruby_configure() { |
| 54 |
|
|
# dev-ruby/fast_xs does not cover JRuby so still bundle it here for now |
| 55 |
|
|
[[ ${RUBY} == */jruby ]] && return |
| 56 |
|
|
|
| 57 |
|
|
${RUBY} -Cext/hpricot_scan extconf.rb || die "hpricot_scan/extconf.rb failed" |
| 58 |
|
|
} |
| 59 |
|
|
|
| 60 |
|
|
each_ruby_compile() { |
| 61 |
|
|
local modname=$(get_modname) |
| 62 |
|
|
|
| 63 |
|
|
# dev-ruby/fast_xs does not cover JRuby so still bundle it here for now |
| 64 |
|
|
if [[ ${RUBY} == */jruby ]]; then |
| 65 |
|
|
${RUBY} -S rake compile_java || die "rake compile_java failed" |
| 66 |
|
|
return |
| 67 |
|
|
fi |
| 68 |
|
|
|
| 69 |
|
|
emake -Cext/hpricot_scan CFLAGS="${CFLAGS} -fPIC" archflag="${LDFLAGS}" || die "make hpricot_scan failed" |
| 70 |
|
|
cp ext/hpricot_scan/hpricot_scan${modname} lib/ || die |
| 71 |
|
|
} |