• [gentoo-dev] [PATCH 07/11] llvm-r2.eclass: Generate a llvm-config scrip

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sat Dec 21 17:10:02 2024
    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
    +