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: Sun, 02 Sep 2012 19:30:38
Message-Id: 1346614217-28662-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 It just covers the basic idea of getting includedir/libdir. As many
2 different packages require different hackeries, there is probably no
3 good way of handling that.
4
5 I'd appreciate further ideas, feedback, and possibly an example from
6 someone who will use it.
7 ---
8 gx86/eclass/boost-utils.eclass | 76 ++++++++++++++++++++++++++++++++++++++++++
9 1 file changed, 76 insertions(+)
10 create mode 100644 gx86/eclass/boost-utils.eclass
11
12 diff --git a/gx86/eclass/boost-utils.eclass b/gx86/eclass/boost-utils.eclass
13 new file mode 100644
14 index 0000000..c878b16
15 --- /dev/null
16 +++ b/gx86/eclass/boost-utils.eclass
17 @@ -0,0 +1,76 @@
18 +# Copyright 1999-2012 Gentoo Foundation
19 +# Distributed under the terms of the GNU General Public License v2
20 +# $Header: $
21 +
22 +if [[ ! ${_BOOST_ECLASS} ]]; then
23 +
24 +# @ECLASS: boost-utils.eclass
25 +# @MAINTAINER:
26 +# Michał Górny <mgorny@g.o>
27 +# Tiziano Müller <dev-zero@g.o>
28 +# Sebastian Luther <SebastianLuther@×××.de>
29 +# Arfrever Frehtes Taifersar Arahesis <arfrever.fta@×××××.com>
30 +# @BLURB: helper functions for packages using Boost C++ library
31 +# @DESCRIPTION:
32 +# Helper functions to be used when building packages using the Boost C++
33 +# library collection.
34 +
35 +case ${EAPI:-0} in
36 + 0|1|2|3|4) ;;
37 + *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
38 +esac
39 +
40 +inherit multilib versionator
41 +
42 +# @ECLASS-VARIABLE: BOOST_MAX_VERSION
43 +# @DEFAULT_UNSET
44 +# @DESCRIPTION:
45 +# The maximal (newest) boost version supported by the package. If unset,
46 +# the newest installed version will be used.
47 +#
48 +# Please note that if BOOST_MAX_VERSION is set, the package should
49 +# depend on boost packages with *exactly* that slot (i.e. boost:1.47);
50 +# otherwise, the package should depend on boost without a slot
51 +# specified (i.e. >=boost-1.45).
52 +
53 +# @FUNCTION: boost-utils_get_best_slot
54 +# @DESCRIPTION:
55 +# Get newest installed slot of Boost.
56 +boost-utils_get_best_slot() {
57 + local pkg=dev-libs/boost
58 + local atom=$(best_version ${pkg})
59 + get_version_component_range 1-2 ${atom#${pkg}}
60 +}
61 +
62 +# @FUNCTION: boost-utils_get_includedir
63 +# @USAGE: [slot]
64 +# @DESCRIPTION:
65 +# Get the includedir for given Boost slot. If no slot is given, defaults
66 +# to ${BOOST_MAX_VERSION}. If that variable is unset, newest installed
67 +# slot will be used.
68 +#
69 +# Output the sole path (without -I).
70 +boost-utils_get_includedir() {
71 + local slot=${1:-${BOOST_MAX_VERSION:-$(boost-utils_get_best_slot)}}
72 + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
73 +
74 + echo -n "${EPREFIX}/usr/include/boost-${slot/./_}"
75 +}
76 +
77 +# @FUNCTION: boost-utils_get_libdir
78 +# @USAGE: [slot]
79 +# @DESCRIPTION:
80 +# Get the libdir for given Boost slot. If no slot is given, defaults
81 +# to ${BOOST_MAX_VERSION}. If that variable is unset, newest installed
82 +# slot will be used.
83 +#
84 +# Output the sole path (without -L).
85 +boost-utils_get_libdir() {
86 + local slot=${1:-${BOOST_MAX_VERSION:-$(boost-utils_get_best_slot)}}
87 + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
88 +
89 + echo -n "${EPREFIX}/usr/$(get_libdir)/boost-${slot/./_}"
90 +}
91 +
92 +_BOOST_ECLASS=1
93 +fi # _BOOST_ECLASS
94 --
95 1.7.12