Merge pull request #91 from Zen-CODE/add_openssl

Add optional openssl support
This commit is contained in:
Mathieu Virbel 2014-09-29 22:04:26 +02:00
commit 54347f6d8a
4 changed files with 70 additions and 0 deletions

View file

@ -4,6 +4,9 @@
try $(dirname $0)/build-libffi.sh
try $(dirname $0)/build-python.sh
# Uncomment the "try" line below to add OpenSSL support libraries
# For more detail: https://github.com/zen-code/ios-openssl
#try $(dirname $0)/build-openssl.sh
try $(dirname $0)/reduce-python.sh
try $(dirname $0)/build-ios.sh
try $(dirname $0)/build-sdl.sh

20
tools/build-openssl-link.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
. $(dirname $0)/environment.sh
echo "Modifying Python Setup.dist..."
cp $TMPROOT/Python-2.7.1/Modules/Setup.dist $KIVYIOSROOT/src/python_files
SETUP_DIST=$KIVYIOSROOT/src/python_files/Setup.dist
echo "" >> $SETUP_DIST
echo "# Adding SSL Links" >> $SETUP_DIST
echo "# Socket module helper for sockets" >> $SETUP_DIST
echo "_socket socketmodule.c" >> $SETUP_DIST
echo "SSL=$TMPROOT/openssl/ios-openssl/openssl" >> $SETUP_DIST
echo "_ssl _ssl.c \\" >> $SETUP_DIST
echo " -DUSE_SSL -I\$(SSL)/include -I\$(SSL)/include/openssl \\" >> $SETUP_DIST
echo " -L\$(SSL)/lib -lssl -lcrypto" >> $SETUP_DIST
echo "Cleaning and rebuilding Python to inlcude SSL links..."
sh $KIVYIOSROOT/tools/clean_python.sh
sh $KIVYIOSROOT/tools/build-python.sh

39
tools/build-openssl.sh Executable file
View file

@ -0,0 +1,39 @@
#!/bin/bash
. $(dirname $0)/environment.sh
if [ ! -d $TMPROOT/openssl ] ; then
mkdir $TMPROOT/openssl
fi
# Check we have a cloned repo
if [ ! -d $TMPROOT/openssl/ios-openssl ] ; then
echo "ios-openssl repo not found. Pulling latest..."
try pushd .
cd $TMPROOT/openssl
try git clone -b master https://github.com/zen-code/ios-openssl
try popd
fi
# Build the required binaries if not found (long process)
if [ ! -f $BUILDROOT/lib/libssl.a ] ; then
if [ -d $TMPROOT/openssl/ios-openssl ] ; then
echo "ios-openssl repo found. Building now..."
if [ ! -d $TMPROOT/openssl/ios-openssl/lib ] ; then
try mkdir $TMPROOT/openssl/ios-openssl/lib
fi
try pushd .
cd $TMPROOT/openssl/ios-openssl
# Please refer to the script below for details of the OpenSSL build
sh build.sh
try popd
fi
else
echo "Skipping build. Binary found: $BUILDROOT/lib/libssl.a"
fi
echo "Copying built OpenSSL binaries..."
cp $TMPROOT/openssl/ios-openssl/lib/libssl.a $BUILDROOT/lib/libssl.a
cp $TMPROOT/openssl/ios-openssl/lib/libcrypto.a $BUILDROOT/lib/libcrypto.a
sh $KIVYIOSROOT/tools/build-openssl-link.sh

View file

@ -25,6 +25,10 @@ try patch -p1 < $KIVYIOSROOT/src/python_files/Python-$IOS_PYTHON_VERSION-static-
# Copy our setup for modules
try cp $KIVYIOSROOT/src/python_files/ModulesSetup Modules/Setup.local
try cp $KIVYIOSROOT/src/python_files/_scproxy.py Lib/_scproxy.py
if [ -f $KIVYIOSROOT/src/python_files/Setup.dist ]; then
# Used by build-openssl.sh to insert links
try cp $KIVYIOSROOT/src/python_files/Setup.dist Modules/Setup.dist
fi
echo "Building for native machine ============================================"
@ -54,6 +58,10 @@ export MACOSX_DEPLOYMENT_TARGET=
try cp $KIVYIOSROOT/src/python_files/ModulesSetup Modules/Setup.local
try cat $KIVYIOSROOT/src/python_files/ModulesSetup.mobile >> Modules/Setup.local
try cp $KIVYIOSROOT/src/python_files/_scproxy.py Lib/_scproxy.py
if [ -f $KIVYIOSROOT/src/python_files/Setup.dist ]; then
# Used by build-openssl.sh to insert links
try cp $KIVYIOSROOT/src/python_files/Setup.dist Modules/Setup.dist
fi
try ./configure CC="$ARM_CC" LD="$ARM_LD" \
CFLAGS="$ARM_CFLAGS" \