Skip to content

Commit 872add0

Browse files
committed
version 1.1.1w
1 parent 9af0c8c commit 872add0

File tree

4 files changed

+120
-20
lines changed

4 files changed

+120
-20
lines changed

README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
## OpenSSL for iOS and Mac OS X (Intel & Apple Silicon M1) & Catalyst - arm64 / x86_64
1+
## OpenSSL for iOS, visionOS, macOS (Intel & Apple Silicon M1) & Catalyst - arm64 / x86_64
22

33
Supported version: 1.1.1w
44

5-
This repo provides a universal script for building static OpenSSL libraries for use in iOS and Mac OS X applications.
6-
The actual library version is taken from https://github.com/openssl/openssl with tag 'OpenSSL_1_1_1u'
5+
This repository provides a universal script for building static OpenSSL libraries for use in iOS, visionOS, and macOS & Catalyst applications.
6+
The actual library version is taken from https://github.com/openssl/openssl with tag 'openssl-1.1.1w'
77

88
## Prerequisites
99
1) Xcode must be installed because xcodebuild is used to create xcframeworks
1010
2) ```xcode-select -p``` must point to Xcode app developer directory (by default e.g. /Applications/Xcode.app/Contents/Developer). If it points to CommandLineTools directory you should execute:
1111
```sudo xcode-select --reset``` or ```sudo xcode-select -s /Applications/Xcode.app/Contents/Developer```
12+
3) For the creation of visionOS related artifacts and their integration into the resulting xcframeworks, XROS.platform and XRSimulator.platform should be available in the folder: /Applications/Xcode.app/Contents/Developer/Platforms
1213

1314
## How to build?
1415
- Manually
@@ -27,19 +28,19 @@ The actual library version is taken from https://github.com/openssl/openssl with
2728
use_frameworks!
2829
pod 'openssl-iosx', '~> 1.1.1w'
2930
# or optionally more precisely
30-
# pod 'openssl-iosx', :git => 'https://github.com/apotocki/openssl-iosx', :tag => '1.1.1w.0'
31+
# pod 'openssl-iosx', :git => 'https://github.com/apotocki/openssl-iosx', :tag => '1.1.1w.1'
3132
```
3233
install new dependency:
3334
```
3435
pod install --verbose
3536
```
3637

3738
## As an advertisement…
38-
Look at my iOS application on App Store, please:
39+
Please check out my iOS application on the App Store:
3940

4041
[<table align="center" border=0 cellspacing=0 cellpadding=0><tr><td><img src="https://is4-ssl.mzstatic.com/image/thumb/Purple112/v4/78/d6/f8/78d6f802-78f6-267a-8018-751111f52c10/AppIcon-0-1x_U007emarketing-0-10-0-85-220.png/460x0w.webp" width="70"/></td><td><a href="https://apps.apple.com/us/app/potohex/id1620963302">PotoHEX</a><br>HEX File Viewer & Editor</td><tr></table>]()
4142

42-
This app is designed for viewing and editing files at byte or character level.
43+
This application is designed to view and edit files at the byte or character level; calculate different hashes, encode/decode, and compress/decompress desired byte regions.
4344

4445
You can support my open-source development by trying the [App](https://apps.apple.com/us/app/potohex/id1620963302).
4546

openssl-iosx.podspec

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
Pod::Spec.new do |s|
22
s.name = "openssl-iosx"
3-
s.version = "1.1.1w.0"
4-
s.summary = "OpenSSL"
3+
s.version = "1.1.1w.1"
4+
s.summary = "OpenSSL libraries for macOS, iOS, and visionOS, including both arm64 and x86_64 builds for macOS, Mac Catalyst, iOS Simulator, and visionOS Simulator."
55
s.homepage = "https://github.com/apotocki/openssl-iosx"
66
s.license = "Apache"
77
s.author = { "Alexander Pototskiy" => "alex.a.potocki@gmail.com" }
88
s.social_media_url = "https://www.linkedin.com/in/alexander-pototskiy"
99
s.osx.deployment_target = "11.0"
1010
s.ios.deployment_target = "13.4"
11+
s.visionos.deployment_target = "1.0"
1112
s.osx.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' }
1213
s.ios.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' }
14+
s.visionos.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' }
1315
s.static_framework = true
1416
s.prepare_command = "sh scripts/build.sh"
1517
s.source = { :git => "https://github.com/apotocki/openssl-iosx.git", :tag => "#{s.version}" }

scripts/15-ios.conf.patch

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@@ -32,6 +32,23 @@
2+
inherit_from => [ "ios-common" ],
3+
CC => "xcrun -sdk iphonesimulator cc",
4+
},
5+
+ "xros-common" => {
6+
+ template => 1,
7+
+ inherit_from => [ "darwin-common" ],
8+
+ sys_id => "visionOS",
9+
+ disable => [ "engine", "async" ],
10+
+ },
11+
+ "xros-xcrun" => {
12+
+ inherit_from => [ "xros-common", asm("aarch64_asm") ],
13+
+ CC => "xcrun -sdk xros cc",
14+
+ cflags => add("-arch arm64 -fno-common"),
15+
+ bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
16+
+ perlasm_scheme => "ios64",
17+
+ },
18+
+ "xrossimulator-xcrun" => {
19+
+ inherit_from => [ "xros-common" ],
20+
+ CC => "xcrun -sdk xrsimulator cc",
21+
+ },
22+
# It takes three prior-set environment variables to make it work:
23+
#
24+
# CROSS_COMPILE=/where/toolchain/is/usr/bin/ [note ending slash]

scripts/build.sh

+85-12
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,45 @@ THREAD_COUNT=$(sysctl hw.ncpu | awk '{print $2}')
66
HOST_ARC=$( uname -m )
77
XCODE_ROOT=$( xcode-select -print-path )
88
OPENSSL_VER=OpenSSL_1_1_1w
9+
#MACOSX_VERSION_ARM=12.3
10+
#MACOSX_VERSION_X86_64=10.13
911
################## SETUP END
10-
#DEVSYSROOT=$XCODE_ROOT/Platforms/iPhoneOS.platform/Developer
11-
#SIMSYSROOT=$XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer
12+
#IOSSYSROOT=$XCODE_ROOT/Platforms/iPhoneOS.platform/Developer
13+
#IOSSIMSYSROOT=$XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer
1214
MACSYSROOT=$XCODE_ROOT/Platforms/MacOSX.platform/Developer
13-
OPENSSL_VER_NAME=${OPENSSL_VER//.//-}
15+
XROSSYSROOT=$XCODE_ROOT/Platforms/XROS.platform/Developer
16+
XROSSIMSYSROOT=$XCODE_ROOT/Platforms/XRSimulator.platform/Developer
17+
1418
BUILD_DIR="$( cd "$( dirname "./" )" >/dev/null 2>&1 && pwd )"
19+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
1520

1621
if [ "$HOST_ARC" = "arm64" ]; then
1722
FOREIGN_ARC=x86_64
23+
FOREIGN_BUILD_FLAGS="" && [ ! -z "${MACOSX_VERSION_X86_64}" ] && FOREIGN_BUILD_FLAGS="-mmacosx-version-min=$MACOSX_VERSION_X86_64"
24+
NATIVE_BUILD_FLAGS="" && [ ! -z "${MACOSX_VERSION_ARM}" ] && NATIVE_BUILD_FLAGS="-mmacosx-version-min=$MACOSX_VERSION_ARM"
1825
else
1926
FOREIGN_ARC=arm64
27+
FOREIGN_BUILD_FLAGS="" && [ ! -z "${MACOSX_VERSION_ARM}" ] && FOREIGN_BUILD_FLAGS="-mmacosx-version-min=$MACOSX_VERSION_ARM"
28+
NATIVE_BUILD_FLAGS="" && [ ! -z "${MACOSX_VERSION_X86_64}" ] && NATIVE_BUILD_FLAGS="-mmacosx-version-min=$MACOSX_VERSION_X86_64"
2029
fi
21-
30+
FOREIGN_BUILD_FLAGS="-arch $FOREIGN_ARC $FOREIGN_BUILD_FLAGS"
2231

2332
if [[ ! -d $BUILD_DIR/frameworks ]]; then
2433

25-
if [[ ! -d $OPENSSL_VER_NAME ]]; then
34+
if [[ ! -d $OPENSSL_VER ]]; then
2635
echo downloading $OPENSSL_VER ...
27-
git clone --depth 1 -b $OPENSSL_VER https://github.com/openssl/openssl $OPENSSL_VER_NAME
36+
git clone --depth 1 -b $OPENSSL_VER https://github.com/openssl/openssl $OPENSSL_VER
2837
fi
2938

30-
pushd $OPENSSL_VER_NAME
39+
pushd $OPENSSL_VER
40+
41+
echo patching openssl...
42+
if [ ! -f Configurations/15-ios.conf.orig ]; then
43+
cp -f Configurations/15-ios.conf Configurations/15-ios.conf.orig
44+
else
45+
cp -f Configurations/15-ios.conf.orig Configurations/15-ios.conf
46+
fi
47+
patch Configurations/15-ios.conf $SCRIPT_DIR/15-ios.conf.patch
3148

3249
function arc()
3350
{
@@ -44,7 +61,6 @@ build_catalyst_libs()
4461
{
4562
if [[ ! -d $BUILD_DIR/build/lib.catalyst-$1 ]]; then
4663
./Configure --openssldir="$BUILD_DIR/build/ssl" no-shared darwin64-$1-cc --target=$(arc $1)-apple-ios13.4-macabi -isysroot $MACSYSROOT/SDKs/MacOSX.sdk
47-
# -I$MACSYSROOT/SDKs/MacOSX.sdk/System/iOSSupport/usr/include/ -isystem $MACSYSROOT/SDKs/MacOSX.sdk/System/iOSSupport/usr/include -iframework $MACSYSROOT/SDKs/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks
4864
make clean
4965
make -j$THREAD_COUNT
5066

@@ -69,6 +85,20 @@ build_sim_libs()
6985
fi
7086
}
7187

88+
build_xrossim_libs()
89+
{
90+
if [[ ! -d $BUILD_DIR/build/lib.xrossim-$1 ]]; then
91+
./Configure --openssldir="$BUILD_DIR/build/ssl" no-shared xrossimulator-xcrun CFLAGS="-arch $1"
92+
make clean
93+
make -j$THREAD_COUNT
94+
95+
mkdir $BUILD_DIR/build/lib.xrossim-$1
96+
cp libssl.a $BUILD_DIR/build/lib.xrossim-$1/
97+
cp libcrypto.a $BUILD_DIR/build/lib.xrossim-$1/
98+
make clean
99+
fi
100+
}
101+
72102
build_ios_libs()
73103
{
74104
if [[ ! -d $BUILD_DIR/build/lib.ios ]]; then
@@ -83,15 +113,29 @@ build_ios_libs()
83113
fi
84114
}
85115

116+
build_xros_libs()
117+
{
118+
if [[ ! -d $BUILD_DIR/build/lib.xros ]]; then
119+
./Configure --openssldir="$BUILD_DIR/build/ssl" no-shared no-dso no-hw no-engine xros-xcrun -fembed-bitcode
120+
make clean
121+
make -j$THREAD_COUNT
122+
123+
mkdir $BUILD_DIR/build/lib.xros
124+
cp libssl.a $BUILD_DIR/build/lib.xros/
125+
cp libcrypto.a $BUILD_DIR/build/lib.xros/
126+
make clean
127+
fi
128+
}
129+
86130
if [[ ! -d $BUILD_DIR/build/lib ]]; then
87-
./Configure --prefix="$BUILD_DIR/build" --openssldir="$BUILD_DIR/build/ssl" no-shared darwin64-$HOST_ARC-cc
131+
./Configure --prefix="$BUILD_DIR/build" --openssldir="$BUILD_DIR/build/ssl" no-shared darwin64-$HOST_ARC-cc CFLAGS="$NATIVE_BUILD_FLAGS"
88132
make clean
89133
make -j$THREAD_COUNT
90134
make install
91135
make clean
92136
fi
93137
if [[ ! -d $BUILD_DIR/build/lib.macos ]]; then
94-
./Configure --openssldir="$BUILD_DIR/build/ssl" no-shared darwin64-$FOREIGN_ARC-cc CFLAGS="-arch $FOREIGN_ARC"
138+
./Configure --openssldir="$BUILD_DIR/build/ssl" no-shared darwin64-$FOREIGN_ARC-cc CFLAGS="$FOREIGN_BUILD_FLAGS"
95139
make clean
96140
make -j$THREAD_COUNT
97141

@@ -118,14 +162,43 @@ if [[ ! -d $BUILD_DIR/build/lib.iossim ]]; then
118162
lipo -create $BUILD_DIR/build/lib.iossim-x86_64/libcrypto.a $BUILD_DIR/build/lib.iossim-arm64/libcrypto.a -output $BUILD_DIR/build/lib.iossim/libcrypto.a
119163
fi
120164

165+
if [ -d $XROSSIMSYSROOT/SDKs/XRSimulator.sdk ]; then
166+
if [[ ! -d $BUILD_DIR/build/lib.xrossim ]]; then
167+
build_xrossim_libs arm64
168+
build_xrossim_libs x86_64
169+
mkdir $BUILD_DIR/build/lib.xrossim
170+
lipo -create $BUILD_DIR/build/lib.xrossim-x86_64/libssl.a $BUILD_DIR/build/lib.xrossim-arm64/libssl.a -output $BUILD_DIR/build/lib.xrossim/libssl.a
171+
lipo -create $BUILD_DIR/build/lib.xrossim-x86_64/libcrypto.a $BUILD_DIR/build/lib.xrossim-arm64/libcrypto.a -output $BUILD_DIR/build/lib.xrossim/libcrypto.a
172+
fi
173+
fi
174+
121175
build_ios_libs
176+
if [ -d $XROSSYSROOT ]; then
177+
build_xros_libs
178+
fi
122179

123180
mkdir $BUILD_DIR/frameworks
124181

125182
cp -R $BUILD_DIR/build/include $BUILD_DIR/frameworks/Headers
126183

127-
xcodebuild -create-xcframework -library $BUILD_DIR/build/lib.macos/libssl.a -library $BUILD_DIR/build/lib.catalyst/libssl.a -library $BUILD_DIR/build/lib.iossim/libssl.a -library $BUILD_DIR/build/lib.ios/libssl.a -output $BUILD_DIR/frameworks/ssl.xcframework
128-
xcodebuild -create-xcframework -library $BUILD_DIR/build/lib.macos/libcrypto.a -library $BUILD_DIR/build/lib.catalyst/libcrypto.a -library $BUILD_DIR/build/lib.iossim/libcrypto.a -library $BUILD_DIR/build/lib.ios/libcrypto.a -output $BUILD_DIR/frameworks/crypto.xcframework
184+
create_xcframework()
185+
{
186+
LIBARGS="-library $BUILD_DIR/build/lib.macos/lib$1.a \
187+
-library $BUILD_DIR/build/lib.catalyst/lib$1.a \
188+
-library $BUILD_DIR/build/lib.iossim/lib$1.a \
189+
-library $BUILD_DIR/build/lib.ios/lib$1.a"
190+
191+
if [ -d $XROSSIMSYSROOT/SDKs/XRSimulator.sdk ]; then
192+
LIBARGS="$LIBARGS -library $BUILD_DIR/build/lib.xrossim/lib$1.a"
193+
fi
194+
if [ -d $XROSSYSROOT/SDKs/XROS.sdk ]; then
195+
LIBARGS="$LIBARGS -library $BUILD_DIR/build/lib.xros/lib$1.a"
196+
fi
197+
xcodebuild -create-xcframework $LIBARGS -output "$BUILD_DIR/frameworks/$1.xcframework"
198+
}
199+
200+
create_xcframework ssl
201+
create_xcframework crypto
129202

130203
popd
131204

0 commit comments

Comments
 (0)