Skip to content

Instantly share code, notes, and snippets.

@tonycn
Created August 6, 2013 04:12
Show Gist options
  • Save tonycn/6161947 to your computer and use it in GitHub Desktop.
Save tonycn/6161947 to your computer and use it in GitHub Desktop.
bash script to create universal static library
git clean -df
set -x
# do not exit immediately on non-zero return values
set +e
set -o verbose
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer/
XCODEBUILD_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin
XCODEBUILD=$XCODEBUILD_PATH/xcodebuild
function archive_target {
$XCODEBUILD -project AmonsulIOS.xcodeproj -target "$1" -sdk "iphonesimulator" -configuration "Release" clean build
$XCODEBUILD -project AmonsulIOS.xcodeproj -target "$1" -sdk "iphoneos" -configuration "Release" clean build
lipo -create -output "build/lib$1.a" "build/Release-iphoneos/lib$1.a" "build/Release-iphonesimulator/lib$1.a"
rm -rf ../release
mkdir ../release
mv build/lib$1.a ../release/
cp AmonsulIOS/Source/DOUMobileStat.h ../release/
if [ "$2"="umeng" ]; then
cp AmonsulIOS/Source/DOUEventLogger/DOUEventLogger.h ../release/
fi
tar -zcvf "../archive/lib$1.tar.gz" ../release
}
mkdir archive
cd lib
archive_target AmonsulIOS umeng
archive_target AmonsulIOS_WithoutUmeng
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment