/[gentoo-x86]/eclass/multilib.eclass
Gentoo

Contents of /eclass/multilib.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed Jan 12 00:21:53 2005 UTC (9 years, 8 months ago) by eradicator
Branch: MAIN
Breaking multilib code off to a separate eclass to keep things clean.

1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.140 2005/01/11 04:24:39 vapier Exp $
4 #
5 # Author: Jeremy Huddleston <eradicator@gentoo.org>
6 #
7 # This eclass is for all functions pertaining to handling multilib.
8 # configurations.
9
10 ECLASS=multilib
11 INHERITED="$INHERITED $ECLASS"
12
13 DESCRIPTION="Based on the ${ECLASS} eclass"
14
15 # This function simply returns the desired lib directory. With portage
16 # 2.0.51, we now have support for installing libraries to lib32/lib64
17 # to accomidate the needs of multilib systems. It's no longer a good idea
18 # to assume all libraries will end up in lib. Replace any (sane) instances
19 # where lib is named directly with $(get_libdir) if possible.
20 #
21 # Travis Tilley <lv@gentoo.org> (24 Aug 2004)
22 #
23 # Jeremy Huddleston <eradicator@gentoo.org> (23 Dec 2004):
24 # Added support for ${ABI} and ${DEFAULT_ABI}. If they're both not set,
25 # fall back on old behavior. Any profile that has these set should also
26 # depend on a newer version of portage (not yet released) which uses these
27 # over CONF_LIBDIR in econf, dolib, etc...
28 get_libdir() {
29 LIBDIR_TEST=$(type econf)
30 if [ ! -z "${CONF_LIBDIR_OVERRIDE}" ] ; then
31 # if there is an override, we want to use that... always.
32 CONF_LIBDIR="${CONF_LIBDIR_OVERRIDE}"
33 # We don't need to know the verison of portage. We only need to know
34 # if there is support for CONF_LIBDIR in econf and co.
35 # Danny van Dyk <kugelfang@gentoo.org> 2004/17/09
36 #elif portageq has_version / '<sys-apps/portage-2.0.51_pre20' ; then
37 # # and if there isnt an override, and we're using a version of
38 # # portage without CONF_LIBDIR support, force the use of lib. dolib
39 # # and friends from portage 2.0.50 wont be too happy otherwise.
40 # CONF_LIBDIR="lib"
41 #fi
42 elif [ -n "$(get_abi_LIBDIR)" ]; then # Using eradicator's LIBDIR_<abi> approach...
43 CONF_LIBDIR="$(get_abi_LIBDIR)"
44 elif [ "${LIBDIR_TEST/CONF_LIBDIR}" == "${LIBDIR_TEST}" ]; then # we don't have CONF_LIBDIR support
45 # will be <portage-2.0.51_pre20
46 CONF_LIBDIR="lib"
47 fi
48 # and of course, default to lib if CONF_LIBDIR isnt set
49 echo ${CONF_LIBDIR:=lib}
50 unset LIBDIR_TEST
51 }
52
53 get_multilibdir() {
54 if [ -n "$(get_abi_LIBDIR)" ]; then
55 eerror "get_multilibdir called, but it shouldn't be needed with the new multilib approach. Please file a bug at http://bugs.gentoo.org and assign it to eradicator@gentoo.org"
56 exit 1
57 fi
58 echo ${CONF_MULTILIBDIR:=lib32}
59 }
60
61 # Sometimes you need to override the value returned by get_libdir. A good
62 # example of this is xorg-x11, where lib32 isnt a supported configuration,
63 # and where lib64 -must- be used on amd64 (for applications that need lib
64 # to be 32bit, such as adobe acrobat). Note that this override also bypasses
65 # portage version sanity checking.
66 # get_libdir_override expects one argument, the result get_libdir should
67 # return:
68 #
69 # get_libdir_override lib64
70 #
71 # Travis Tilley <lv@gentoo.org> (31 Aug 2004)
72 get_libdir_override() {
73 if [ -n "$(get_abi_LIBDIR)" ]; then
74 eerror "get_libdir_override called, but it shouldn't be needed with the new multilib approach. Please file a bug at http://bugs.gentoo.org and assign it to eradicator@gentoo.org"
75 exit 1
76 fi
77 CONF_LIBDIR="$1"
78 CONF_LIBDIR_OVERRIDE="$1"
79 }
80
81 # get_abi_var <VAR> [<ABI>]
82 # returns the value of ${<VAR>_<ABI>} which should be set in make.defaults
83 #
84 # ex:
85 # CFLAGS=$(get_abi_var CFLAGS sparc32) # CFLAGS=-m32
86 #
87 # Note that the prefered method is to set CC="$(tc-getCC) $(get_abi_CFLAGS)"
88 # This will hopefully be added to portage soon...
89 #
90 # If <ABI> is not specified, ${ABI} is used.
91 # If <ABI> is not specified and ${ABI} is not defined, ${DEFAULT_ABI} is used.
92 # If <ABI> is not specified and ${ABI} and ${DEFAULT_ABI} are not defined, we return an empty string.
93 #
94 # Jeremy Huddleston <eradicator@gentoo.org>
95 get_abi_var() {
96 local flag=${1}
97 local abi
98 if [ $# -gt 1 ]; then
99 abi=${2}
100 elif [ -n "${ABI}" ]; then
101 abi=${ABI}
102 elif [ -n "${DEFAULT_ABI}" ]; then
103 abi=${DEFAULT_ABI}
104 else
105 return 1
106 fi
107
108 local var="${flag}_${abi}"
109 echo ${!var}
110 }
111
112 get_abi_CFLAGS() { get_abi_var CFLAGS ${@}; }
113 get_abi_CXXFLAGS() { get_abi_var CXXFLAGS ${@}; }
114 get_abi_ASFLAGS() { get_abi_var ASFLAGS ${@}; }
115 get_abi_LIBDIR() { get_abi_var LIBDIR ${@}; }
116
117 # get_all_libdir()
118 # Returns a list of all the libdirs used by this profile
119 get_all_libdirs() {
120 local libdirs
121 if [ -n "${MULTILIB_ABIS}" ]; then
122 for abi in ${MULTILIB_ABIS}; do
123 libdirs="${libdirs} $(get_abi_LIBDIR ${abi})"
124 done
125 libdirs="${libdirs:1}"
126 elif [ -n "${CONF_LIBDIR}" ]; then
127 libdirs="${CONF_LIBDIR} ${CONF_MULTILIBDIR:=lib32}"
128 else
129 libdirs="lib"
130 fi
131
132 echo "${libdirs}"
133 }

  ViewVC Help
Powered by ViewVC 1.1.20