== Common uses for virtual packages ==
=== System components and services ===
One of the common uses for virtuals is to define abstract ''system services''. Those virtuals are not very specific on how those services are provided. They are mostly intended to be used in the @system package set, to ensure that the user system doesn't lack key components such as a service manager or a package manager.
=== Tools provided by multiple packages ===
This kind of virtuals is used when multiple packages may provide tools with the same names. The virtual is used in packages that rely on those tools being present, in particular when the tools are used at build-time of the package or are called by package's scripts (executables).
=== Libraries with certain degree of ABI compatibility ===
This kind of virtuals is to allow switching between multiple providers of a library. However, virtual can only be used when the various providers provide ABI-compatible variants of the same library.
Virtual ebuild should have a separate version at least for every ABI version of the library. The ebuilds should have appropriate subslots and depend on respective subslots or versions of the provider that provide the library with necessary ABI. For example, virtual/libfoo-1 depends on specific versions of libfoo providers that provide libfoo.so.1, while virtual/libfoo-2 depends on versions providing libfoo.so.2. This guarantees that the reverse dependencies of the virtual will be rebuilt when the underlying library is upgraded .