Browse Source

Update script builds and fix OSX header

Marcin Krzyżanowski 9 years ago
parent
commit
74ba70d2d3

+ 16 - 0
OpenSSL-Universal.podspec

@@ -32,6 +32,22 @@ Pod::Spec.new do |s|
   s.ios.preserve_paths      = 'lib-ios/libcrypto.a', 'lib-ios/libssl.a'
   s.ios.vendored_libraries  = 'lib-ios/libcrypto.a', 'lib-ios/libssl.a'
 
+  s.watchos.platform          = :watchos, '2.0'
+  s.watchos.deployment_target = '2.0'
+  s.watchos.source_files        = 'include-watchos/openssl/**/*.h'
+  s.watchos.public_header_files = 'include-watchos/openssl/**/*.h'
+  s.watchos.header_dir          = 'openssl'
+  s.watchos.preserve_paths      = 'lib-watchos/libcrypto.a', 'lib-watchos/libssl.a'
+  s.watchos.vendored_libraries  = 'lib-watchos/libcrypto.a', 'lib-watchos/libssl.a'
+
+  s.tvos.platform          = tvos, '9.1'
+  s.tvos.deployment_target = '9.1'
+  s.tvos.source_files        = 'include-appletv/openssl/**/*.h'
+  s.tvos.public_header_files = 'include-appletv/openssl/**/*.h'
+  s.tvos.header_dir          = 'openssl'
+  s.tvos.preserve_paths      = 'lib-appletv/libcrypto.a', 'lib-appletv/libssl.a'
+  s.tvos.vendored_libraries  = 'lib-appletv/libcrypto.a', 'lib-appletv/libssl.a'
+
   s.osx.platform          = :osx, '10.9'
   s.osx.deployment_target = '10.8'
   s.osx.source_files        = 'include-osx/openssl/**/*.h'

+ 31 - 33
build.sh

@@ -11,30 +11,43 @@ OPENSSL_VERSION="1.0.1q"
 
 DEVELOPER=$(xcode-select --print-path)
 
-IOS_SDK_VERSION=$(xcrun --sdk iphoneos --show-sdk-version)
-IOS_DEPLOYMENT_VERSION="6.0"
-APPLETV_SDK_VERSION=$(xcrun --sdk appletvos --show-sdk-version)
-APPLETV_DEPLOYMENT_VERSION="9.1"
-WATCHOS_SDK_VERSION=$(xcrun --sdk watchos --show-sdk-version)
-WATCHOS_DEPLOYMENT_VERSION="2.1"
-OSX_SDK_VERSION=$(xcrun --sdk macosx --show-sdk-version)
-OSX_DEPLOYMENT_VERSION="10.8"
-
+IPHONEOS_SDK_VERSION=$(xcrun --sdk iphoneos --show-sdk-version)
+IPHONEOS_DEPLOYMENT_VERSION="6.0"
 IPHONEOS_PLATFORM=$(xcrun --sdk iphoneos --show-sdk-platform-path)
 IPHONEOS_SDK=$(xcrun --sdk iphoneos --show-sdk-path)
 
 IPHONESIMULATOR_PLATFORM=$(xcrun --sdk iphonesimulator --show-sdk-platform-path)
 IPHONESIMULATOR_SDK=$(xcrun --sdk iphonesimulator --show-sdk-path)
 
+OSX_SDK_VERSION=$(xcrun --sdk macosx --show-sdk-version)
+OSX_DEPLOYMENT_VERSION="10.8"
 OSX_PLATFORM=$(xcrun --sdk macosx --show-sdk-platform-path)
 OSX_SDK=$(xcrun --sdk macosx --show-sdk-path)
 
 # Clean up whatever was left from our previous build
 
-rm -rf include-ios include-osx lib-ios lib-osx
+rm -rf include-ios include-osx include-appletv include-watchos lib-ios lib-osx lib-appletv lib-watchos
 rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*"
 rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*.log"
 
+configure() {
+    OS=$1
+    ARCH=$2
+    PLATFORM=$3
+    SDK_VERSION=$4
+    DEPLOYMENT_VERSION=$5
+    
+    export CROSS_TOP="${PLATFORM}/Developer"
+    export CROSS_SDK="${OS}${SDK_VERSION}.sdk"
+    if [ "$ARCH" == "x86_64" ]; then
+       ./Configure darwin64-x86_64-cc --openssldir="/tmp/openssl-${OPENSSL_VERSION}-${ARCH}" &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.log"
+       sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -arch $ARCH -mios-simulator-version-min=${DEPLOYMENT_VERSION} !" "Makefile"
+   else
+       ./Configure iphoneos-cross -no-asm --openssldir="/tmp/openssl-${OPENSSL_VERSION}-${ARCH}" &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.log"
+       perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
+   fi
+}
+
 build()
 {
    ARCH=$1
@@ -57,27 +70,12 @@ build()
 
    if [ "$TYPE" == "ios" ]; then
       # IOS
-      if [ "$ARCH" == "x86_64" ]; then
-         # Simulator
-         export CROSS_TOP="${IPHONESIMULATOR_PLATFORM}/Developer"
-         export CROSS_SDK="iPhoneSimulator${IOS_SDK_VERSION}.sdk"
-         ./Configure darwin64-x86_64-cc --openssldir="/tmp/openssl-${OPENSSL_VERSION}-${ARCH}" &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.log"
-         sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -arch $ARCH -mios-simulator-version-min=${IOS_DEPLOYMENT_VERSION} !" "Makefile"
-      elif [ "$ARCH" == "i386" ]; then
-         # Simulator
-         export CROSS_TOP="${IPHONESIMULATOR_PLATFORM}/Developer"
-         export CROSS_SDK="iPhoneSimulator${IOS_SDK_VERSION}.sdk"
-         ./Configure iphoneos-cross -no-asm --openssldir="/tmp/openssl-${OPENSSL_VERSION}-${ARCH}" &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.log"
-         sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -arch $ARCH -mios-simulator-version-min=${IOS_DEPLOYMENT_VERSION} !" "Makefile"
+      if [ "$ARCH" == "x86_64" ] || [ "$ARCH" == "i386" ]; then
+         configure "iPhoneSimulator" $ARCH ${IPHONESIMULATOR_PLATFORM} ${IPHONESIMULATOR_SDK_VERSION} ${IPHONESIMULATOR_DEPLOYMENT_VERSION}
       else
-         # iOS
-         export CROSS_TOP="${IPHONEOS_PLATFORM}/Developer"
-         export CROSS_SDK="iPhoneOS${IOS_SDK_VERSION}.sdk"
-         ./Configure iphoneos-cross -no-asm --openssldir="/tmp/openssl-${OPENSSL_VERSION}-${ARCH}" &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.log"
-         perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
-         sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -arch $ARCH -miphoneos-version-min=${IOS_DEPLOYMENT_VERSION} !" "Makefile"
+         configure "iPhoneOS" $ARCH ${IPHONEOS_PLATFORM} ${IPHONEOS_SDK_VERSION} ${IPHONEOS_DEPLOYMENT_VERSION}
       fi
-   else
+   elif [ "$TYPE" == "osx" ]; then    
       #OSX
       if [ "$ARCH" == "x86_64" ]; then
          ./Configure darwin64-x86_64-cc --openssldir="/tmp/openssl-${OPENSSL_VERSION}-${ARCH}" &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.log"
@@ -103,20 +101,20 @@ build()
    fi
 }
 
+build "i386" "${IPHONESIMULATOR_SDK}" "ios"
+build "x86_64" "${IPHONESIMULATOR_SDK}" "ios"
 build "armv7" "${IPHONEOS_SDK}" "ios"
 build "armv7s" "${IPHONEOS_SDK}" "ios"
 build "arm64" "${IPHONEOS_SDK}" "ios"
-build "i386" "${IPHONESIMULATOR_SDK}" "ios"
-build "x86_64" "${IPHONESIMULATOR_SDK}" "ios"
 
 mkdir -p include-ios
-cp -r /tmp/openssl-${OPENSSL_VERSION}-i386/include/openssl include-ios/
+cp -r /tmp/openssl-${OPENSSL_VERSION}-arm64/include/openssl include-ios/
 
 build "i386" "${OSX_SDK}" "osx"
 build "x86_64" "${OSX_SDK}" "osx"
 
 mkdir -p include-osx
-cp -r /tmp/openssl-${OPENSSL_VERSION}-i386/include/openssl include-osx/
+cp -r /tmp/openssl-${OPENSSL_VERSION}-x86_64/include/openssl include-osx/
 
 rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*"
 rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*.log"

+ 2 - 2
include-ios/openssl/opensslconf.h

@@ -98,8 +98,8 @@ extern "C" {
 
 #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
 #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
-#define ENGINESDIR "/tmp/openssl-1.0.1q-i386/lib/engines"
-#define OPENSSLDIR "/tmp/openssl-1.0.1q-i386"
+#define ENGINESDIR "/tmp/openssl-1.0.1q-arm64/lib/engines"
+#define OPENSSLDIR "/tmp/openssl-1.0.1q-arm64"
 #endif
 #endif
 

+ 11 - 12
include-osx/openssl/opensslconf.h

@@ -5,8 +5,8 @@
 extern "C" {
 #endif
 /* OpenSSL was configured with the following options: */
-#ifndef OPENSSL_SYSNAME_iOS
-# define OPENSSL_SYSNAME_iOS
+#ifndef OPENSSL_SYSNAME_MACOSX
+# define OPENSSL_SYSNAME_MACOSX
 #endif
 #ifndef OPENSSL_DOING_MAKEDEPEND
 
@@ -47,9 +47,6 @@ extern "C" {
 #ifndef OPENSSL_THREADS
 # define OPENSSL_THREADS
 #endif
-#ifndef OPENSSL_NO_ASM
-# define OPENSSL_NO_ASM
-#endif
 #ifndef OPENSSL_NO_DYNAMIC_ENGINE
 # define OPENSSL_NO_DYNAMIC_ENGINE
 #endif
@@ -91,6 +88,8 @@ extern "C" {
 # endif
 #endif
 
+#define OPENSSL_CPUID_OBJ
+
 /* crypto/opensslconf.h.in */
 
 /* Generate 80386 code? */
@@ -98,8 +97,8 @@ extern "C" {
 
 #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
 #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
-#define ENGINESDIR "/tmp/openssl-1.0.1q-i386/lib/engines"
-#define OPENSSLDIR "/tmp/openssl-1.0.1q-i386"
+#define ENGINESDIR "/tmp/openssl-1.0.1q-x86_64/lib/engines"
+#define OPENSSLDIR "/tmp/openssl-1.0.1q-x86_64"
 #endif
 #endif
 
@@ -145,20 +144,20 @@ extern "C" {
 /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
  * %20 speed up (longs are 8 bytes, int's are 4). */
 #ifndef DES_LONG
-#define DES_LONG unsigned long
+#define DES_LONG unsigned int
 #endif
 #endif
 
 #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
 #define CONFIG_HEADER_BN_H
-#define BN_LLONG
+#undef BN_LLONG
 
 /* Should we define BN_DIV2W here? */
 
 /* Only one for the following should be defined */
-#undef SIXTY_FOUR_BIT_LONG
+#define SIXTY_FOUR_BIT_LONG
 #undef SIXTY_FOUR_BIT
-#define THIRTY_TWO_BIT
+#undef THIRTY_TWO_BIT
 #endif
 
 #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
@@ -170,7 +169,7 @@ extern "C" {
 
 #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
 #define CONFIG_HEADER_BF_LOCL_H
-#define BF_PTR
+#undef BF_PTR
 #endif /* HEADER_BF_LOCL_H */
 
 #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)

BIN
lib-ios/libcrypto.a


BIN
lib-ios/libssl.a


BIN
lib-osx/libcrypto.a


BIN
lib-osx/libssl.a