summaryrefslogtreecommitdiff
path: root/eclass/ruby-ng-gnome2.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-08-25 10:45:55 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-08-25 10:45:55 +0100
commit3cf7c3ef441822c889356fd1812ebf2944a59851 (patch)
treec513fe68548b40365c1c2ebfe35c58ad431cdd77 /eclass/ruby-ng-gnome2.eclass
parent05b8b0e0af1d72e51a3ee61522941bf7605cd01c (diff)
gentoo resync : 25.08.2020
Diffstat (limited to 'eclass/ruby-ng-gnome2.eclass')
-rw-r--r--eclass/ruby-ng-gnome2.eclass105
1 files changed, 76 insertions, 29 deletions
diff --git a/eclass/ruby-ng-gnome2.eclass b/eclass/ruby-ng-gnome2.eclass
index ce52f27789a2..3b18faf95aae 100644
--- a/eclass/ruby-ng-gnome2.eclass
+++ b/eclass/ruby-ng-gnome2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: ruby-ng-gnome2.eclass
@@ -6,15 +6,15 @@
# Ruby herd <ruby@gentoo.org>
# @AUTHOR:
# Author: Hans de Graaff <graaff@gentoo.org>
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6
+# @SUPPORTED_EAPIS: 6 7
# @BLURB: An eclass to simplify handling of various ruby-gnome2 parts.
# @DESCRIPTION:
# This eclass simplifies installation of the various pieces of
# ruby-gnome2 since they share a very common installation procedure.
case "${EAPI:-0}" in
- 0|1|2|3|4|5|6)
- ;;
+ 6) inherit eapi7-ver ;;
+ 7) ;;
*)
die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
;;
@@ -24,35 +24,65 @@ RUBY_FAKEGEM_NAME="${RUBY_FAKEGEM_NAME:-${PN#ruby-}}"
RUBY_FAKEGEM_TASK_TEST=""
RUBY_FAKEGEM_TASK_DOC=""
-inherit ruby-fakegem multilib versionator
+# @ECLASS-VARIABLE: RUBY_GNOME2_NEED_VIRTX
+# @PRE_INHERIT
+# @DESCRIPTION:
+# If set to 'yes', the test is run with virtx. Set before inheriting this
+# eclass.
+: ${RUBY_GNOME2_NEED_VIRTX:="no"}
-IUSE=""
+inherit ruby-fakegem
+if [[ ${RUBY_GNOME2_NEED_VIRTX} == yes ]]; then
+ inherit virtualx
+fi
-# Define EPREFIX if needed
-has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
+IUSE="test"
+RESTRICT+=" !test? ( test )"
-subbinding=${PN#ruby-}
-if [ $(get_version_component_range "1-2") == "0.19" ]; then
- subbinding=${subbinding/%2}
-else
- subbinding=${subbinding/-/_}
- DEPEND="virtual/pkgconfig"
- ruby_add_bdepend "dev-ruby/pkg-config"
-fi
-if has "${EAPI:-0}" 0 1 2 3 ; then
- S=${WORKDIR}/ruby-gnome2-all-${PV}/${subbinding}
-else
- RUBY_S=ruby-gnome2-all-${PV}/${subbinding}
-fi
+DEPEND="virtual/pkgconfig"
+ruby_add_bdepend "
+ dev-ruby/pkg-config
+ test? ( >=dev-ruby/test-unit-2 )"
SRC_URI="mirror://sourceforge/ruby-gnome2/ruby-gnome2-all-${PV}.tar.gz"
HOMEPAGE="https://ruby-gnome2.osdn.jp/"
-LICENSE="Ruby"
+LICENSE="LGPL-2.1+"
SLOT="0"
+if ver_test -ge "3.4.0"; then
+ SRC_URI="https://github.com/ruby-gnome/ruby-gnome/archive/${PV}.tar.gz -> ruby-gnome2-${PV}.tar.gz"
+ RUBY_S=ruby-gnome-${PV}/${RUBY_FAKEGEM_NAME}
+else
+ SRC_URI="mirror://sourceforge/ruby-gnome2/ruby-gnome2-all-${PV}.tar.gz"
+ RUBY_S=ruby-gnome2-all-${PV}/${RUBY_FAKEGEM_NAME}
+fi
+
+ruby-ng-gnome2_all_ruby_prepare() {
+ # Avoid compilation of dependencies during test.
+ if [[ -e test/run-test.rb ]]; then
+ sed -i -e '/system(/s/which make/true/' test/run-test.rb || die
+ fi
+
+ # work on top directory
+ pushd .. >/dev/null
+
+ # Avoid native installer
+ if [[ -e glib2/lib/mkmf-gnome.rb ]]; then
+ sed -i -e '/native-package-installer/ s:^:#:' \
+ -e '/^setup_homebrew/ s:^:#:' glib2/lib/mkmf-gnome.rb || die
+ fi
+
+ popd >/dev/null
+}
+
+all_ruby_prepare() {
+ ruby-ng-gnome2_all_ruby_prepare
+}
# @FUNCTION: each_ruby_configure
# @DESCRIPTION:
# Run the configure script in the subbinding for each specific ruby target.
each_ruby_configure() {
+ [[ -e extconf.rb ]] || return
+
${RUBY} extconf.rb || die "extconf.rb failed"
}
@@ -60,6 +90,8 @@ each_ruby_configure() {
# @DESCRIPTION:
# Compile the C bindings in the subbinding for each specific ruby target.
each_ruby_compile() {
+ [[ -e Makefile ]] || return
+
# We have injected --no-undefined in Ruby as a safety precaution
# against broken ebuilds, but the Ruby-Gnome bindings
# unfortunately rely on the lazy load of other extensions; see bug
@@ -69,18 +101,20 @@ each_ruby_compile() {
-e "s/^ldflags = /ldflags = $\(LDFLAGS\) /" \
|| die "--no-undefined removal failed"
- emake V=1 || die "emake failed"
+ emake V=1
}
# @FUNCTION: each_ruby_install
# @DESCRIPTION:
# Install the files in the subbinding for each specific ruby target.
each_ruby_install() {
- # Create the directories, or the package will create them as files.
- local archdir=$(ruby_rbconfig_value "sitearchdir")
- dodir ${archdir#${EPREFIX}} /usr/$(get_libdir)/pkgconfig
+ if [[ -e Makefile ]]; then
+ # Create the directories, or the package will create them as files.
+ local archdir=$(ruby_rbconfig_value "sitearchdir")
+ dodir ${archdir#${EPREFIX}} /usr/$(get_libdir)/pkgconfig
- emake DESTDIR="${D}" install || die "make install failed"
+ emake DESTDIR="${D}" install
+ fi
each_fakegem_install
}
@@ -90,12 +124,25 @@ each_ruby_install() {
# Install the files common to all ruby targets.
all_ruby_install() {
for doc in ../AUTHORS ../NEWS ChangeLog README; do
- [ -s "$doc" ] && dodoc $doc
+ [[ -s ${doc} ]] && dodoc $doc
done
if [[ -d sample ]]; then
insinto /usr/share/doc/${PF}
- doins -r sample || die "sample install failed"
+ doins -r sample
fi
all_fakegem_install
}
+
+# @FUNCTION: each_ruby_test
+# @DESCRIPTION:
+# Run the tests for this package.
+each_ruby_test() {
+ [[ -e test/run-test.rb ]] || return
+
+ if [[ ${RUBY_GNOME2_NEED_VIRTX} == yes ]]; then
+ virtx ${RUBY} test/run-test.rb
+ else
+ ${RUBY} test/run-test.rb || die
+ fi
+}