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

Diff of /eclass/multilib.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 Revision 1.9
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.2 2005/01/12 11:13:28 eradicator Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.9 2005/01/15 13:44:31 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.
9 9
10ECLASS=multilib 10ECLASS=multilib
11INHERITED="$INHERITED $ECLASS" 11INHERITED="$INHERITED $ECLASS"
12 12
13DESCRIPTION="Based on the ${ECLASS} eclass" 13DESCRIPTION="Based on the ${ECLASS} eclass"
14
15DEPEND="!build? ( sys-apps/sed sys-apps/findutils sys-apps/coreutils )"
16 14
17# This function simply returns the desired lib directory. With portage 15# This function simply returns the desired lib directory. With portage
18# 2.0.51, we now have support for installing libraries to lib32/lib64 16# 2.0.51, we now have support for installing libraries to lib32/lib64
19# to accomidate the needs of multilib systems. It's no longer a good idea 17# to accomidate the needs of multilib systems. It's no longer a good idea
20# to assume all libraries will end up in lib. Replace any (sane) instances 18# to assume all libraries will end up in lib. Replace any (sane) instances
213 211
214 if is_final_abi; then 212 if is_final_abi; then
215 for dir in ${dirs}; do 213 for dir in ${dirs}; do
216 local args="${dir}" 214 local args="${dir}"
217 local abi 215 local abi
216 dodir ${dir}/gentoo-multilib
218 for abi in $(get_abi_order); do 217 for abi in $(get_abi_order); do
218 mv ${D}/${dir}.${abi} ${D}/${dir}/gentoo-multilib/${abi}
219 args="${args} $(get_abi_CDEFINE ${abi})${dir}.${abi}" 219 args="${args} $(get_abi_CDEFINE ${abi}):${dir}/gentoo-multilib/${abi}"
220 done 220 done
221 create_ml_includes ${args} 221 create_ml_includes ${args}
222 done 222 done
223 fi 223 fi
224 fi 224 fi
245 local file 245 local file
246 for file in $(create_ml_includes-allfiles ${basedirs}); do 246 for file in $(create_ml_includes-allfiles ${basedirs}); do
247 local name="$(echo $file | tr a-z A-Z | sed 's:[^A-Z]:_:g')" 247 local name="$(echo $file | tr a-z A-Z | sed 's:[^A-Z]:_:g')"
248 { 248 {
249 echo "/* Common header file autogenerated by create_ml_includes in multilib.eclass */" 249 echo "/* Common header file autogenerated by create_ml_includes in multilib.eclass */"
250 echo "#ifndef __CREATE_ML_INCLUDES_STUB_${name}__" 250 #echo "#ifndef __CREATE_ML_INCLUDES_STUB_${name}__"
251 echo "#define __CREATE_ML_INCLUDES_STUB_${name}__" 251 #echo "#define __CREATE_ML_INCLUDES_STUB_${name}__"
252 echo "" 252 #echo ""
253 253
254 local dir 254 local dir
255 for dir in ${basedirs}; do 255 for dir in ${basedirs}; do
256 if [ -f "${D}/${dir}/${file}" ]; then 256 if [ -f "${D}/${dir}/${file}" ]; then
257 echo "#ifdef $(create_ml_includes-sym_for_dir ${dir} ${mlinfo})" 257 echo "#ifdef $(create_ml_includes-sym_for_dir ${dir} ${mlinfo})"
258 echo "#include \"$(create_ml_includes-relative_between ${dest} ${dir})/${file}\"" 258 echo "#include \"$(create_ml_includes-relative_between ${dest}/$(dirname ${file}) ${dir}/${file})\""
259 echo "#endif /* $(create_ml_includes-sym_for_dir ${dir} ${mlinfo}) */" 259 echo "#endif /* $(create_ml_includes-sym_for_dir ${dir} ${mlinfo}) */"
260 echo "" 260 echo ""
261 fi 261 fi
262 done 262 done
263 263
264 echo "#endif /* __CREATE_ML_INCLUDES_STUB_${name}__ */" 264 #echo "#endif /* __CREATE_ML_INCLUDES_STUB_${name}__ */"
265 } > ${D}/${dest}/${file} 265 } > ${D}/${dest}/${file}
266 done 266 done
267} 267}
268 268
269# Helper function for create_ml_includes 269# Helper function for create_ml_includes
270# TODO: This needs to be updated to spit out relative paths...
271create_ml_includes-relative_between() { 270create_ml_includes-relative_between() {
271 local src="$(create_ml_includes-tidy_path ${1})"
272 local dst="$(create_ml_includes-tidy_path ${2})"
273
274 src=(${src//\// })
275 dst=(${dst//\// })
276
277 local i
278 for ((i=0; i<${#src[*]}; i++)); do
279 [ "${dst[i]}" != "${src[i]}" ] && break
280 done
281
282 local common=$i
283
284 for ((i=${#src[*]}; i>common; i--)); do
285 echo -n ../
286 done
287
288 for ((i=common; i<${#dst[*]}-1; i++)); do
289 echo -n ${dst[i]}/
290 done
291
292 echo -n ${dst[i]}
293}
294
295# Helper function for create_ml_includes
296create_ml_includes-tidy_path() {
272 local from=${1} 297 local removed="${1}"
273 local to=${2} 298
274 299 if [ -n "${removed}" ]; then
275 echo "${ROOT}${to}" 300 # Remove multiple slashes
301 while [ "${removed}" != "${removed/\/\//\/}" ]; do
302 removed=${removed/\/\//\/}
303 done
304
305 # Remove . directories
306 while [ "${removed}" != "${removed//\/.\//\/}" ]; do
307 removed=${removed//\/.\//\/}
308 done
309 [ "${removed##*/}" = "." ] && removed=${removed%/*}
310
311 # Removed .. directories
312 while [ "${removed}" != "${removed//\/..\/}" ]; do
313 local p1="${removed%%\/..\/*}"
314 local p2="${removed#*\/..\/}"
315
316 removed="${p1%\/*}/${p2}"
317 done
318
319 # Remove trailing ..
320 [ "${removed##*/}" = ".." ] && removed=${removed%/*/*}
321
322 # Remove trailing /
323 [ "${removed##*/}" = "" ] && removed=${removed%/*}
324
325 echo ${removed}
326 fi
276} 327}
277 328
278# Helper function for create_ml_includes 329# Helper function for create_ml_includes
279create_ml_includes-listdirs() { 330create_ml_includes-listdirs() {
280 local dirs 331 local dirs
304 355
305# Helper function for create_ml_includes 356# Helper function for create_ml_includes
306create_ml_includes-allfiles() { 357create_ml_includes-allfiles() {
307 local basedirs=${@} 358 local basedirs=${@}
308 359
309 local files 360 local basedir
310 for basedir in ${basedirs}; do 361 for basedir in ${basedirs}; do
311 local file 362 local file
312 for file in $(find ${D}/${basedir} -type f); do 363 for file in $(find ${D}/${basedir} -type f); do
313 echo ${file/${D}\/${basedir}\//} 364 echo ${file/${D}\/${basedir}\//}
314 done 365 done
324 if [ "${dir}" = "${data/*:/}" ]; then 375 if [ "${dir}" = "${data/*:/}" ]; then
325 echo ${data/:*/} 376 echo ${data/:*/}
326 return 0 377 return 0
327 fi 378 fi
328 done 379 done
329 echo "Should be here -- create_ml_includes-sym_for_dir ${1} ${@}" 380 echo "Shouldn't be here -- create_ml_includes-sym_for_dir ${1} ${@}"
330 # exit because we'll likely be called from a subshell 381 # exit because we'll likely be called from a subshell
331 exit 1 382 exit 1
332} 383}

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.20