Rev 37314 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#!/bin/sh# creates or updates a fat binary by replacing or adding a new architecture.# the target file doesn't need to exist - it will be created if not# already presentif [ -z "$1" -o -z "$2" ]; thenecho ""echo " Usage: updatefat <target> <new-file>"echo ""echo " Works even if <target> doesn't exist or is not fat."echo ""exit 1fithisarch=`lipo -detailed_info "$2"|sed -n 's/.\{0,\}architecture:* \(.\{1,\}\)/\1/p'`if [ -z "$thisarch" ]; thenecho "Cannot find out architecture of $2" >&2exit 2fi#echo "architecture: $thisarch";if [ -e "$1" ]; then \if lipo -detailed_info "$1"|grep "architecture:* $thisarch" > /dev/null; thenif lipo -info "$1"|grep ^Non-fat > /dev/null; thenlipo -create "$2" -o "$1"elselipo -replace "$thisarch" "$2" "$1" -o "$1"fielselipo -create "$1" "$2" -o "$1"fielselipo -create "$2" -o "$1"fi