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: Mon, 27 Aug 2012 22:19:43
Message-Id: 1346105968-14522-1-git-send-email-mgorny@gentoo.org
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 | 43 ++++++++++++++++++++++++++++++++++++++++++
6 1 file changed, 43 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..b5a9f55
12 --- /dev/null
13 +++ b/gx86/eclass/boost-utils.eclass
14 @@ -0,0 +1,43 @@
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 +# mgorny@g.o
24 +# @BLURB: helper functions for packages using Boost C++ library
25 +# @DESCRIPTION:
26 +# Helper functions to be used when building packages using the Boost C++
27 +# library collection.
28 +
29 +case ${EAPI:-0} in
30 + 0|1|2|3|4) ;;
31 + *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
32 +esac
33 +
34 +inherit versionator
35 +
36 +# @FUNCTION: boost-utils_get_best_slot
37 +# @DESCRIPTION:
38 +# Get newest SLOT (major version) of Boost.
39 +boost-utils_get_best_slot() {
40 + local pkg=dev-libs/boost
41 + local atom=$(best_version ${pkg})
42 + get_version_component_range 1-2 ${atom#${pkg}}
43 +}
44 +
45 +# @FUNCTION: boost-utils_get_includedir
46 +# @DESCRIPTION:
47 +# Get correct includedir for best Boost version. Outputs the sole path
48 +# (without -I).
49 +boost-utils_get_includedir() {
50 + local slot=$(boost-utils_get_best_slot)
51 + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
52 +
53 + echo -n "${EPREFIX}/usr/include/boost-${slot/./_}"
54 +}
55 +
56 +_BOOST_ECLASS=1
57 +fi # _BOOST_ECLASS
58 --
59 1.7.12

Replies