dev-util/vulkan-tools: Fix dependencies
[gentoo.git] / dev-util / vulkan-tools / vulkan-tools-1.1.82.0.ebuild
1 # Copyright 1999-2018 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 PYTHON_COMPAT=( python3_{5,6} )
6
7 if [[ "${PV}" == "9999" ]]; then
8         EGIT_REPO_URI="https://github.com/KhronosGroup/Vulkan-Tools.git"
9         EGIT_SUBMODULES=()
10         inherit git-r3
11 else
12         EGIT_COMMIT="2cfddd146d666efe0ed06ef1d2bc5565821df144"
13         KEYWORDS="~amd64"
14         SRC_URI="https://github.com/KhronosGroup/Vulkan-Tools/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
15         S="${WORKDIR}/Vulkan-Tools-${EGIT_COMMIT}"
16 fi
17
18 inherit python-any-r1 cmake-multilib
19
20 DESCRIPTION="Official Vulkan Tools and Utilities for Windows, Linux, Android, and MacOS"
21 HOMEPAGE="https://github.com/KhronosGroup/Vulkan-Tools"
22
23 LICENSE="Apache-2.0"
24 SLOT="0"
25 IUSE="+cube +vulkaninfo X wayland"
26
27 DEPEND="${PYTHON_DEPS}
28         cube? ( dev-util/glslang:=[${MULTILIB_USEDEP}] )
29         dev-util/vulkan-headers
30         media-libs/vulkan-loader:=[${MULTILIB_USEDEP},wayland?,X?]
31         wayland? ( dev-libs/wayland:=[${MULTILIB_USEDEP}] )
32         X? (
33                 x11-libs/libX11:=[${MULTILIB_USEDEP}]
34                 x11-libs/libXrandr:=[${MULTILIB_USEDEP}]
35            )"
36
37 # Vulkaninfo does not support wayland
38 REQUIRED_USE="|| ( X wayland )
39                           vulkaninfo? ( X )"
40
41 pkg_setup() {
42         MULTILIB_CHOST_TOOLS=()
43
44         if use vulkaninfo; then
45                 MULTILIB_CHOST_TOOLS+=( /usr/bin/vulkaninfo )
46         fi
47
48         if use cube; then
49                 MULTILIB_CHOST_TOOLS+=(
50                         /usr/bin/vulkancube
51                         /usr/bin/vulkancubecpp
52                 )
53         fi
54
55         python-any-r1_pkg_setup
56 }
57
58 multilib_src_configure() {
59         local mycmakeargs=(
60                 -DCMAKE_SKIP_RPATH=True
61                 -DBUILD_CUBE=$(usex cube)
62                 -DBUILD_VULKANINFO=$(usex vulkaninfo)
63                 -DBUILD_WSI_MIR_SUPPORT=False
64                 -DBUILD_WSI_WAYLAND_SUPPORT=$(usex wayland)
65                 -DBUILD_WSI_XCB_SUPPORT=$(usex X)
66                 -DBUILD_WSI_XLIB_SUPPORT=$(usex X)
67                 -DGLSLANG_INSTALL_DIR="/usr"
68                 -DVULKAN_HEADERS_INSTALL_DIR="/usr"
69         )
70
71         # Upstream only supports one window system at a time
72         # If X is set at all, even if wayland is set, use X
73         #
74         # If -cube and/or -vulkaninfo is set, the flags we set
75         # are ignored, so we don't need to consider that
76         if use X; then
77                 mycmakeargs+=(
78                         -DCUBE_WSI_SELECTION="XCB"
79                         -DVULKANINFO_WSI_SELECTION="XCB"
80                 )
81         fi
82
83         if ! use X && use wayland; then
84                 mycmakeargs+=(
85                         -DCUBE_WSI_SELECTION="WAYLAND"
86                 )
87         fi
88
89         cmake-utils_src_configure
90 }
91
92 multilib_src_install() {
93         cmake-utils_src_install
94
95         if use cube; then
96                 mv "${ED%/}"/usr/bin/cube "${ED%/}"/usr/bin/vulkancube || die
97                 mv "${ED%/}"/usr/bin/cubepp "${ED%/}"/usr/bin/vulkancubecpp || die
98         fi
99 }
100
101 pkg_postinst() {
102         einfo "The cube and cubepp demos have been renamed to"
103         einfo "vulkancube and vulkancubecpp to prevent collisions"
104 }