Now with a handy function for cmake & autotools! And a more complete
description.
---
 gx86/eclass/boost-utils.eclass | 99 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 99 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..c720fe7
--- /dev/null
+++ b/gx86/eclass/boost-utils.eclass
@@ -0,0 +1,99 @@
+# 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.
+#
+# For cmake & autotools it is usually necessary to set BOOST_ROOT using
+# boost-utils_export_root. However, other build system may require more
+# hackery or even appending -I$(boost-utils_get_includedir) to CFLAGS
+# and -L$(boost-utils_get_libdir) to LDFLAGS.
+#
+# If the package supports the newest version of boost, it should depend
+# on >=dev-libs/boost-x.y.z (min version) or just dev-libs/boost. If it
+# doesn't, you should set BOOST_MAX_VERSION (or just pass the correct
+# slot to the used function) and depend on dev-libs/boost:x.y.
+
+case ${EAPI:-0} in
+       0|1|2|3|4) ;;
+       *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
+esac
+
+inherit multilib versionator
+
+# @ECLASS-VARIABLE: BOOST_MAX_VERSION
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The maximal (newest) boost version supported by the package. If unset,
+# the newest installed version will be used.
+#
+# Please note that if BOOST_MAX_VERSION is set, the package should
+# depend on boost packages with *exactly* that slot (i.e. boost:1.47);
+# otherwise, the package should depend on boost without a slot
+# specified (i.e. >=boost-1.45).
+
+# @FUNCTION: boost-utils_get_best_slot
+# @DESCRIPTION:
+# Get newest installed slot 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 the given Boost slot. If no slot is given,
+# defaults to ${BOOST_MAX_VERSION}. If that variable is unset,
+# the newest installed slot will be used.
+#
+# Outputs the sole path (without -I).
+boost-utils_get_includedir() {
+       local slot=${1:-${BOOST_MAX_VERSION:-$(boost-utils_get_best_slot)}}
+       has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
+
+       echo -n "${EPREFIX}/usr/include/boost-${slot/./_}"
+}
+
+# @FUNCTION: boost-utils_get_libdir
+# @USAGE: [slot]
+# @DESCRIPTION:
+# Get the libdir for the given Boost slot. If no slot is given, defaults
+# to ${BOOST_MAX_VERSION}. If that variable is unset, the newest
+# installed slot will be used.
+#
+# Outputs the sole path (without -L).
+boost-utils_get_libdir() {
+       local slot=${1:-${BOOST_MAX_VERSION:-$(boost-utils_get_best_slot)}}
+       has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
+
+       echo -n "${EPREFIX}/usr/$(get_libdir)/boost-${slot/./_}"
+}
+
+# @FUNCTION: boost-utils_export_root
+# @USAGE: [slot]
+# @DESCRIPTION:
+# Set the BOOST_ROOT variable to includedir for the given Boost slot.
+# If no slot is given, defaults to ${BOOST_MAX_VERSION}. If that
+# variable is unset, the newest installed slot will be used.
+#
+# This variable satisfies both cmake and sys-devel/boost-m4 autoconf
+# macros.
+boost-utils_export_root() {
+       export BOOST_ROOT=$(boost-utils_get_includedir "${@}")
+}
+
+_BOOST_ECLASS=1
+fi # _BOOST_ECLASS
-- 
1.7.12


Reply via email to