Signed-off-by: Michał Górny <
mgorny@gentoo.org>
---
eclass/llvm-r2.eclass | 173 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 172 insertions(+), 1 deletion(-)
diff --git a/eclass/llvm-r2.eclass b/eclass/llvm-r2.eclass
index 91e841821331..e499f9dba38d 100644
--- a/eclass/llvm-r2.eclass
+++ b/eclass/llvm-r2.eclass
@@ -216,6 +216,162 @@ get_llvm_prefix() {
echo "${prefix}/usr/lib/llvm/${LLVM_SLOT}"
}
+# @FUNCTION: generate_llvm_config
+# @DESCRIPTION:
+# Output a llvm-config compatible script that yields paths specific
+# to the requested LLVM version.
+generate_llvm_config() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local bindir=$(get_llvm_prefix -b)/bin
+ [[ ! -d ${bindir} ]] && bindir=
+
+ local prefix=$(get_llvm_prefix -d)
+ local includedir=${prefix}/include
+ local libdir=${prefix}/$(get_libdir)
+ local cmake_conf=${libdir}/cmake/llvm/LLVMConfig.cmake
+ if [[ ! -f ${cmake_conf} ]]; then
+ cat <<-EOF
+ #!/usr/bin/env sh
+ echo "LLVM ${LLVM_SLOT} not installed for ABI=${ABI}" >&2
+ exit 127
+