2023-10-28 04:27:09 +00:00
|
|
|
# Copyright 1999-2023 Gentoo Authors
|
|
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
|
|
|
|
EAPI=8
|
|
|
|
|
|
|
|
PYTHON_COMPAT=( python3_{10..11} )
|
|
|
|
|
|
|
|
inherit check-reqs python-any-r1 cmake-multilib
|
|
|
|
|
|
|
|
DESCRIPTION="AMD Open Source Driver for Vulkan"
|
|
|
|
HOMEPAGE="https://github.com/GPUOpen-Drivers/AMDVLK"
|
|
|
|
LICENSE="MIT"
|
|
|
|
SLOT="0"
|
|
|
|
KEYWORDS=""
|
2023-10-28 04:55:43 +00:00
|
|
|
IUSE="wayland"
|
2023-10-28 04:27:09 +00:00
|
|
|
|
|
|
|
BUNDLED_LLVM_DEPEND="sys-libs/zlib:0=[${MULTILIB_USEDEP}]"
|
|
|
|
DEPEND="wayland? ( dev-libs/wayland[${MULTILIB_USEDEP}] )
|
|
|
|
${BUNDLED_LLVM_DEPEND}
|
|
|
|
>=dev-util/vulkan-headers-1.3.224
|
|
|
|
dev-util/glslang[${MULTILIB_USEDEP}]"
|
|
|
|
BDEPEND="${BUNDLED_LLVM_DEPEND}
|
|
|
|
${PYTHON_DEPS}
|
|
|
|
dev-util/cmake
|
|
|
|
virtual/linux-sources"
|
|
|
|
RDEPEND=" ${DEPEND}
|
|
|
|
x11-libs/libdrm[${MULTILIB_USEDEP}]
|
|
|
|
x11-libs/libXrandr[${MULTILIB_USEDEP}]
|
|
|
|
x11-libs/libxcb[${MULTILIB_USEDEP}]
|
|
|
|
x11-libs/libxshmfence[${MULTILIB_USEDEP}]
|
|
|
|
>=media-libs/vulkan-loader-1.3.224[${MULTILIB_USEDEP}]
|
|
|
|
dev-util/glslang[${MULTILIB_USEDEP}]
|
|
|
|
dev-libs/openssl[${MULTILIB_USEDEP}]" #890449
|
|
|
|
|
|
|
|
CHECKREQS_MEMORY="7G"
|
|
|
|
CHECKREQS_DISK_BUILD="4G"
|
|
|
|
S="${WORKDIR}"
|
|
|
|
CMAKE_USE_DIR="${S}/xgl"
|
|
|
|
CMAKE_MAKEFILE_GENERATOR=ninja
|
|
|
|
|
|
|
|
### SOURCE CODE PER_VERSION VARIABLES
|
|
|
|
FETCH_URI="https://github.com/GPUOpen-Drivers"
|
|
|
|
## For those who wants update ebuild: check https://github.com/GPUOpen-Drivers/AMDVLK/blob/${VERSION}/default.xml
|
|
|
|
## e.g. https://github.com/GPUOpen-Drivers/AMDVLK/blob/v-2022.Q3.5/default.xml
|
|
|
|
## and place commits in the desired variables
|
|
|
|
## EXAMPLE: XGL_COMMIT="80e5a4b11ad2058097e77746772ddc9ab2118e07"
|
|
|
|
## SRC_URI="... ${FETCH_URI}/$PART/archive/$COMMIT.zip -> $PART-$COMMIT.zip ..."
|
|
|
|
XGL_COMMIT="14397c77fbc0c760397dd3162482407b2721a825"
|
|
|
|
PAL_COMMIT="02ac99ba650afb3aebff3eb8006862ce93d31968"
|
|
|
|
LLPC_COMMIT="c89f405e3632f0b639faafe61cd03cb851492f4e"
|
|
|
|
LLVM_PROJECT_COMMIT="a85ea7baf89016f72d7cb7c94db4c996d70d9898"
|
|
|
|
METROHASH_COMMIT="3c566dd9cda44ca7fd97659e0b53ac953f9037d2"
|
|
|
|
CWPACK_COMMIT="7387247eb9889ddcabbc1053b9c2052e253b088e"
|
|
|
|
### end of variables
|
|
|
|
SRC_URI="${FETCH_URI}/xgl/archive/${XGL_COMMIT}.tar.gz -> amdvlk-xgl-${XGL_COMMIT}.tar.gz
|
|
|
|
${FETCH_URI}/pal/archive/${PAL_COMMIT}.tar.gz -> amdvlk-pal-${PAL_COMMIT}.tar.gz
|
|
|
|
${FETCH_URI}/llpc/archive/${LLPC_COMMIT}.tar.gz -> amdvlk-llpc-${LLPC_COMMIT}.tar.gz
|
|
|
|
${FETCH_URI}/llvm-project/archive/${LLVM_PROJECT_COMMIT}.tar.gz -> amdvlk-llvm-project-${LLVM_PROJECT_COMMIT}.tar.gz
|
|
|
|
${FETCH_URI}/MetroHash/archive/${METROHASH_COMMIT}.tar.gz -> amdvlk-MetroHash-${METROHASH_COMMIT}.tar.gz
|
|
|
|
${FETCH_URI}/CWPack/archive/${CWPACK_COMMIT}.tar.gz -> amdvlk-CWPack-${CWPACK_COMMIT}.tar.gz"
|
|
|
|
|
|
|
|
pkg_pretend(){
|
|
|
|
ewarn "It's generally recomended to have at least 16GB memory to build"
|
|
|
|
ewarn "However, experiments shows that if you'll use MAKEOPTS=\"-j1\" you can build it with 4GB RAM"
|
|
|
|
ewarn "or you can use MAKEOPTS=\"-j3\" with 7.5GB system memory"
|
|
|
|
ewarn "See https://wiki.gentoo.org/wiki/AMDVLK#Additional_system_requirements_to_build"
|
|
|
|
ewarn "Use CHECKREQS_DONOTHING=1 if you need to bypass memory checking"
|
|
|
|
|
|
|
|
check-reqs_pkg_pretend
|
|
|
|
}
|
|
|
|
|
|
|
|
src_prepare() {
|
|
|
|
einfo "moving src to proper directories"
|
|
|
|
mkdir third_party || die
|
|
|
|
mv xgl-${XGL_COMMIT}/ xgl || die
|
|
|
|
mv pal-${PAL_COMMIT}/ pal || die
|
|
|
|
mv llpc-${LLPC_COMMIT}/ llpc || die
|
|
|
|
mv llvm-project-${LLVM_PROJECT_COMMIT}/ llvm-project || die
|
|
|
|
mv MetroHash-${METROHASH_COMMIT}/ third_party/metrohash || die
|
|
|
|
mv CWPack-${CWPACK_COMMIT}/ third_party/cwpack || die
|
|
|
|
cmake_src_prepare
|
|
|
|
}
|
|
|
|
|
|
|
|
multilib_src_configure() {
|
|
|
|
sed -i -e '/target_compile_options.*msse/d' -e '/-mpreferred-stack-boundary=/d' "${WORKDIR}/xgl/cmake/XglCompilerOptions.cmake"
|
2023-10-28 04:55:43 +00:00
|
|
|
local -x CXXFLAGS="${CXXFLAGS} -include ctime -include cstdint"
|
2023-10-28 04:27:09 +00:00
|
|
|
local mycmakeargs=(
|
|
|
|
-DBUILD_WAYLAND_SUPPORT=$(usex wayland)
|
|
|
|
-DLLVM_HOST_TRIPLE="${CHOST}"
|
|
|
|
-DLLVM_ENABLE_WERROR=OFF
|
|
|
|
-DENABLE_WERROR=OFF
|
|
|
|
-DVAM_ENABLE_WERROR=OFF
|
|
|
|
-DICD_ANALYSIS_WARNINGS_AS_ERRORS=OFF
|
|
|
|
-DMETROHASH_ENABLE_WERROR=OFF
|
|
|
|
-DBUILD_SHARED_LIBS=OFF #LLVM parts don't support shared libs
|
|
|
|
-DPython3_EXECUTABLE="${PYTHON}"
|
|
|
|
-DPACKAGE_VERSION="${PV}"
|
|
|
|
-DPACKAGE_NAME="${PN}"
|
|
|
|
-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON #Disable installation of various LLVM parts which we had to clean up.
|
|
|
|
-Wno-dev
|
|
|
|
)
|
|
|
|
cmake_src_configure
|
|
|
|
}
|
|
|
|
|
|
|
|
multilib_src_install() {
|
|
|
|
cmake_src_install # --component icd
|
|
|
|
rm "${ED}/${WORKDIR}/xgl/lib/RelWithDebInfo/amdvlk*.so"
|
|
|
|
}
|
|
|
|
|
|
|
|
multilib_check_headers() {
|
|
|
|
einfo "Checking headers skipped: there is no headers"
|
|
|
|
}
|
|
|
|
|
|
|
|
multilib_src_install_all() {
|
|
|
|
default
|
|
|
|
einfo "Removing unused LLVM parts…"
|
|
|
|
rm "${ED}"/usr/lib/libLTO* || die "Can't remove unused LLVM lto library"
|
|
|
|
rm "${ED}"/usr/lib/libRemarks* || die "Can't remove unused LLVM libRemarks library"
|
|
|
|
rm -r "${ED}"/usr/lib/cmake || die "Can't remove unused LLVM cmake folder"
|
|
|
|
einfo "Removal done"
|
|
|
|
}
|
|
|
|
|
|
|
|
pkg_postinst() {
|
|
|
|
ewarn "Make sure the following line is NOT included in the any Xorg configuration section:"
|
|
|
|
ewarn "| Driver \"modesetting\""
|
|
|
|
ewarn "and make sure you use DRI3 mode for Xorg (not revelant for wayland)"
|
|
|
|
elog "More information about the configuration can be found here:"
|
|
|
|
elog "https://github.com/GPUOpen-Drivers/AMDVLK"
|
2023-10-28 04:55:43 +00:00
|
|
|
elog "VK_ICD_FILENAMES=/etc/vulkan/icd.d/amd_icd64.json - to use amdvlk."
|
|
|
|
elog "VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/radeon_icd.$(uname -m).json - to use radv."
|
2023-10-28 04:27:09 +00:00
|
|
|
}
|