sys-process/glances: revbump 3.1.4.1, add missing doc dep
[gentoo.git] / dev-ruby / json / json-1.8.6-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 USE_RUBY="ruby22 ruby23 ruby24 ruby25"
6
7 RUBY_FAKEGEM_RECIPE_DOC="rdoc"
8 RUBY_FAKEGEM_EXTRADOC="CHANGES TODO README.md README-json-jruby.markdown"
9
10 RUBY_FAKEGEM_GEMSPEC="json.gemspec"
11
12 inherit multilib ruby-fakegem
13
14 DESCRIPTION="A JSON implementation as a Ruby extension"
15 HOMEPAGE="https://github.com/flori/json"
16 LICENSE="|| ( Ruby GPL-2 )"
17
18 KEYWORDS="~alpha amd64 arm ~arm64 hppa ~mips ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
19 SLOT="0"
20 IUSE=""
21
22 RDEPEND="${RDEPEND}"
23 DEPEND="${DEPEND}
24         dev-util/ragel"
25
26 ruby_add_bdepend "dev-ruby/rake
27         doc? ( dev-ruby/rdoc )"
28
29 PATCHES=( "${FILESDIR}/${P}-heap-exposure.patch" )
30
31 all_ruby_prepare() {
32         # Avoid building the extension twice!
33         # And use rdoc instead of sdoc which we don't have packaged
34         # And don't call git to list files. We're using the pregenerated spec anyway.
35         sed -i \
36                 -e 's| => :compile||' \
37                 -e 's| => :clean||' \
38                 -e 's|sdoc|rdoc|' \
39                 -e 's|`git ls-files`|""|' \
40                 Rakefile || die "rakefile fix failed"
41
42         # Remove hardcoded and broken -O setting.
43         sed -i -e '/^  \(if\|unless\)/,/^  end/ s:^:#:' \
44                 -e '/^unless/,/^end/ s:^:#:' ext/json/ext/*/extconf.rb || die
45 }
46
47 each_ruby_compile() {
48         # Since 1.5.0 a Java extension is provided but it does not compile.
49         if [[ $(basename ${RUBY}) != "jruby" ]]; then
50                 ${RUBY} -S rake compile || die "extension compile failed"
51         fi
52 }
53
54 each_ruby_test() {
55         JSON=pure \
56         ${RUBY} -Iext:lib -S testrb-2 tests/test_*.rb || die "pure ruby tests failed"
57
58         if [[ $(basename ${RUBY}) != "jruby" ]]; then
59                 JSON=ext \
60                 ${RUBY} -Iext:lib -S testrb-2 tests/test_*.rb || die "ext ruby tests failed"
61         fi
62 }
63
64 each_ruby_install() {
65         each_fakegem_install
66         if [[ $(basename ${RUBY}) != "jruby" ]]; then
67                 ruby_fakegem_newins ext/json/ext/generator$(get_modname) lib/json/ext/generator$(get_modname)
68                 ruby_fakegem_newins ext/json/ext/parser$(get_modname) lib/json/ext/parser$(get_modname)
69         fi
70 }