commit:     7457a55b31bce1d433214f23e0150a9a993019bf
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Tue Jun 12 01:49:44 2018 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Tue Jun 12 01:49:44 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7457a55b

media-libs/mesa: Simplify and optimize driver_list()

Make *_DRIVERS arrays instead of strings.

 media-libs/mesa/mesa-9999.ebuild | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/media-libs/mesa/mesa-9999.ebuild b/media-libs/mesa/mesa-9999.ebuild
index 9df1aa45f58..efc874f4902 100644
--- a/media-libs/mesa/mesa-9999.ebuild
+++ b/media-libs/mesa/mesa-9999.ebuild
@@ -351,16 +351,16 @@ multilib_src_configure() {
        fi
 
        if use gallium; then
-               GALLIUM_DRIVERS+="swrast "
+               GALLIUM_DRIVERS+=(swrast)
                emesonargs+=( -Dosmesa=$(usex osmesa gallium none) )
        else
-               DRI_DRIVERS+="swrast "
+               DRI_DRIVERS+=(swrast)
                emesonargs+=( -Dosmesa=$(usex osmesa classic none) )
        fi
 
        driver_list() {
-               arr=($(printf "%s\n" "$@" | sort -u | tr '\n' ','))
-               echo "${arr: : -1}"
+               local drivers="$(sort -u <<< "${1// /$'\n'}")"
+               echo "${drivers//$'\n'/,}"
        }
 
        emesonargs+=(
@@ -376,9 +376,9 @@ multilib_src_configure() {
                $(meson_use unwind libunwind)
                $(meson_use lm_sensors lmsensors)
                -Dvalgrind=$(usex valgrind auto false)
-               -Ddri-drivers=$(driver_list ${DRI_DRIVERS})
-               -Dgallium-drivers=$(driver_list ${GALLIUM_DRIVERS})
-               -Dvulkan-drivers=$(driver_list ${VULKAN_DRIVERS})
+               -Ddri-drivers=$(driver_list "${DRI_DRIVERS[*]}")
+               -Dgallium-drivers=$(driver_list "${GALLIUM_DRIVERS[*]}")
+               -Dvulkan-drivers=$(driver_list "${VULKAN_DRIVERS[*]}")
        )
        meson_src_configure
 }
@@ -462,20 +462,20 @@ pkg_prerm() {
 dri_driver_enable() {
        if use $1; then
                shift
-               DRI_DRIVERS+="$@ "
+               DRI_DRIVERS+=("$@")
        fi
 }
 
 gallium_enable() {
        if use $1; then
                shift
-               GALLIUM_DRIVERS+="$@ "
+               GALLIUM_DRIVERS+=("$@")
        fi
 }
 
 vulkan_enable() {
        if use $1; then
                shift
-               VULKAN_DRIVERS+="$@ "
+               VULKAN_DRIVERS+=("$@")
        fi
 }

Reply via email to