diff --git a/eclass/ruby-single.eclass b/eclass/ruby-single.eclass index f8ef648a16f8..5b8f01d63c4f 100644 --- a/eclass/ruby-single.eclass +++ b/eclass/ruby-single.eclass @@ -70,14 +70,33 @@ inherit ruby-utils # The order of dependencies will change over time to best match the # current state of ruby targets, e.g. stable version first. + +# @FUNCTION: ruby_single_implementation_command +# @RETURN: the path to the preferred Ruby implementation +# @DESCRIPTION: +# Returns the path of the first Ruby implementation from +# RUBY_TARGETS_PREFERENCE that is both installed and in USE_RUBY. +ruby_single_implementation_command() { + local _ruby_name + + for _ruby_name in ${RUBY_TARGETS_PREFERENCE}; do + if has ${_ruby_name} ${USE_RUBY} && has_version "virtual/rubygems[ruby_targets_${_ruby_name}]"; then + type -P ${_ruby_name} 2>/dev/null && return 0 + fi + done + + die "Unable to find working Ruby implementation" +} + + _ruby_single_implementations_depend() { local depend for _ruby_implementation in ${RUBY_TARGETS_PREFERENCE}; do - if [[ ${USE_RUBY} =~ ${_ruby_implementation} ]]; then - depend="${depend} $(_ruby_implementation_depend $_ruby_implementation)" + if has ${_ruby_implementation} ${USE_RUBY}; then + depend+=" virtual/rubygems[ruby_targets_${_ruby_implementation}]" fi done - echo "|| ( ${depend} ) virtual/rubygems" + echo "|| ( ${depend} )" } _ruby_single_set_globals() { diff --git a/net-libs/webkit-gtk/webkit-gtk-2.14.3.ebuild b/net-libs/webkit-gtk/webkit-gtk-2.14.3.ebuild index 3e18145454f4..5885c941fbcd 100644 --- a/net-libs/webkit-gtk/webkit-gtk-2.14.3.ebuild +++ b/net-libs/webkit-gtk/webkit-gtk-2.14.3.ebuild @@ -196,18 +196,6 @@ src_configure() { # Multiple rendering bugs on youtube, github, etc without this, bug #547224 append-flags $(test-flags -fno-strict-aliasing) - local ruby_interpreter="" - - if has_version "virtual/rubygems[ruby_targets_ruby24]"; then - ruby_interpreter="-DRUBY_EXECUTABLE=$(type -P ruby24)" - elif has_version "virtual/rubygems[ruby_targets_ruby23]"; then - ruby_interpreter="-DRUBY_EXECUTABLE=$(type -P ruby23)" - elif has_version "virtual/rubygems[ruby_targets_ruby22]"; then - ruby_interpreter="-DRUBY_EXECUTABLE=$(type -P ruby22)" - else - ruby_interpreter="-DRUBY_EXECUTABLE=$(type -P ruby21)" - fi - # TODO: Check Web Audio support # should somehow let user select between them? # @@ -254,7 +242,7 @@ src_configure() { -DENABLE_ACCELERATED_2D_CANVAS=${canvas_enabled} -DCMAKE_BUILD_TYPE=Release -DPORT=GTK - ${ruby_interpreter} + -DRUBY_EXECUTABLE="$(ruby_single_implementation_command)" ) # Allow it to use GOLD when possible as it has all the magic to diff --git a/net-libs/webkit-gtk/webkit-gtk-2.4.11-r1.ebuild b/net-libs/webkit-gtk/webkit-gtk-2.4.11-r1.ebuild index 4ea44042ecd9..852e8e80cab9 100644 --- a/net-libs/webkit-gtk/webkit-gtk-2.4.11-r1.ebuild +++ b/net-libs/webkit-gtk/webkit-gtk-2.4.11-r1.ebuild @@ -4,7 +4,7 @@ EAPI="6" PYTHON_COMPAT=( python2_7 ) -USE_RUBY="ruby20 ruby21 ruby22 ruby23" +USE_RUBY="ruby20 ruby21 ruby22 ruby23 ruby24" inherit autotools check-reqs flag-o-matic gnome2 pax-utils python-any-r1 ruby-single toolchain-funcs versionator virtualx @@ -207,18 +207,6 @@ src_configure() { append-ldflags "-Wl,--reduce-memory-overheads" fi - local ruby_interpreter="" - - if has_version "virtual/rubygems[ruby_targets_ruby23]"; then - ruby_interpreter="RUBY=$(type -P ruby23)" - elif has_version "virtual/rubygems[ruby_targets_ruby22]"; then - ruby_interpreter="RUBY=$(type -P ruby22)" - elif has_version "virtual/rubygems[ruby_targets_ruby21]"; then - ruby_interpreter="RUBY=$(type -P ruby21)" - else - ruby_interpreter="RUBY=$(type -P ruby20)" - fi - # TODO: Check Web Audio support # should somehow let user select between them? # @@ -245,7 +233,7 @@ src_configure() { --with-gtk=3.0 \ --enable-dependency-tracking \ --disable-gtk-doc \ - ${ruby_interpreter} + RUBY="$(ruby_single_implementation_command)" } src_test() { diff --git a/net-libs/webkit-gtk/webkit-gtk-2.4.11-r200.ebuild b/net-libs/webkit-gtk/webkit-gtk-2.4.11-r200.ebuild index a92c6b1baa43..3d510eb10654 100644 --- a/net-libs/webkit-gtk/webkit-gtk-2.4.11-r200.ebuild +++ b/net-libs/webkit-gtk/webkit-gtk-2.4.11-r200.ebuild @@ -4,7 +4,7 @@ EAPI="6" PYTHON_COMPAT=( python2_7 ) -USE_RUBY="ruby20 ruby21 ruby22 ruby23" +USE_RUBY="ruby20 ruby21 ruby22 ruby23 ruby24" inherit autotools check-reqs flag-o-matic gnome2 pax-utils python-any-r1 ruby-single toolchain-funcs versionator virtualx @@ -192,18 +192,6 @@ src_configure() { append-ldflags "-Wl,--reduce-memory-overheads" fi - local ruby_interpreter="" - - if has_version "virtual/rubygems[ruby_targets_ruby23]"; then - ruby_interpreter="RUBY=$(type -P ruby23)" - elif has_version "virtual/rubygems[ruby_targets_ruby22]"; then - ruby_interpreter="RUBY=$(type -P ruby22)" - elif has_version "virtual/rubygems[ruby_targets_ruby21]"; then - ruby_interpreter="RUBY=$(type -P ruby21)" - else - ruby_interpreter="RUBY=$(type -P ruby20)" - fi - # TODO: Check Web Audio support # should somehow let user select between them? # @@ -229,7 +217,7 @@ src_configure() { --disable-webkit2 \ --enable-dependency-tracking \ --disable-gtk-doc \ - ${ruby_interpreter} + RUBY="$(ruby_single_implementation_command)" } src_test() {