Right now, it just contains the function Tiziano listed in his post[1]. I'd appreciate further ideas, feedback, and possibly an example from someone who will actually need it. --- gx86/eclass/boost-utils.eclass | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 gx86/eclass/boost-utils.eclass
diff --git a/gx86/eclass/boost-utils.eclass b/gx86/eclass/boost-utils.eclass new file mode 100644 index 0000000..b57a400 --- /dev/null +++ b/gx86/eclass/boost-utils.eclass @@ -0,0 +1,47 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +if [[ ! ${_BOOST_ECLASS} ]]; then + +# @ECLASS: boost-utils.eclass +# @MAINTAINER: +# Michał Górny <mgo...@gentoo.org> +# Tiziano Müller <dev-z...@gentoo.org> +# Sebastian Luther <sebastianlut...@gmx.de> +# Arfrever Frehtes Taifersar Arahesis <arfrever....@gmail.com> +# @BLURB: helper functions for packages using Boost C++ library +# @DESCRIPTION: +# Helper functions to be used when building packages using the Boost C++ +# library collection. + +case ${EAPI:-0} in + 0|1|2|3|4) ;; + *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established." +esac + +inherit versionator + +# @FUNCTION: boost-utils_get_best_slot +# @DESCRIPTION: +# Get newest SLOT (major version) of Boost. +boost-utils_get_best_slot() { + local pkg=dev-libs/boost + local atom=$(best_version ${pkg}) + get_version_component_range 1-2 ${atom#${pkg}} +} + +# @FUNCTION: boost-utils_get_includedir +# @USAGE: [slot] +# @DESCRIPTION: +# Get the includedir for given Boost slot, or the best slot installed +# (if no slot given). Outputs the sole path (without -I). +boost-utils_get_includedir() { + local slot=${1:-$(boost-utils_get_best_slot)} + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= + + echo -n "${EPREFIX}/usr/include/boost-${slot/./_}" +} + +_BOOST_ECLASS=1 +fi # _BOOST_ECLASS -- 1.7.12