1 |
On Tue, 30 Jan 2007 06:27:49 +0000 |
2 |
Ciaran McCreesh <ciaranm@×××××××.org> wrote: |
3 |
|
4 |
> [ Background: tr1 is a set of extensions to the C++ Standard Library |
5 |
> giving various useful things like hash tables and smart pointers. |
6 |
> There are partial implementations included in g++-4.1 and boost and |
7 |
> full implementations available from Dinkumware. It is likely that a |
8 |
> lot of C++ apps will start using it in the not too distant future. ] |
9 |
> |
10 |
> What is the best way to handle packages that require parts of tr1? |
11 |
|
12 |
Dunno what's best, but I think I'd do something like: |
13 |
|
14 |
|
15 |
inherit ... toolchain-funcs versionator ... |
16 |
... |
17 |
IUSE=... boost-tr1 ... |
18 |
... |
19 |
DEPEND= ... boost-tr1? ( dev-libs/boost ) ... |
20 |
... |
21 |
pkg_setup() { |
22 |
use boost && return 0; |
23 |
version_is_at_least "4.1" $(gcc-version) && return 0 |
24 |
elog "Without boost, this package needs >=gcc-4.1, for tr1 support." |
25 |
elog "Either switch to gcc-4.1 or higher via gcc-config, or specify" |
26 |
elog "the boost-tr1 USE flag." |
27 |
die "<pkg> needs USE=boost-tr1 or >=gcc-4.1, for tr1 support." |
28 |
} |
29 |
... |
30 |
|
31 |
use.(local.)desc: |
32 |
(<CP>:)boost-tr1 - Use boost library for tr1 support (otherwise needs gcc-4.1 or higher) |
33 |
|
34 |
Profiles that don't support gcc-4.1 could add it to their use.defaults. |
35 |
|
36 |
|
37 |
I'd also ensure the build process always uses the boost library if |
38 |
USE=boost-tr1 is specified, and always uses gcc-4.1 library if |
39 |
boost-tr1 is not specified (so that if you say USE=boost-tr1, |
40 |
you get it even if the active compiler provides tr1). The idea |
41 |
being to avoid dependencies on the host build system, where |
42 |
that's reasonable. |
43 |
|
44 |
-- |
45 |
Kevin F. Quinn |