#!/bin/sh set -e ldid=ldid for last; do ldid="$ldid $old" old="$last" done archs="$(lipo -info "$last")" if [ -z "$(echo $archs | grep are:)" ]; then $ldid "$last" else archs="$(echo $archs | sed 's/^.*are: //')" temp=$(mktemp -d /tmp/ldid_wrapper.XXXXX) for arch in $archs; do lipo -thin $arch -output $temp/$arch "$last" $ldid $temp/$arch done lipo -create -output "$last" $temp/* rm -rf $temp fi