commit:     762ab8535fc247cbef6cb607c7ebca2e468c8c2d
Author:     Nick Sarnie <sarnex <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 12 00:33:08 2018 +0000
Commit:     Nick Sarnie <sarnex <AT> gentoo <DOT> org>
CommitDate: Thu Jul 12 00:42:40 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=762ab853

dev-util/vulkan-tools: Fix build without X

Added the cube and vulkaninfo USE flags

Vulkaninfo does not support wayland upstream

If X is set at all, XCB will be used

Thanks to hanetzer in #gentoo-desktop for testing

Fixes: https://bugs.gentoo.org/660694
Package-Manager: Portage-2.3.42, Repoman-2.3.9

 dev-util/vulkan-tools/metadata.xml                 |  4 +++
 .../vulkan-tools/vulkan-tools-1.1.77.0-r1.ebuild   | 27 ++++++++++++++-
 dev-util/vulkan-tools/vulkan-tools-9999.ebuild     | 38 +++++++++++++++++++++-
 3 files changed, 67 insertions(+), 2 deletions(-)

diff --git a/dev-util/vulkan-tools/metadata.xml 
b/dev-util/vulkan-tools/metadata.xml
index a670686d9eb..bee42ed5665 100644
--- a/dev-util/vulkan-tools/metadata.xml
+++ b/dev-util/vulkan-tools/metadata.xml
@@ -9,6 +9,10 @@
                <email>[email protected]</email>
                <name>Nick Sarnie</name>
        </maintainer>
+       <use>
+               <flag name="cube">Build the cube/cubepp demos</flag>
+               <flag name="vulkaninfo">Build the vulkaninfo utility</flag>
+       </use>
        <upstream>
                <remote-id type="github">KhronosGroup/Vulkan-Tools</remote-id>
        </upstream>

diff --git a/dev-util/vulkan-tools/vulkan-tools-1.1.77.0-r1.ebuild 
b/dev-util/vulkan-tools/vulkan-tools-1.1.77.0-r1.ebuild
index fcd605b2064..2215b2e1cc5 100644
--- a/dev-util/vulkan-tools/vulkan-tools-1.1.77.0-r1.ebuild
+++ b/dev-util/vulkan-tools/vulkan-tools-1.1.77.0-r1.ebuild
@@ -22,7 +22,7 @@ HOMEPAGE="https://github.com/KhronosGroup/Vulkan-Tools";
 
 LICENSE="Apache-2.0"
 SLOT="0"
-IUSE="X wayland"
+IUSE="+cube +vulkaninfo X wayland"
 
 # Old packaging will cause file collisions
 RDEPEND="!<=media-libs/vulkan-loader-1.1.70.0-r999"
@@ -36,9 +36,15 @@ DEPEND="${PYTHON_DEPS}
                x11-libs/libXrandr:=[${MULTILIB_USEDEP}]
           )"
 
+# Vulkaninfo does not support wayland
+REQUIRED_USE="|| ( X wayland )
+                         vulkaninfo? ( X )"
+
 multilib_src_configure() {
        local mycmakeargs=(
                -DCMAKE_SKIP_RPATH=True
+               -DBUILD_CUBE=$(usex cube)
+               -DBUILD_VULKANINFO=$(usex vulkaninfo)
                -DBUILD_WSI_MIR_SUPPORT=False
                -DBUILD_WSI_WAYLAND_SUPPORT=$(usex wayland)
                -DBUILD_WSI_XCB_SUPPORT=$(usex X)
@@ -46,6 +52,25 @@ multilib_src_configure() {
                -DGLSLANG_INSTALL_DIR="/usr"
                -DVULKAN_HEADERS_INSTALL_DIR="/usr"
        )
+
+       # Upstream only supports one window system at a time
+       # If X is set at all, even if wayland is set, use X
+       #
+       # If -cube and/or -vulkaninfo is set, the flags we set
+       # are ignored, so we don't need to consider that
+       if use X; then
+               mycmakeargs+=(
+                       -DCUBE_WSI_SELECTION="XCB"
+                       -DVULKANINFO_WSI_SELECTION="XCB"
+               )
+       fi
+
+       if ! use X && use wayland; then
+               mycmakeargs+=(
+                       -DCUBE_WSI_SELECTION="WAYLAND"
+               )
+       fi
+
        cmake-utils_src_configure
 }
 

diff --git a/dev-util/vulkan-tools/vulkan-tools-9999.ebuild 
b/dev-util/vulkan-tools/vulkan-tools-9999.ebuild
index 3ffd734f550..2215b2e1cc5 100644
--- a/dev-util/vulkan-tools/vulkan-tools-9999.ebuild
+++ b/dev-util/vulkan-tools/vulkan-tools-9999.ebuild
@@ -22,7 +22,7 @@ HOMEPAGE="https://github.com/KhronosGroup/Vulkan-Tools";
 
 LICENSE="Apache-2.0"
 SLOT="0"
-IUSE="X wayland"
+IUSE="+cube +vulkaninfo X wayland"
 
 # Old packaging will cause file collisions
 RDEPEND="!<=media-libs/vulkan-loader-1.1.70.0-r999"
@@ -36,9 +36,15 @@ DEPEND="${PYTHON_DEPS}
                x11-libs/libXrandr:=[${MULTILIB_USEDEP}]
           )"
 
+# Vulkaninfo does not support wayland
+REQUIRED_USE="|| ( X wayland )
+                         vulkaninfo? ( X )"
+
 multilib_src_configure() {
        local mycmakeargs=(
                -DCMAKE_SKIP_RPATH=True
+               -DBUILD_CUBE=$(usex cube)
+               -DBUILD_VULKANINFO=$(usex vulkaninfo)
                -DBUILD_WSI_MIR_SUPPORT=False
                -DBUILD_WSI_WAYLAND_SUPPORT=$(usex wayland)
                -DBUILD_WSI_XCB_SUPPORT=$(usex X)
@@ -46,5 +52,35 @@ multilib_src_configure() {
                -DGLSLANG_INSTALL_DIR="/usr"
                -DVULKAN_HEADERS_INSTALL_DIR="/usr"
        )
+
+       # Upstream only supports one window system at a time
+       # If X is set at all, even if wayland is set, use X
+       #
+       # If -cube and/or -vulkaninfo is set, the flags we set
+       # are ignored, so we don't need to consider that
+       if use X; then
+               mycmakeargs+=(
+                       -DCUBE_WSI_SELECTION="XCB"
+                       -DVULKANINFO_WSI_SELECTION="XCB"
+               )
+       fi
+
+       if ! use X && use wayland; then
+               mycmakeargs+=(
+                       -DCUBE_WSI_SELECTION="WAYLAND"
+               )
+       fi
+
        cmake-utils_src_configure
 }
+
+multilib_src_install() {
+       default
+       mv "${ED%/}"/usr/bin/cube "${ED%/}"/usr/bin/vulkancube || die
+       mv "${ED%/}"/usr/bin/cubepp "${ED%/}"/usr/bin/vulkancubecpp || die
+}
+
+pkg_postinst() {
+       einfo "The cube and cubepp demos have been renamed to"
+       einfo "vulkancube and vulkancubecpp to prevent collisions"
+}

Reply via email to