dev-python/josepy: 1.1.0 cleanup
[gentoo.git] / eclass / ruby-ng-gnome2.eclass
1 # Copyright 1999-2018 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 # @ECLASS: ruby-ng-gnome2.eclass
5 # @MAINTAINER:
6 # Ruby herd <ruby@gentoo.org>
7 # @AUTHOR:
8 # Author: Hans de Graaff <graaff@gentoo.org>
9 # @SUPPORTED_EAPIS: 0 1 2 3 4 5 6
10 # @BLURB: An eclass to simplify handling of various ruby-gnome2 parts.
11 # @DESCRIPTION:
12 # This eclass simplifies installation of the various pieces of
13 # ruby-gnome2 since they share a very common installation procedure.
14
15 case "${EAPI:-0}" in
16         0|1|2|3|4|5|6)
17                 ;;
18         *)
19                 die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
20                 ;;
21 esac
22
23 RUBY_FAKEGEM_NAME="${RUBY_FAKEGEM_NAME:-${PN#ruby-}}"
24 RUBY_FAKEGEM_TASK_TEST=""
25 RUBY_FAKEGEM_TASK_DOC=""
26
27 inherit ruby-fakegem multilib versionator
28
29 IUSE=""
30
31 # Define EPREFIX if needed
32 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
33
34 subbinding=${PN#ruby-}
35 if [ $(get_version_component_range "1-2") == "0.19" ]; then
36         subbinding=${subbinding/%2}
37 else
38         subbinding=${subbinding/-/_}
39         DEPEND="virtual/pkgconfig"
40         ruby_add_bdepend "dev-ruby/pkg-config"
41 fi
42 if has "${EAPI:-0}" 0 1 2 3 ; then
43         S=${WORKDIR}/ruby-gnome2-all-${PV}/${subbinding}
44 else
45         RUBY_S=ruby-gnome2-all-${PV}/${subbinding}
46 fi
47 SRC_URI="mirror://sourceforge/ruby-gnome2/ruby-gnome2-all-${PV}.tar.gz"
48 HOMEPAGE="https://ruby-gnome2.osdn.jp/"
49 LICENSE="Ruby"
50 SLOT="0"
51
52 # @FUNCTION: each_ruby_configure
53 # @DESCRIPTION:
54 # Run the configure script in the subbinding for each specific ruby target.
55 each_ruby_configure() {
56         ${RUBY} extconf.rb || die "extconf.rb failed"
57 }
58
59 # @FUNCTION: each_ruby_compile
60 # @DESCRIPTION:
61 # Compile the C bindings in the subbinding for each specific ruby target.
62 each_ruby_compile() {
63         # We have injected --no-undefined in Ruby as a safety precaution
64         # against broken ebuilds, but the Ruby-Gnome bindings
65         # unfortunately rely on the lazy load of other extensions; see bug
66         # #320545.
67         find . -name Makefile -print0 | xargs -0 \
68                 sed -i -e 's:-Wl,--no-undefined ::' \
69                 -e "s/^ldflags  = /ldflags = $\(LDFLAGS\) /" \
70                 || die "--no-undefined removal failed"
71
72         emake V=1 || die "emake failed"
73 }
74
75 # @FUNCTION: each_ruby_install
76 # @DESCRIPTION:
77 # Install the files in the subbinding for each specific ruby target.
78 each_ruby_install() {
79         # Create the directories, or the package will create them as files.
80         local archdir=$(ruby_rbconfig_value "sitearchdir")
81         dodir ${archdir#${EPREFIX}} /usr/$(get_libdir)/pkgconfig
82
83         emake DESTDIR="${D}" install || die "make install failed"
84
85         each_fakegem_install
86 }
87
88 # @FUNCTION: all_ruby_install
89 # @DESCRIPTION:
90 # Install the files common to all ruby targets.
91 all_ruby_install() {
92         for doc in ../AUTHORS ../NEWS ChangeLog README; do
93                 [ -s "$doc" ] && dodoc $doc
94         done
95         if [[ -d sample ]]; then
96                 insinto /usr/share/doc/${PF}
97                 doins -r sample || die "sample install failed"
98         fi
99
100         all_fakegem_install
101 }