Hello Redpath...

Yes, we've gotten a nice build of OpenSSL 1.0.1e on OSX 10.8.2.

Felix Schulze's very nice work, available on GitHub; looks like you're using 
it: https://github.com/x2on/OpenSSL-for-iPhone.git
(yes, you do have to use the XCode command line to 'set' your environment)

Without getting back to my specific notes, believe there were a minor gotchas - 
like the script won't accommodate any spaces in directory names(imagine that!) 
- but it works great. 

Lou Picciano

----- Original Message -----
From: redpath <redp...@us.ibm.com>
To: openssl-users@openssl.org
Sent: Wed, 27 Mar 2013 16:20:16 -0000 (UTC)
Subject: Build iOS library of openssl 1.0.1e

Anyone have a working script for building the new openssl for iOS static
libraries.
I tried this script and it nicely downloads the openssl tar file
openssl-1.0.1e.tar
then tries to compile and the log seems to have a problem with the standard
includes,
not sure what needs to be set. I think I remember some command tool that
needs to 
be run to set up the gcc paths for the compiler on a terminal.


*EXCERPT LOG FILE *

Configured for iphoneos-cross.
making all in crypto...
( echo "#ifndef MK1MF_BUILD"; \
    echo '  /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \
    echo '  #define CFLAGS
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc
-arch i386 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
 
-DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
-fomit-frame-pointer -fno-common"'; \
    echo '  #define PLATFORM "iphoneos-cross"'; \
    echo "  #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
    echo '#endif' ) >buildinf.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc
-arch i386 -I. -I.. -I../include  -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
 
-DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
-fomit-frame-pointer -fno-common   -c -o cryptlib.o cryptlib.c
In file included from cryptlib.c:117:
*cryptlib.h:62:20: error: stdlib.h: No such file or directory*
cryptlib.h:63:20: error: string.h: No such file or directory
In file included from cryptlib.h:65,

*THE SCRIPT*

#!/bin/sh

#  Automatic build script for libssl and libcrypto 
#  for iPhoneOS and iPhoneSimulator
#
#  Created by Felix Schulze on 16.12.10.
#  Copyright 2010 Felix Schulze. 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="1.0.1e"                                                          #
SDKVERSION="5.1"                                                          #
#                                                                          #
###########################################################################
#                                                                          #
# Don't change anything under this line!                                  #
#                                                                          #
###########################################################################


CURRENTPATH=`pwd`
ARCHS="i386 armv7 armv7s"
DEVELOPER=`xcode-select -print-path`

if [ ! -d "$DEVELOPER" ]; then
  echo "xcode path is not set correctly $DEVELOPER does not exist (most
likely because of xcode > 4.3)"
  echo "run"
  echo "sudo xcode-select -switch "
  echo "for default installation:"
  echo "sudo xcode-select -switch
/Applications/Xcode.app/Contents/Developer"
  exit 1
fi

set -e
if [ ! -e openssl-${VERSION}.tar.gz ]; then
    echo "Downloading openssl-${VERSION}.tar.gz"
    curl -O http://www.openssl.org/source/openssl-${VERSION}.tar.gz
else
    echo "Using openssl-${VERSION}.tar.gz"
fi

mkdir -p "${CURRENTPATH}/src"
mkdir -p "${CURRENTPATH}/bin"
mkdir -p "${CURRENTPATH}/lib"

tar zxf openssl-${VERSION}.tar.gz -C "${CURRENTPATH}/src"
cd "${CURRENTPATH}/src/openssl-${VERSION}"


for ARCH in ${ARCHS}
do
    if [ "${ARCH}" == "i386" ];
    then
        PLATFORM="iPhoneSimulator"
    else
        sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile
intr_signal;!" "crypto/ui/ui_openssl.c"
        PLATFORM="iPhoneOS"
    fi
    
    export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
    export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk"

    echo "Building openssl-${VERSION} for ${PLATFORM} ${SDKVERSION} ${ARCH}"
    echo "Please stand by..."

    export CC="${CROSS_TOP}/usr/bin/gcc -arch ${ARCH}"
    mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk"

LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-openssl-${VERSION}.log"

    ./Configure iphoneos-cross
--openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" >
"${LOG}" 2>&1
    # add -isysroot to CC=
    sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} !"
"Makefile"

    make >> "${LOG}" 2>&1
    make install >> "${LOG}" 2>&1
    make clean >> "${LOG}" 2>&1
done

echo "Build library..."
lipo -create
${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/lib/libssl.a 
${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/libssl.a
${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7s.sdk/lib/libssl.a -output
${CURRENTPATH}/lib/libssl.a

lipo -create
${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/lib/libcrypto.a
${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/libcrypto.a
${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7s.sdk/lib/libcrypto.a -output
${CURRENTPATH}/lib/libcrypto.a

mkdir -p ${CURRENTPATH}/include
cp -R
${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/include/openssl
${CURRENTPATH}/include/
echo "Building done."
echo "Cleaning up..."
rm -rf ${CURRENTPATH}/src/openssl-${VERSION}
echo "Done."








--
View this message in context: 
http://openssl.6102.n7.nabble.com/Build-iOS-library-of-openssl-1-0-1e-tp44568.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to