| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.8 2005/01/13 19:30:41 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.13 2005/01/17 04:20:55 eradicator Exp $ |
| 4 | # |
4 | # |
| 5 | # Author: Jeremy Huddleston <eradicator@gentoo.org> |
5 | # Author: Jeremy Huddleston <eradicator@gentoo.org> |
| 6 | # |
6 | # |
| 7 | # This eclass is for all functions pertaining to handling multilib. |
7 | # This eclass is for all functions pertaining to handling multilib. |
| 8 | # configurations. |
8 | # configurations. |
| … | |
… | |
| 178 | # echo the number of ABIs we will be installing for |
178 | # echo the number of ABIs we will be installing for |
| 179 | number_abis() { |
179 | number_abis() { |
| 180 | get_abi_order | wc -w |
180 | get_abi_order | wc -w |
| 181 | } |
181 | } |
| 182 | |
182 | |
|
|
183 | # get_ml_incdir [<include dir> [<ABI>]] |
|
|
184 | # include dir defaults to /usr/include |
|
|
185 | # ABI defaults to ${ABI} or ${DEFAULT_ABI} |
|
|
186 | get_ml_incdir() { |
|
|
187 | local dir=/usr/include |
|
|
188 | |
|
|
189 | if [[ ${#} -gt 0 ]]; then |
|
|
190 | incdir=${1} |
|
|
191 | shift |
|
|
192 | fi |
|
|
193 | |
|
|
194 | if [[ -z "${MULTILIB_ABIS}" ]]; then |
|
|
195 | echo ${incdir} |
|
|
196 | return 0 |
|
|
197 | fi |
|
|
198 | |
|
|
199 | local abi=${ABI:-${DEFAULT_ABI}} |
|
|
200 | if [[ ${#} -gt 0 ]]; then |
|
|
201 | abi=${1} |
|
|
202 | shift |
|
|
203 | fi |
|
|
204 | |
|
|
205 | if [[ -d "${dir}/gentoo-multilib/${abi}" ]]; then |
|
|
206 | echo ${dir}/gentoo-multilib/${abi} |
|
|
207 | else |
|
|
208 | echo ${dir} |
|
|
209 | fi |
|
|
210 | } |
|
|
211 | |
| 183 | # prep_ml_includes: |
212 | # prep_ml_includes: |
| 184 | # |
213 | # |
| 185 | # Some includes (include/asm, glibc, etc) are ABI dependent. In this case, |
214 | # Some includes (include/asm, glibc, etc) are ABI dependent. In this case, |
| 186 | # We can install them in different locations for each ABI and create a common |
215 | # We can install them in different locations for each ABI and create a common |
| 187 | # header which includes the right one based on CDEFINE_${ABI}. If your |
216 | # header which includes the right one based on CDEFINE_${ABI}. If your |
| … | |
… | |
| 194 | # ... |
223 | # ... |
| 195 | # prep_ml_includes /usr/qt/3/include |
224 | # prep_ml_includes /usr/qt/3/include |
| 196 | # } |
225 | # } |
| 197 | |
226 | |
| 198 | prep_ml_includes() { |
227 | prep_ml_includes() { |
| 199 | local dirs |
|
|
| 200 | if [ ${#} -eq 0 ]; then |
|
|
| 201 | dirs="/usr/include" |
|
|
| 202 | else |
|
|
| 203 | dirs="${@}" |
|
|
| 204 | fi |
|
|
| 205 | |
|
|
| 206 | if [ $(number_abis) -gt 1 ]; then |
228 | if [ $(number_abis) -gt 1 ]; then |
| 207 | local dir |
229 | local dir |
|
|
230 | local dirs |
|
|
231 | local base |
|
|
232 | |
|
|
233 | if [ ${#} -eq 0 ]; then |
|
|
234 | dirs="/usr/include" |
|
|
235 | else |
|
|
236 | dirs="${@}" |
|
|
237 | fi |
|
|
238 | |
| 208 | for dir in ${dirs}; do |
239 | for dir in ${dirs}; do |
|
|
240 | base=${T}/gentoo-multilib/${dir}/gentoo-multilib |
|
|
241 | mkdir -p ${base} |
|
|
242 | [ -d ${base}/${ABI} ] && rm -rf ${base}/${ABI} |
| 209 | mv ${D}/${dir} ${D}/${dir}.${ABI} |
243 | mv ${D}/${dir} ${base}/${ABI} |
| 210 | done |
244 | done |
| 211 | |
245 | |
| 212 | if is_final_abi; then |
246 | if is_final_abi; then |
|
|
247 | base=${T}/gentoo-multilib |
|
|
248 | pushd ${base} |
|
|
249 | find . | cpio -pmd --no-preserve-owner ${D} |
|
|
250 | popd |
|
|
251 | |
| 213 | for dir in ${dirs}; do |
252 | for dir in ${dirs}; do |
| 214 | local args="${dir}" |
253 | local args=${dir} |
| 215 | local abi |
254 | local abi |
| 216 | for abi in $(get_abi_order); do |
255 | for abi in $(get_abi_order); do |
| 217 | args="${args} $(get_abi_CDEFINE ${abi}):${dir}.${abi}" |
256 | args="${args} $(get_abi_CDEFINE ${abi}):${dir}/gentoo-multilib/${abi}" |
| 218 | done |
257 | done |
| 219 | create_ml_includes ${args} |
258 | create_ml_includes ${args} |
| 220 | done |
259 | done |
| 221 | fi |
260 | fi |
| 222 | fi |
261 | fi |