Project:LLVM/Ebuild Guide

This document provides a complete guide on how to write ebuilds on LLVM reverse dependencies, how to depend on LLVM and how to use llvm.eclass. It aims to cover all the facts on a single page, in a clear, explanatory way. Examples included.

Basic dependency notes
The and  packages provide both sets of shared libraries for program use, and an executable toolchain. The slot/subslot is used to indicate the library ABI version (which needs to match between LLVM and clang), and the multilib ABI flags are used to indicate which multilib libraries are installed. The toolchain unconditionally supports all ABIs for the target.

Simply put:
 * 1) if you link to LLVM (clang) libraries, you need to use the := slot operator in the LLVM (clang) dependency. If your package is multilib, you also need to use [${MULTILIB_USEDEP}];
 * 2) if you just use the tooling, you need to use the :* slot operator, and no multilib deps.

LLVM versions below 4 used to integrate the clang compiler under USE=clang. This is no longer the case, and all past versions were accustomed with metapackage. If you need clang, you need to depend on that package instead.

If your tool requires specific LLVM targets other than the native one, it should list those targets in USE dependency using the LLVM_TARGETS flags. Those flags are supported since LLVM 3.9. If your package requires older version of LLVM, you can depend on USE=multitarget instead. However, please do not depend on this flag in new packages since it is inconvenient for users and will be phased out.