dev-util/spirv-llvm-translator: streamline installation of cmdline tool
authorMarek Szuba <marecki@gentoo.org>
Thu, 4 Jul 2019 12:00:19 +0000 (13:00 +0100)
committerMarek Szuba <marecki@gentoo.org>
Thu, 4 Jul 2019 12:01:22 +0000 (13:01 +0100)
1. Use the LLVM_BUILD_TOOLS flag from the CMake module AddLLVM to
control whether to build and install llvm-spirv or not. This should also
take care of the "insecure RUNPATHs" QA warning;

2. Make the above conditional upon USE=tools.

Closes: https://bugs.gentoo.org/689242
Signed-off-by: Marek Szuba <marecki@gentoo.org>
Package-Manager: Portage-2.3.66, Repoman-2.3.11

dev-util/spirv-llvm-translator/metadata.xml
dev-util/spirv-llvm-translator/spirv-llvm-translator-8.0.1.1-r1.ebuild [new file with mode: 0644]

index d7dec83e2de9ed23cc1c1c54bbc8b64037238796..f5e348c67b5fa5140aeca670c945cfb2b8f839f5 100644 (file)
@@ -5,6 +5,11 @@
                <email>marecki@gentoo.org</email>
                <name>Marek Szuba</name>
        </maintainer>
+       <use>
+               <flag name="tools">
+                       Install the command-line translator llvm-spirv
+               </flag>
+       </use>
        <upstream>
                <remote-id type="github">KhronosGroup/SPIRV-LLVM-Translator</remote-id>
        </upstream>
diff --git a/dev-util/spirv-llvm-translator/spirv-llvm-translator-8.0.1.1-r1.ebuild b/dev-util/spirv-llvm-translator/spirv-llvm-translator-8.0.1.1-r1.ebuild
new file mode 100644 (file)
index 0000000..675e083
--- /dev/null
@@ -0,0 +1,53 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake-multilib flag-o-matic llvm
+
+MY_PN="SPIRV-LLVM-Translator"
+MY_PV="$(ver_rs 3 -)"
+MY_P="${MY_PN}-${MY_PV}"
+
+DESCRIPTION="Bi-directional translator between SPIR-V and LLVM IR"
+HOMEPAGE="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+SRC_URI="https://github.com/KhronosGroup/${MY_PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="UoI-NCSA"
+SLOT="8"
+KEYWORDS="~amd64"
+IUSE="test tools"
+
+S="${WORKDIR}/${MY_P}"
+
+COMMON="sys-devel/llvm:8=[${MULTILIB_USEDEP}]"
+DEPEND="${COMMON}
+       test? ( dev-python/lit )"
+RDEPEND="${COMMON}"
+
+LLVM_MAX_SLOT=8
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-8.0.0.1-no_pkgconfig_files.patch
+)
+
+src_prepare() {
+       append-flags -fPIC
+       cmake-utils_src_prepare
+}
+
+multilib_src_configure() {
+       local mycmakeargs=(
+               -DCMAKE_INSTALL_PREFIX="$(get_llvm_prefix)"
+               -DLLVM_BUILD_TOOLS=$(usex tools "ON" "OFF")
+               $(usex test "-DLLVM_INCLUDE_TESTS=ON" "")
+       )
+       cmake-utils_src_configure
+}
+
+multilib_src_test() {
+       # TODO: figure out why some tests fail on amd64 when ABI==x86
+       if multilib_is_native_abi; then
+               lit "${BUILD_DIR}/test" || die "Error running tests for ABI ${ABI}"
+       fi
+}