On Tue, 30 Jan 2007 06:27:49 +0000
Ciaran McCreesh <[EMAIL PROTECTED]> wrote:

> [ Background: tr1 is a set of extensions to the C++ Standard Library
> giving various useful things like hash tables and smart pointers.
> There are partial implementations included in g++-4.1 and boost and
> full implementations available from Dinkumware. It is likely that a
> lot of C++ apps will start using it in the not too distant future. ]
> 
> What is the best way to handle packages that require parts of tr1?

Dunno what's best, but I think I'd do something like:


inherit ... toolchain-funcs versionator ...
...
IUSE=... boost-tr1 ...
...
DEPEND= ... boost-tr1? ( dev-libs/boost ) ...
...
pkg_setup() {
    use boost && return 0;
    version_is_at_least "4.1" $(gcc-version) && return 0
    elog "Without boost, this package needs >=gcc-4.1, for tr1 support."
    elog "Either switch to gcc-4.1 or higher via gcc-config, or specify"
    elog "the boost-tr1 USE flag."
    die "<pkg> needs USE=boost-tr1 or >=gcc-4.1, for tr1 support."
}
...

use.(local.)desc:
(<CP>:)boost-tr1 - Use boost library for tr1 support (otherwise needs gcc-4.1 
or higher)

Profiles that don't support gcc-4.1 could add it to their use.defaults.


I'd also ensure the build process always uses the boost library if
USE=boost-tr1 is specified, and always uses gcc-4.1 library if
boost-tr1 is not specified (so that if you say USE=boost-tr1,
you get it even if the active compiler provides tr1).   The idea
being to avoid dependencies on the host build system, where
that's reasonable.

-- 
Kevin F. Quinn

Attachment: signature.asc
Description: PGP signature

Reply via email to