#tests fail pretty bad and I'm not fixing them right now
RESTRICT="test"
# Minimal supported version of Qt.
QT_PV="$(ver_cut 1-2):5"
# Since Clang is required at both build- and runtime, BDEPEND is omitted here.
RDEPEND="${PYTHON_DEPS}
>=dev-qt/qtcore-${QT_PV}
>=sys-devel/clang-6:=
docstrings? (
>=dev-libs/libxml2-2.6.32
>=dev-libs/libxslt-1.1.19
>=dev-qt/qtxml-${QT_PV}
>=dev-qt/qtxmlpatterns-${QT_PV}
)
numpy? ( dev-python/numpy[${PYTHON_USEDEP}])
vulkan? ( dev-util/vulkan-headers )
"
DEPEND="${RDEPEND}
test? ( >=dev-qt/qttest-${QT_PV})
"
S=${WORKDIR}/${MY_P}/sources/shiboken2
DOCS=( AUTHORS )
# Ensure the path returned by get_llvm_prefix() contains clang as well.
llvm_check_deps(){
has_version "sys-devel/clang:${LLVM_SLOT}"
}
src_prepare(){
# TODO: File upstream issue requesting a sane way to disable NumPy support.
if ! use numpy;then
sed -i -e '/\bprint(os\.path\.realpath(numpy))/d'\
libshiboken/CMakeLists.txt || die
fi
# Shiboken2 assumes Vulkan headers live under either "$VULKAN_SDK/include"
# or "$VK_SDK_PATH/include" rather than "${EPREFIX}/usr/include/vulkan".
if use vulkan;then
sed -i -e 's~\bdetectVulkan(&headerPaths);~headerPaths.append(HeaderPath{QByteArrayLiteral("'${EPREFIX}'/usr/include/vulkan"), HeaderType::System});~'\
ApiExtractor/clangparser/compilersupport.cpp || die
fi
# Shiboken2 assumes the "/usr/lib/clang/${CLANG_NEWEST_VERSION}/include/"
# subdirectory provides Clang builtin includes (e.g., "stddef.h") for the
# currently installed version of Clang, where ${CLANG_NEWEST_VERSION} is
# the largest version specifier that exists under the "/usr/lib/clang/"
# subdirectory. This assumption is false in edge cases, including when
# users downgrade from newer Clang versions but fail to remove those
# versions with "emerge --depclean". See also:
# https://github.com/leycec/raiagent/issues/85
#
# Sadly, the clang-* family of functions exported by the "toolchain-funcs"
# eclass are defective, returning nonsensical placeholder strings if the
# end user has *NOT* explicitly configured their C++ compiler to be Clang.
# PySide2 does *NOT* care whether the end user has done so or not, as
# PySide2 unconditionally requires Clang in either case. This requires us
# to temporarily coerce the "${CPP}" environment variable identifying the
# current C++ compiler to "clang" immediately *BEFORE* calling such a
# function and then restoring that variable to its prior state immediately
# *AFTER* returning from that function call merely to force the
# clang-fullversion() function called below to return sanity. See also:
# https://bugs.gentoo.org/619490
_CPP_old="$(tc-getCPP)"
CPP=clang
sed -i -e 's~(findClangBuiltInIncludesDir())~(QStringLiteral("'${EPREFIX}'/usr/lib/clang/'$(clang-fullversion)'/include"))~'\
ApiExtractor/clangparser/compilersupport.cpp || die