2017-02-22 13:15:45 +03:00
|
|
|
# Copyright 1999-2017 Gentoo Foundation
|
2014-05-15 09:00:50 +04:00
|
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
|
|
|
|
EAPI=5
|
|
|
|
|
2017-02-22 13:15:45 +03:00
|
|
|
USE_RUBY="ruby21 ruby22 ruby23 ruby24"
|
2014-05-15 09:00:50 +04:00
|
|
|
|
|
|
|
RUBY_FAKEGEM_DOCDIR="doc"
|
|
|
|
RUBY_FAKEGEM_EXTRADOC="CHANGELOG README.md"
|
|
|
|
|
|
|
|
inherit ruby-fakegem eutils
|
|
|
|
|
2014-08-06 17:12:35 +04:00
|
|
|
DESCRIPTION="A fast and liberal HTML parser for Ruby"
|
2015-08-25 09:05:57 +03:00
|
|
|
HOMEPAGE="https://wiki.github.com/hpricot/hpricot"
|
2014-05-15 09:00:50 +04:00
|
|
|
|
|
|
|
LICENSE="MIT"
|
|
|
|
SLOT="0"
|
2017-07-08 12:41:03 +03:00
|
|
|
KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ppc ppc64 sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
|
2014-05-15 09:00:50 +04:00
|
|
|
IUSE=""
|
|
|
|
|
|
|
|
ruby_add_bdepend "dev-ruby/rake
|
2016-08-05 22:50:33 +03:00
|
|
|
dev-ruby/rdoc
|
2014-05-15 09:00:50 +04:00
|
|
|
dev-ruby/rake-compiler"
|
|
|
|
|
2015-02-27 23:34:04 +03:00
|
|
|
ruby_add_rdepend "dev-ruby/fast_xs"
|
2014-05-15 09:00:50 +04:00
|
|
|
|
|
|
|
# Probably needs the same jdk as JRuby but I'm not sure how to express
|
|
|
|
# that just yet.
|
2015-02-27 23:34:04 +03:00
|
|
|
DEPEND+=" dev-util/ragel"
|
2014-05-15 09:00:50 +04:00
|
|
|
|
|
|
|
all_ruby_prepare() {
|
|
|
|
sed -i -e '/[Bb]undler/ s:^:#:' Rakefile || die
|
|
|
|
|
|
|
|
# Fix encoding assumption of environment for Ruby 1.9.
|
|
|
|
# https://github.com/hpricot/hpricot/issues/52
|
|
|
|
# sed -i -e '1 iEncoding.default_external=Encoding::UTF_8 if RUBY_VERSION =~ /1.9/' test/load_files.rb || die
|
2015-04-08 11:17:51 +03:00
|
|
|
|
|
|
|
# Avoid unneeded dependency on git.
|
|
|
|
sed -i -e '/^REV/ s/.*/REV = "6"/' Rakefile || die
|
2016-08-05 22:50:33 +03:00
|
|
|
|
|
|
|
# Fix int size warning
|
|
|
|
sed -i -e 's/te - ts/(int)(te - ts)/' ext/hpricot_scan/hpricot_css.rl || die
|
2014-05-15 09:00:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
each_ruby_prepare() {
|
|
|
|
pushd .. &>/dev/null
|
|
|
|
epatch "${FILESDIR}"/${P}-fast_xs.patch
|
|
|
|
popd .. &>/dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
each_ruby_configure() {
|
|
|
|
${RUBY} -Cext/hpricot_scan extconf.rb || die "hpricot_scan/extconf.rb failed"
|
|
|
|
}
|
|
|
|
|
|
|
|
each_ruby_compile() {
|
|
|
|
local modname=$(get_modname)
|
|
|
|
|
2016-05-27 15:27:33 +03:00
|
|
|
${RUBY} -S rake ragel || die
|
2014-05-15 09:00:50 +04:00
|
|
|
emake V=1 -Cext/hpricot_scan CFLAGS="${CFLAGS} -fPIC" archflag="${LDFLAGS}" || die "make hpricot_scan failed"
|
|
|
|
cp ext/hpricot_scan/hpricot_scan${modname} lib/ || die
|
|
|
|
}
|