Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] boost-utils.eclass -- for building against newest boost.
Date: Fri, 31 Aug 2012 09:28:54
Message-Id: 1346405250-9702-1-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH] boost-utils.eclass -- for building against newest boost. by "Michał Górny"
1 Right now, it just contains the function Tiziano listed in his post[1].
2 I'd appreciate further ideas, feedback, and possibly an example from
3 someone who will actually need it.
4 ---
5 gx86/eclass/boost-utils.eclass | 47 ++++++++++++++++++++++++++++++++++++++++++
6 1 file changed, 47 insertions(+)
7 create mode 100644 gx86/eclass/boost-utils.eclass
8
9 diff --git a/gx86/eclass/boost-utils.eclass b/gx86/eclass/boost-utils.eclass
10 new file mode 100644
11 index 0000000..b57a400
12 --- /dev/null
13 +++ b/gx86/eclass/boost-utils.eclass
14 @@ -0,0 +1,47 @@
15 +# Copyright 1999-2012 Gentoo Foundation
16 +# Distributed under the terms of the GNU General Public License v2
17 +# $Header: $
18 +
19 +if [[ ! ${_BOOST_ECLASS} ]]; then
20 +
21 +# @ECLASS: boost-utils.eclass
22 +# @MAINTAINER:
23 +# Michał Górny <mgorny@g.o>
24 +# Tiziano Müller <dev-zero@g.o>
25 +# Sebastian Luther <SebastianLuther@×××.de>
26 +# Arfrever Frehtes Taifersar Arahesis <arfrever.fta@×××××.com>
27 +# @BLURB: helper functions for packages using Boost C++ library
28 +# @DESCRIPTION:
29 +# Helper functions to be used when building packages using the Boost C++
30 +# library collection.
31 +
32 +case ${EAPI:-0} in
33 + 0|1|2|3|4) ;;
34 + *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
35 +esac
36 +
37 +inherit versionator
38 +
39 +# @FUNCTION: boost-utils_get_best_slot
40 +# @DESCRIPTION:
41 +# Get newest SLOT (major version) of Boost.
42 +boost-utils_get_best_slot() {
43 + local pkg=dev-libs/boost
44 + local atom=$(best_version ${pkg})
45 + get_version_component_range 1-2 ${atom#${pkg}}
46 +}
47 +
48 +# @FUNCTION: boost-utils_get_includedir
49 +# @USAGE: [slot]
50 +# @DESCRIPTION:
51 +# Get the includedir for given Boost slot, or the best slot installed
52 +# (if no slot given). Outputs the sole path (without -I).
53 +boost-utils_get_includedir() {
54 + local slot=${1:-$(boost-utils_get_best_slot)}
55 + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
56 +
57 + echo -n "${EPREFIX}/usr/include/boost-${slot/./_}"
58 +}
59 +
60 +_BOOST_ECLASS=1
61 +fi # _BOOST_ECLASS
62 --
63 1.7.12

Replies