Mac Developer: Xcode static openssl darwin libssl.a libopenssl.a
#!/bin/bash
cd /Users/me/openssl/
OPENSSL_VERSION="1.0.1c"
curl -O http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_i386
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_x86_64
cd openssl_i386
./Configure darwin-i386-cc
make
cd ../
cd openssl_x86_64
./Configure darwin64-x86_64-cc
make
cd ../
mkdir libopenssl
mkdir libopenssl/lib
libtool -static -o ./libopenssl/lib/libcrypto.a ./openssl_i386/libcrypto.a
./openssl_x86_64/libcrypto.a
libtool -static -o ./libopenssl/lib/libssl.a ./openssl_i386/libssl.a
./openssl_x86_64/libssl.a
ln -s -v /Users/me/openssl/openssl_i386/include openssl-$OPENSSL_VERSION
ln -s -v /Users/me/openssl/openssl_x86_64/include libopenssl
rm openssl-$OPENSSL_VERSION.tar.gz
Dynamically linking to crypto.dylib has been deprecated and CommonCrypto is the preferred system API. If you rely on openssl, you may want to create static libaries and link to them directly. I was scrounging on the internet and found a script which I modified for this purpose. Replace
/Users/me/openssl with your own private openssl directory name.
Post a Comment