ios5.1编译带SSL的libcurl

来源:互联网 发布:视频推广软件 编辑:程序博客网 时间:2024/05/22 03:51

编译脚本:

#  for iPhoneOS and iPhoneSimulator

#

#  Created by Rockee on 2012-7-26.

#  Copyright 2012 Rockee. All rights reserved.

#

#  Licensed under the Apache License, Version 2.0 (the "License");

#  you may not use this file except in compliance with the License.

#  You may obtain a copy of the License at

#

http://www.apache.org/licenses/LICENSE-2.0

#

#  Unless required by applicable law or agreed to in writing, software

#  distributed under the License is distributed on an "AS IS" BASIS,

#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

#  See the License for the specific language governing permissions and

#  limitations under the License.

#

###########################################################################

#  Change values here                                                     #

#                                                                         #

VERSION="7.26.0"                                                          #

SDK="5.1"                                                                 #

DEVROOT="/Applications/Xcode.app/Contents/Developer/Platforms"            #

#                                                                         #

###########################################################################

#                                                                         #

# Don't change anything under this line!                                  #

#                                                                         #

###########################################################################

 

CURRENTPATH=`pwd`

 

cd "/Users/**/opensorce/curl-${VERSION}"

BUILDPATH=`pwd`

 

buildit()

{

    target=$1

    platform=$2

 

    export CC="${DEVROOT}/${platform}.platform/Developer/usr/bin/gcc"

    export CFLAGS="-arch ${target} -isysroot ${DEVROOT}/${platform}.platform/Developer/SDKs/${platform}${SDK}.sdk -I/Users/**/openssl_armv7/include -L/Users/**/openssl_armv7/lib"

    export CPP="${DEVROOT}/${platform}.platform/Developer/usr/bin/llvm-cpp-4.2"

    export AR="${DEVROOT}/${platform}.platform/Developer/usr/bin/ar"

    export RANLIB="${DEVROOT}/${platform}.platform/Developer/usr/bin/ranlib"

    export LDFLAGS="-arch armv7 -isysroot ${DEVROOT}/${platform}.platform/Developer/SDKs/${platform}${SDK}.sdk -L/Users/**/openssl_armv7/lib"

 

    ./configure --disable-shared  --enable-shared=no --with-random=/dev/urandom --with-ssl=/Users/zt/openssl_armv7/(这个是openssl的make install 后的目录) \

            --host=${target}-apple-darwin10

 

    make clean

    make

    $AR rv libcurl.${target}.a lib/*.o

    $RANLIB libcurl.${target}.a

}

 

buildit  armv7 iPhoneOS

 

echo "Build library..."

#lipo -create  ${BUILDPATH}/libcurl.i386.a  -output ${CURRENTPATH}/libcurl.a(可以把你的i386,armv6,armv7融合在一起)

 

#mkdir -p ${CURRENTPATH}/include

#cp -R ${BUILDPATH}/include ${CURRENTPATH}/

echo "Building done."


i这些关键字需要自己改的,


附上 openssl 的configue 和makefile的 改动


./Configure BSD-generic32 --openssldir=/Users/**/openssl_armv7



makefile 文件的部分改动


CC= /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7
CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
DEPFLAG= -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_STORE


make makeinstall


openssl_armv7文件夹脱出libssl.a libcryptto.a

大功告成!

原创粉丝点击