Merge pull request #26 from keeshux/migrate-to-xcframework

Package fat frameworks as XCFramework
This commit is contained in:
Davide De Rosa 2020-11-17 10:07:04 +01:00 committed by GitHub
commit c1ce10a4f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 59 additions and 74 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
bin
src
lib
frameworks
include/openssl
*.gz
*.framework

View File

@ -12,4 +12,4 @@ branches:
install:
- bundle install --jobs=3 --deployment --path=${BUNDLE_PATH:-vendor/bundle}
- bundle exec pod repo update
- travis_wait 30 bundle exec pod install
- travis_wait 40 bundle exec pod install

View File

@ -134,6 +134,7 @@
0EF4C83B254B2DDE0030F3CE /* Sources */,
0EF4C83C254B2DDE0030F3CE /* Frameworks */,
0EF4C83D254B2DDE0030F3CE /* Resources */,
5E422EBA5A955FA396AE01A7 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@ -220,6 +221,23 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
5E422EBA5A955FA396AE01A7 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Demo/Pods-Demo-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Demo/Pods-Demo-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Demo/Pods-Demo-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
E779C03A2743FDC34CB79861 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;

View File

@ -1,7 +1,7 @@
Pod::Spec.new do |s|
openssl_version = "1.1.1h"
openssl_targets = "ios-sim-cross-x86_64 ios64-cross-arm64 ios64-cross-arm64e macos64-x86_64 macos64-arm64 mac-catalyst-arm64"
script_version = "7"
openssl_targets = "ios-sim-cross-x86_64 ios-sim-cross-arm64 ios64-cross-arm64 ios64-cross-arm64e macos64-x86_64 macos64-arm64 mac-catalyst-x86_64 mac-catalyst-arm64"
script_version = "8"
s.name = "OpenSSL-Apple"
s.version = "#{openssl_version}.#{script_version}"
@ -18,10 +18,7 @@ Pod::Spec.new do |s|
CMD
s.ios.deployment_target = "12.0"
s.ios.vendored_frameworks = "frameworks/iPhone/openssl.framework"
s.ios.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.ios.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.osx.deployment_target = "10.15"
s.osx.vendored_frameworks = "frameworks/MacOSX/openssl.framework"
s.vendored_frameworks = "frameworks/openssl.xcframework"
s.requires_arc = false
end

View File

@ -1,27 +0,0 @@
Pod::Spec.new do |s|
openssl_version = "%OPENSSL-VERSION%"
openssl_targets = "ios-sim-cross-x86_64 ios64-cross-arm64 ios64-cross-arm64e macos64-x86_64 macos64-arm64 mac-catalyst-arm64"
script_version = "7"
s.name = "OpenSSL-Apple"
s.version = "#{openssl_version}.#{script_version}"
s.summary = "A script for compiling OpenSSL for Apple Devices"
s.authors = "Felix Schulze", "Davide De Rosa", "Ezat Hashim"
s.homepage = "https://github.com/keeshux/openssl-apple.git"
s.source = { :git => s.homepage.to_s, :tag => "v#{script_version}" }
s.license = { :type => 'Apache', :file => 'LICENSE' }
s.prepare_command = <<-CMD
./build-libssl.sh --version="#{openssl_version}" --targets="#{openssl_targets}"
./create-openssl-framework.sh dynamic
CMD
s.ios.deployment_target = "12.0"
s.ios.vendored_frameworks = "frameworks/iPhone/openssl.framework"
s.ios.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.ios.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.osx.deployment_target = "10.15"
s.osx.vendored_frameworks = "frameworks/MacOSX/openssl.framework"
s.requires_arc = false
end

View File

@ -1,5 +1,5 @@
PODS:
- OpenSSL-Apple (1.1.1h.7)
- OpenSSL-Apple (1.1.1h.8)
DEPENDENCIES:
- OpenSSL-Apple (from `.`)
@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: "."
SPEC CHECKSUMS:
OpenSSL-Apple: ea3144c521f4d5f620bc911686ddc42f48ae17d8
OpenSSL-Apple: 70990157548ecf94885310231aff52db698e1077
PODFILE CHECKSUM: 46de088b71467a12879d73c36eda858ad56ed167

1
assets/AppleTVOS Symbolic link
View File

@ -0,0 +1 @@
AppleTV

1
assets/AppleTVSimulator Symbolic link
View File

@ -0,0 +1 @@
AppleTV

1
assets/WatchOS Symbolic link
View File

@ -0,0 +1 @@
Watch

1
assets/WatchSimulator Symbolic link
View File

@ -0,0 +1 @@
Watch

1
assets/iPhoneOS Symbolic link
View File

@ -0,0 +1 @@
iPhone

1
assets/iPhoneSimulator Symbolic link
View File

@ -0,0 +1 @@
iPhone

View File

@ -525,41 +525,6 @@ LIBCRYPTO_TVOS=()
source "${SCRIPTDIR}/scripts/build-loop-targets.sh"
# Build iOS library if selected for build
if [ ${#LIBSSL_IOS[@]} -gt 0 ]; then
echo "Build library for iOS..."
lipo -create ${LIBSSL_IOS[@]} -output "${CURRENTPATH}/lib/libssl-iPhone.a"
lipo -create ${LIBCRYPTO_IOS[@]} -output "${CURRENTPATH}/lib/libcrypto-iPhone.a"
fi
#Build macOS library if selected for build
if [ ${#LIBSSL_MACOS[@]} -gt 0 ]; then
echo "Build library for macOS..."
lipo -create ${LIBSSL_MACOS[@]} -output "${CURRENTPATH}/lib/libssl-MacOSX.a"
lipo -create ${LIBCRYPTO_MACOS[@]} -output "${CURRENTPATH}/lib/libcrypto-MacOSX.a"
fi
#Build Catalyst library if selected for build
if [ ${#LIBSSL_CATALYST[@]} -gt 0 ]; then
echo "Build library for Catalyst..."
lipo -create ${LIBSSL_CATALYST[@]} -output "${CURRENTPATH}/lib/libssl-Catalyst.a"
lipo -create ${LIBCRYPTO_CATALYST[@]} -output "${CURRENTPATH}/lib/libcrypto-Catalyst.a"
fi
# Build tvOS library if selected for build
if [ ${#LIBSSL_WATCHOS[@]} -gt 0 ]; then
echo "Build library for watchOS..."
lipo -create ${LIBSSL_WATCHOS[@]} -output "${CURRENTPATH}/lib/libssl-Watch.a"
lipo -create ${LIBCRYPTO_WATCHOS[@]} -output "${CURRENTPATH}/lib/libcrypto-Watch.a"
fi
# Build tvOS library if selected for build
if [ ${#LIBSSL_TVOS[@]} -gt 0 ]; then
echo "Build library for tvOS..."
lipo -create ${LIBSSL_TVOS[@]} -output "${CURRENTPATH}/lib/libssl-AppleTV.a"
lipo -create ${LIBCRYPTO_TVOS[@]} -output "${CURRENTPATH}/lib/libcrypto-AppleTV.a"
fi
# Copy include directory
cp -R "${INCLUDE_DIR}" "${CURRENTPATH}/include/"

View File

@ -21,7 +21,8 @@ if [ -d $FWROOT ]; then
rm -rf $FWROOT
fi
ALL_SYSTEMS=("iPhone" "AppleTV" "MacOSX" "Catalyst" "Watch")
#ALL_SYSTEMS=("iPhone" "AppleTV" "MacOSX" "Catalyst" "Watch")
ALL_SYSTEMS=("iPhoneOS" "iPhoneSimulator" "AppleTVOS" "AppleTVSimulator" "MacOSX" "Catalyst" "WatchOS" "WatchSimulator")
function check_bitcode() {
local FWDIR=$1
@ -212,11 +213,17 @@ else
for SYS in ${ALL_SYSTEMS[@]}; do
SYSDIR="$FWROOT/$SYS"
FWDIR="$SYSDIR/$FWNAME.framework"
LIBS_CRYPTO=(bin/${SYS}*/lib/libcrypto.a)
LIBS_SSL=(bin/${SYS}*/lib/libssl.a)
if [[ -e lib/libcrypto-$SYS.a && -e lib/libssl-$SYS.a ]]; then
if [[ ${#LIBS_CRYPTO[@]} -gt 0 && -e ${LIBS_CRYPTO[0]} && ${#LIBS_SSL[@]} -gt 0 && -e ${LIBS_SSL[0]} ]]; then
echo "Creating framework for $SYS"
mkdir -p $FWDIR/lib
lipo -create ${LIBS_CRYPTO[@]} -output $FWDIR/lib/libcrypto.a
lipo -create ${LIBS_SSL[@]} -output $FWDIR/lib/libssl.a
libtool -static -o $FWDIR/$FWNAME $FWDIR/lib/*.a
rm -rf $FWDIR/lib
mkdir -p $FWDIR/Headers
libtool -static -o $FWDIR/$FWNAME lib/libcrypto-$SYS.a lib/libssl-$SYS.a
cp -r include/$FWNAME/* $FWDIR/Headers/
cp -L assets/$SYS/Info.plist $FWDIR/Info.plist
MIN_SDK_VERSION=$(get_min_sdk "$FWDIR/$FWNAME")
@ -252,5 +259,23 @@ for SYS in ${ALL_SYSTEMS[@]}; do
ln -s "Versions/Current/openssl"
ln -s "Versions/Current/Headers"
ln -s "Versions/Current/Resources"
cd ../../..
fi
done
build_xcframework() {
local FRAMEWORKS=($FWROOT/*/$FWNAME.framework)
local ARGS=
for ARG in ${FRAMEWORKS[@]}; do
ARGS+="-framework ${ARG} "
done
echo
xcodebuild -create-xcframework $ARGS -output "$FWROOT/$FWNAME.xcframework"
# These intermediate frameworks are silly, and not needed any more.
#find ${FWROOT} -mindepth 1 -maxdepth 1 -type d -not -name "$FWNAME.xcframework" -exec rm -rf '{}' \;
}
build_xcframework