if test "$status" -ne 0 && test ! -d "$my_xdir"; then
exit $status
fi
-
- # We will extract separately just the conflicting names and we will
- # no longer touch any unique names. It is faster to leave these
- # extract automatically by $AR in one run.
- $show "(cd $my_xdir && $AR x $my_xabs)"
- $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
- if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
- $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
- $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
- do
- i=1
- while test "$i" -le "$count"
+ case $host in
+ *-darwin*)
+ darwin_orig_dir=`pwd`
+ $show "cd $my_xdir"
+ $run eval "cd \$my_xdir" || exit $?
+ darwin_archive=$my_xabs
+ darwin_curdir=`pwd`
+ darwin_base_archive=`basename $darwin_archive`
+ darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | grep Architectures 2>/dev/null`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`echo "$darwin_arches" | sed -e 's/.*are://'`
+ darwin_arch=
+ for darwin_arch in $darwin_arches ; do
+ mkdir -p ./unfat-$$/${darwin_base_archive}-${darwin_arch}
+ lipo -thin $darwin_arch -output unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive} ${darwin_archive}
+ # Remove the table of contents from the thin files.
+ $run eval "$AR -d unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive} __.SYMDEF 2>/dev/null|| true"
+ $run eval "$AR -d unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive} __.SYMDEF\ SORTED 2>/dev/null|| true"
+ cd unfat-$$/${darwin_base_archive}-${darwin_arch}
+ $run eval "$AR -xo ${darwin_base_archive}"
+ $run eval "rm ${darwin_base_archive}"
+ cd $darwin_curdir
+ done
+ ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP`
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+ darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+ eval "lipo -create -output $darwin_file $darwin_files"
+ done
+ rm -rf unfat-$$
+ cd $darwin_orig_dir
+ else
+ cd $darwin_orig_dir
+ $show "(cd $my_xdir && $AR x $my_xabs)"
+ $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
+ fi
+ ;;
+ *)
+ # We will extract separately just the conflicting names and we will
+ # no longer touch any unique names. It is faster to leave these
+ # extract automatically by $AR in one run.
+ $show "(cd $my_xdir && $AR x $my_xabs)"
+ $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
+ if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
+ $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
+ $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
do
- # Put our $i before any first dot (extension)
- # Never overwrite any file
- name_to="$name"
- while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
+ i=1
+ while test "$i" -le "$count"
do
- name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+ # Put our $i before any first dot (extension)
+ # Never overwrite any file
+ name_to="$name"
+ while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
+ do
+ name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+ done
+ $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
+ $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
+ i=`expr $i + 1`
done
- $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
- $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
- i=`expr $i + 1`
done
- done
- fi
-
+ fi
+ ;;
+ esac
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
done