您的位置:首页 > 运维架构 > Shell

shell编译xcode打包静态/动态库之shell编译xcode

2015-05-20 13:19 344 查看
在利用shell编译xcode之前先熟悉一些常用的linux命令行

(1)当前目录命令

CURRENTPATH=`pwd`
(2)判断某一路径是否是文件夹

if [ ! -d
"$DEVELOPER" ]; then

exit
1

fi

(3)下载某个网址
curl -O https://www.openssl.org/source/文件名 (4)创建某个路径下的某个文件夹

mkdir -p
"${CURRENTPATH}/src"
(5)切换到某个路径下

cd "${CURRENTPATH}/src}"
(6)遍历数组中的内容

ARCHS="i386 x86_64 armv7 armv7s arm64"
for ARCH
in ${ARCHS}

done
(7)拷贝某个路径下的文件到另一个路径
cp -R 文件A 路径B
(8)打印某个目录下 带有某个文件后缀的文件名

dir=$(ls -l $CURRENTPATH |awk
'/^d/ {print $NF}')
for i
in $dir

do
if [[ $i =~ \.xcodeproj$ ]];
then
ISVAILDPATH="ISTRUE"
TARGETNAME="${i%.*}"

echo "$TARGETNAME"
echo $i

fi

done
(9)xcode静态库打包

xcodebuild -target $TARGETNAME -configuration Release -sdk iphonesimulator -arch i386 -arch x86_64
xcodebuild -target $TARGETNAME -configuration Release -sdk iphoneos -arch armv7 -arch armv7s -arch arm64
(10)创建动态库并宝贝h文件

libtool -no_warning_for_no_symbols $LIBTOOL_FLAGS -o $FWNAME.framework/$FWNAME $RELEASEIPHONEA/$STATICLIBNAME $RELEASESIMULATORA/$STATICLIBNAME
cp -r $RELEASEIPHONEA/"include/$TARGETNAME"/* $FWNAME.framework/Headers/
(11)编译xcode
xcodebuild -target targetName
clean

xcodebuild
-target targetName

xcrun
-sdk iphoneos PackageApplication -v path/To/xxx.app -o xxx.ipa

第二部生成APP第三步生成可以发布的ipa
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: