/[gentoo-x86]/eclass/boost-utils.eclass
Gentoo

Contents of /eclass/boost-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Sun Oct 7 08:29:49 2012 UTC (21 months ago) by mgorny
Branch: MAIN
Changes since 1.2: +2 -2 lines
Fix stupid mistake in boost-utils_get_best_slot().

1 mgorny 1.1 # Copyright 1999-2012 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 mgorny 1.3 # $Header: /var/cvsroot/gentoo-x86/eclass/boost-utils.eclass,v 1.2 2012/09/27 16:35:41 axs Exp $
4 mgorny 1.1
5     if [[ ! ${_BOOST_ECLASS} ]]; then
6    
7     # @ECLASS: boost-utils.eclass
8     # @MAINTAINER:
9     # Michał Górny <mgorny@gentoo.org>
10     # Tiziano Müller <dev-zero@gentoo.org>
11     # Sebastian Luther <SebastianLuther@gmx.de>
12     # Arfrever Frehtes Taifersar Arahesis <arfrever.fta@gmail.com>
13     # @BLURB: helper functions for packages using Boost C++ library
14     # @DESCRIPTION:
15     # Helper functions to be used when building packages using the Boost C++
16     # library collection.
17     #
18     # Please note that this eclass does not set the dependencies for you.
19     # You need to do that yourself.
20     #
21     # For cmake & autotools it is usually necessary to set BOOST_ROOT using
22     # boost-utils_export_root. However, other build system may require more
23     # hackery or even appending -I$(boost-utils_get_includedir) to CFLAGS
24     # and -L$(boost-utils_get_libdir) to LDFLAGS.
25    
26     case ${EAPI:-0} in
27 axs 1.2 0|1|2|3|4|5) ;;
28 mgorny 1.1 *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
29     esac
30    
31     inherit multilib versionator
32    
33     # @ECLASS-VARIABLE: BOOST_MAX_SLOT
34     # @DEFAULT_UNSET
35     # @DESCRIPTION:
36     # The maximal (newest) boost slot supported by the package. If unset,
37     # there is no limit (the newest installed version will be used).
38    
39     # @FUNCTION: boost-utils_get_best_slot
40     # @DESCRIPTION:
41     # Get newest installed slot of Boost. If BOOST_MAX_SLOT is set, the version
42     # returned will be at most in the specified slot.
43     boost-utils_get_best_slot() {
44     local pkg=dev-libs/boost
45     [[ ${BOOST_MAX_SLOT} ]] && pkg="<=${pkg}-${BOOST_MAX_SLOT}.9999"
46    
47     local cpv=$(best_version ${pkg})
48 mgorny 1.3 get_version_component_range 1-2 ${cpv#dev-libs/boost-}
49 mgorny 1.1 }
50    
51     # @FUNCTION: boost-utils_get_includedir
52     # @USAGE: [slot]
53     # @DESCRIPTION:
54     # Get the includedir for the given Boost slot. If no slot is given,
55     # defaults to the newest installed Boost slot (but not newer than
56     # BOOST_MAX_SLOT if that variable is set).
57     #
58     # Outputs the sole path (without -I).
59     boost-utils_get_includedir() {
60     local slot=${1:-$(boost-utils_get_best_slot)}
61     has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
62    
63     echo -n "${EPREFIX}/usr/include/boost-${slot/./_}"
64     }
65    
66     # @FUNCTION: boost-utils_get_libdir
67     # @USAGE: [slot]
68     # @DESCRIPTION:
69     # Get the libdir for the given Boost slot. If no slot is given, defaults
70     # to the newest installed Boost slot (but not newer than BOOST_MAX_SLOT
71     # if that variable is set).
72     #
73     # Outputs the sole path (without -L).
74     boost-utils_get_libdir() {
75     local slot=${1:-$(boost-utils_get_best_slot)}
76     has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
77    
78     echo -n "${EPREFIX}/usr/$(get_libdir)/boost-${slot/./_}"
79     }
80    
81     # @FUNCTION: boost-utils_export_root
82     # @USAGE: [slot]
83     # @DESCRIPTION:
84     # Set the BOOST_ROOT variable to includedir for the given Boost slot.
85     # If no slot is given, defaults to the newest installed Boost slot(but
86     # not newer than BOOST_MAX_SLOT if that variable is set).
87     #
88     # This variable satisfies both cmake and sys-devel/boost-m4 autoconf
89     # macros.
90     boost-utils_export_root() {
91     export BOOST_ROOT=$(boost-utils_get_includedir "${@}")
92     }
93    
94     _BOOST_ECLASS=1
95     fi # _BOOST_ECLASS

  ViewVC Help
Powered by ViewVC 1.1.20