Lines 463-472
Link Here
|
463 |
fi |
463 |
fi |
464 |
done |
464 |
done |
465 |
done |
465 |
done |
466 |
[[ ${abort} == yes ]] && die "multilib-strict check failed!" |
466 |
[[ ${abort} == yes ]] && die "multilib-strict check failed!" |
467 |
fi |
467 |
fi |
|
|
468 |
|
469 |
if hasq fixlafiles ${FEATURES} && [[ -x /usr/bin/find ]] |
470 |
then |
471 |
labanner=true |
472 |
while read -r lafile |
473 |
do |
474 |
if [[ "$labanner" == "true" ]] |
475 |
then |
476 |
vecho "fixing .la link references" |
477 |
labanner=false |
478 |
fi |
479 |
vecho " ${lafile:${#D}}" |
480 |
local has_inh_link_flags="no" |
481 |
local new_inh_link_flags="" |
482 |
local dependency_libs="" |
483 |
local inh_link_flags="" |
484 |
local has_dep_libs="no" |
485 |
local new_dep_libs="" |
486 |
local remove_lib="" |
487 |
local contents="$(<"${lafile}")" |
488 |
local libladir="" |
489 |
local librpath="" |
490 |
local dep_libs="" |
491 |
local NEWLINE=$'\n' |
492 |
local line="" |
493 |
local lib="" |
494 |
|
495 |
# Extract the dependency_libs and inherited_linker_flags |
496 |
# variables from the .la file. Technically a .la file |
497 |
# should be posix sh, so should be sourceable. But we |
498 |
# know better than to trust random files with source(). |
499 |
# We extract. |
500 |
save_IFS="${IFS}" |
501 |
IFS="$NEWLINE" |
502 |
for line in $contents |
503 |
do |
504 |
if [[ "${line#dependency_libs=\'}" != "${line}" ]] |
505 |
then |
506 |
[[ "$has_dep_libs" == "no" ]] || { eqawarn "dependency_libs= assigned more than once in ${lafile:${#D}}"; continue 2; } |
507 |
line="${line#dependency_libs=\'}" |
508 |
dep_libs="${line%\'}" |
509 |
has_dep_libs="yes" |
510 |
|
511 |
elif [[ "${line#inherited_linker_flags=\'}" != "${line}" ]] |
512 |
then |
513 |
|
514 |
[[ "$has_inh_link_flags" == "no" ]] || { eqawarn "inherited_linker_flags= assigned more than once in ${lafile:${#D}}"; continue 2; } |
515 |
line="${line#inherited_linker_flags=\'}" |
516 |
inh_link_flags="${line%\'}" |
517 |
new_inh_link_flags="${inh_link_flags}" |
518 |
has_inh_link_flags="yes" |
519 |
fi |
520 |
done |
521 |
IFS="$save_IFS" |
522 |
|
523 |
if [[ "$has_dep_libs" == "no" ]] |
524 |
then |
525 |
# Clearly, this is not libtool archive. |
526 |
vecho "$lafile is not a libtool archive. Skipping." |
527 |
continue |
528 |
fi |
529 |
|
530 |
# We can assume that as long as the format doesn't change |
531 |
# radically, paths won't contain spaces. |
532 |
for entry in $dep_libs |
533 |
do |
534 |
case $entry in |
535 |
-l*) |
536 |
has ${entry} ${new_dep_libs} || new_dep_libs="${new_dep_libs} ${entry}" |
537 |
;; |
538 |
*.la) |
539 |
|
540 |
if [[ "${entry##*\/lib}" == "${entry}" ]] |
541 |
then |
542 |
# When we get here, we're dealing with something that |
543 |
# can't be replaced with a -llibrary entry. Just put it |
544 |
# in dep_libs. |
545 |
has ${entry} ${new_dep_libs} || new_dep_libs="${new_dep_libs} ${entry}" |
546 |
else |
547 |
lib="${entry##*\/lib}" |
548 |
lib="${lib%.la}" |
549 |
lib="-l${lib}" |
550 |
has ${lib} ${new_dep_libs} || new_dep_libs="${new_dep_libs} ${lib}" |
551 |
has -L${entry%/*.la} ${libladir} || libladir="${libladir} -L${entry%/*.la}" |
552 |
fi |
553 |
;; |
554 |
-L*) |
555 |
# Do some path clean-up, so we eliminate redundant entries. |
556 |
[[ ${entry/X11R6\/lib} != ${entry} ]] && entry="${entry/X11R6\/}" |
557 |
[[ ${entry/usr\/lib*\/pkgconfig\/..\/..} != ${entry} ]] && entry="${entry/\/lib*\/pkgconfig\/..\/..}" |
558 |
[[ ${entry/usr\/lib*\/pkgconfig\/..} != ${entry} ]] && entry="${entry/\/pkgconfig\/..}" |
559 |
has ${entry} ${libladir} || libladir="${libladir} ${entry}" |
560 |
;; |
561 |
-R*) |
562 |
has ${entry} ${librpath} || librpath="${librpath} ${entry}" |
563 |
;; |
564 |
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) |
565 |
# If we got here, we're probably in a libtool-1.5 file, so we |
566 |
# won't have inherited_linker_flags, but there was a bug in early |
567 |
# libtool-2.2 that would mean that -pthread would be put in |
568 |
# dependency_libs |
569 |
if [[ "${has_inh_link_flags}" == "yes" ]] |
570 |
then |
571 |
has ${entry} ${new_inh_link_flags} || new_inh_link_flags="${new_inh_link_flags} ${entry}" |
572 |
else |
573 |
has ${entry} ${new_dep_libs} || new_dep_libs="${new_dep_libs} ${entry}" |
574 |
fi |
575 |
;; |
576 |
*) |
577 |
# Unkown thingie. Put before all the dep_libs so it can work on |
578 |
# them if it's that kind of a thingie. After ladirs and rpaths so |
579 |
# they can work on it if it's that kind of thingie. |
580 |
# I've never encountered such a thingie, so this is an attempt |
581 |
# at a reasonable default. Doing die() is probably not acceptable. |
582 |
new_dep_libs="${entry} ${new_dep_libs}" |
583 |
;; |
584 |
esac |
585 |
done |
586 |
|
587 |
# We got the same result as libtool, abort early so we don't have |
588 |
# to write to disk. |
589 |
[[ "${dep_libs}" == "${librpath}${libladir}${new_dep_libs}" && "${new_inh_link_flags}" == "${inh_link_flags}" ]] && continue |
590 |
|
591 |
# Replace dependency_libs and inherited_linker_flags with our |
592 |
# generated values. Write to disk. |
593 |
contents="${contents/${NEWLINE}dependency_libs=\'${dep_libs}\'${NEWLINE}/${NEWLINE}dependency_libs='${librpath}${libladir}${new_dep_libs}'${NEWLINE}}" |
594 |
[[ "${has_inh_link_flags}" == "yes" ]] && \ |
595 |
contents="${contents/${NEWLINE}inherited_linker_flags=\'${inh_link_flags}\'${NEWLINE}/${NEWLINE}inherited_linker_flags='${new_inh_link_flags}'${NEWLINE}}" |
596 |
|
597 |
printf '%s' "$contents" > "${lafile}" |
598 |
done < <(find "${D}" -type f -name '*.la') |
599 |
fi |
468 |
} |
600 |
} |
469 |
|
601 |
|
470 |
|
602 |
|
471 |
install_mask() { |
603 |
install_mask() { |
472 |
local root="$1" |
604 |
local root="$1" |