Merge remote-tracking branch 'github/pr/760'.
[gentoo.git] / dev-ruby / eventmachine / eventmachine-1.0.8.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 USE_RUBY="ruby19 ruby20 ruby21 ruby22"
8
9 RUBY_FAKEGEM_TASK_DOC="yard"
10 RUBY_FAKEGEM_DOCDIR="rdoc"
11 RUBY_FAKEGEM_EXTRADOC="docs/*.md README.md"
12
13 inherit ruby-fakegem
14
15 DESCRIPTION="EventMachine is a fast, simple event-processing library for Ruby programs"
16 HOMEPAGE="http://rubyeventmachine.com"
17
18 LICENSE="|| ( GPL-2 Ruby )"
19 SLOT="0"
20 KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
21 IUSE=""
22
23 DEPEND="${DEPEND}
24         dev-libs/openssl:0"
25 RDEPEND="${RDEPEND}
26         dev-libs/openssl:0"
27
28 ruby_add_bdepend "doc? ( dev-ruby/yard )
29         test? ( dev-ruby/test-unit:2 )"
30
31 all_ruby_prepare() {
32         # Remove package tasks to avoid dependency on rake-compiler.
33         rm rakelib/package.rake || die
34
35         # fix test issue - upstream b96b736b39261f7d74f013633cc7cd619afa20c4
36         sed -i -e 's/DEBUG/BROADCAST/g' tests/test_set_sock_opt.rb || die
37         sed -i -e "/omit_/d" tests/test_*.rb || die
38         # Remove the resolver tests since they require network access and
39         # the localhost test fails with an IPv6 localhost.
40         rm tests/test_resolver.rb || die
41         # Needs a tty
42         rm tests/test_kb.rb || die
43         # Avoid tests that require network access
44         sed -i -e '/test_bind_connect/,/^  end/ s:^:#:' \
45                 tests/test_basic.rb || die
46         sed -i -e '/test_\(cookie\|http_client\|version_1_0\)/,/^  end/ s:^:#:' \
47                 tests/test_httpclient.rb || die
48         sed -i -e '/test_\(get\|https_get\)/,/^  end/ s:^:#:' \
49                 tests/test_httpclient2.rb || die
50         sed -i -e '/test_connect_timeout/,/^  end/ s:^:#:' \
51                 tests/test_unbind_reason.rb || die
52         sed -i -e '/test_for_real/,/^    end/ s:^:#:' \
53                 tests/test_pending_connect_timeout.rb || die
54         rm -f tests/test_{get_sock_opt,set_sock_opt,idle_connection}.rb || die
55 }
56
57 each_ruby_configure() {
58         for extdir in ext ext/fastfilereader; do
59                 pushd $extdir
60                 ${RUBY} extconf.rb || die "extconf.rb failed for ${extdir}"
61                 popd
62         done
63 }
64
65 each_ruby_compile() {
66         for extdir in ext ext/fastfilereader; do
67                 pushd $extdir
68                 # both extensions use C++, so use the CXXFLAGS not the CFLAGS
69                 emake V=1 CFLAGS="${CXXFLAGS} -fPIC" archflag="${LDFLAGS}" || die "emake failed for ${extdir}"
70                 popd
71                 cp $extdir/*.so lib/ || die "Unable to copy extensions for ${extdir}"
72         done
73 }
74
75 each_ruby_test() {
76         ${RUBY} -Ilib -S testrb tests/test_*.rb || die
77 }
78
79 all_ruby_install() {
80         all_fakegem_install
81
82         insinto /usr/share/doc/${PF}/
83         doins -r examples || die "Failed to install examples"
84 }