1 |
Now with a handy function for cmake & autotools! And a more complete |
2 |
description. |
3 |
--- |
4 |
gx86/eclass/boost-utils.eclass | 99 ++++++++++++++++++++++++++++++++++++++++++ |
5 |
1 file changed, 99 insertions(+) |
6 |
create mode 100644 gx86/eclass/boost-utils.eclass |
7 |
|
8 |
diff --git a/gx86/eclass/boost-utils.eclass b/gx86/eclass/boost-utils.eclass |
9 |
new file mode 100644 |
10 |
index 0000000..c720fe7 |
11 |
--- /dev/null |
12 |
+++ b/gx86/eclass/boost-utils.eclass |
13 |
@@ -0,0 +1,99 @@ |
14 |
+# Copyright 1999-2012 Gentoo Foundation |
15 |
+# Distributed under the terms of the GNU General Public License v2 |
16 |
+# $Header: $ |
17 |
+ |
18 |
+if [[ ! ${_BOOST_ECLASS} ]]; then |
19 |
+ |
20 |
+# @ECLASS: boost-utils.eclass |
21 |
+# @MAINTAINER: |
22 |
+# Michał Górny <mgorny@g.o> |
23 |
+# Tiziano Müller <dev-zero@g.o> |
24 |
+# Sebastian Luther <SebastianLuther@×××.de> |
25 |
+# Arfrever Frehtes Taifersar Arahesis <arfrever.fta@×××××.com> |
26 |
+# @BLURB: helper functions for packages using Boost C++ library |
27 |
+# @DESCRIPTION: |
28 |
+# Helper functions to be used when building packages using the Boost C++ |
29 |
+# library collection. |
30 |
+# |
31 |
+# For cmake & autotools it is usually necessary to set BOOST_ROOT using |
32 |
+# boost-utils_export_root. However, other build system may require more |
33 |
+# hackery or even appending -I$(boost-utils_get_includedir) to CFLAGS |
34 |
+# and -L$(boost-utils_get_libdir) to LDFLAGS. |
35 |
+# |
36 |
+# If the package supports the newest version of boost, it should depend |
37 |
+# on >=dev-libs/boost-x.y.z (min version) or just dev-libs/boost. If it |
38 |
+# doesn't, you should set BOOST_MAX_VERSION (or just pass the correct |
39 |
+# slot to the used function) and depend on dev-libs/boost:x.y. |
40 |
+ |
41 |
+case ${EAPI:-0} in |
42 |
+ 0|1|2|3|4) ;; |
43 |
+ *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established." |
44 |
+esac |
45 |
+ |
46 |
+inherit multilib versionator |
47 |
+ |
48 |
+# @ECLASS-VARIABLE: BOOST_MAX_VERSION |
49 |
+# @DEFAULT_UNSET |
50 |
+# @DESCRIPTION: |
51 |
+# The maximal (newest) boost version supported by the package. If unset, |
52 |
+# the newest installed version will be used. |
53 |
+# |
54 |
+# Please note that if BOOST_MAX_VERSION is set, the package should |
55 |
+# depend on boost packages with *exactly* that slot (i.e. boost:1.47); |
56 |
+# otherwise, the package should depend on boost without a slot |
57 |
+# specified (i.e. >=boost-1.45). |
58 |
+ |
59 |
+# @FUNCTION: boost-utils_get_best_slot |
60 |
+# @DESCRIPTION: |
61 |
+# Get newest installed slot of Boost. |
62 |
+boost-utils_get_best_slot() { |
63 |
+ local pkg=dev-libs/boost |
64 |
+ local atom=$(best_version ${pkg}) |
65 |
+ get_version_component_range 1-2 ${atom#${pkg}} |
66 |
+} |
67 |
+ |
68 |
+# @FUNCTION: boost-utils_get_includedir |
69 |
+# @USAGE: [slot] |
70 |
+# @DESCRIPTION: |
71 |
+# Get the includedir for the given Boost slot. If no slot is given, |
72 |
+# defaults to ${BOOST_MAX_VERSION}. If that variable is unset, |
73 |
+# the newest installed slot will be used. |
74 |
+# |
75 |
+# Outputs the sole path (without -I). |
76 |
+boost-utils_get_includedir() { |
77 |
+ local slot=${1:-${BOOST_MAX_VERSION:-$(boost-utils_get_best_slot)}} |
78 |
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= |
79 |
+ |
80 |
+ echo -n "${EPREFIX}/usr/include/boost-${slot/./_}" |
81 |
+} |
82 |
+ |
83 |
+# @FUNCTION: boost-utils_get_libdir |
84 |
+# @USAGE: [slot] |
85 |
+# @DESCRIPTION: |
86 |
+# Get the libdir for the given Boost slot. If no slot is given, defaults |
87 |
+# to ${BOOST_MAX_VERSION}. If that variable is unset, the newest |
88 |
+# installed slot will be used. |
89 |
+# |
90 |
+# Outputs the sole path (without -L). |
91 |
+boost-utils_get_libdir() { |
92 |
+ local slot=${1:-${BOOST_MAX_VERSION:-$(boost-utils_get_best_slot)}} |
93 |
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= |
94 |
+ |
95 |
+ echo -n "${EPREFIX}/usr/$(get_libdir)/boost-${slot/./_}" |
96 |
+} |
97 |
+ |
98 |
+# @FUNCTION: boost-utils_export_root |
99 |
+# @USAGE: [slot] |
100 |
+# @DESCRIPTION: |
101 |
+# Set the BOOST_ROOT variable to includedir for the given Boost slot. |
102 |
+# If no slot is given, defaults to ${BOOST_MAX_VERSION}. If that |
103 |
+# variable is unset, the newest installed slot will be used. |
104 |
+# |
105 |
+# This variable satisfies both cmake and sys-devel/boost-m4 autoconf |
106 |
+# macros. |
107 |
+boost-utils_export_root() { |
108 |
+ export BOOST_ROOT=$(boost-utils_get_includedir "${@}") |
109 |
+} |
110 |
+ |
111 |
+_BOOST_ECLASS=1 |
112 |
+fi # _BOOST_ECLASS |
113 |
-- |
114 |
1.7.12 |