mirror of
https://github.com/passepartoutvpn/openssl-apple.git
synced 2025-02-17 05:12:20 +00:00
Produce XCFramework from per-platform frameworks
1. Produce one framework per platform 2. Merge archs (lipo) into same platform framework 3. Assemble fat frameworks into XCFramework For more information: - https://github.com/balthisar/openssl-xcframeworks - https://developer.apple.com/forums/thread/666335
This commit is contained in:
parent
3f826877c1
commit
0c61811aed
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@
|
|||||||
bin
|
bin
|
||||||
src
|
src
|
||||||
lib
|
lib
|
||||||
|
frameworks
|
||||||
include/openssl
|
include/openssl
|
||||||
*.gz
|
*.gz
|
||||||
*.framework
|
*.framework
|
||||||
|
1
assets/AppleTVOS
Symbolic link
1
assets/AppleTVOS
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
AppleTV
|
1
assets/AppleTVSimulator
Symbolic link
1
assets/AppleTVSimulator
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
AppleTV
|
1
assets/WatchOS
Symbolic link
1
assets/WatchOS
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
Watch
|
1
assets/WatchSimulator
Symbolic link
1
assets/WatchSimulator
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
Watch
|
1
assets/iPhoneOS
Symbolic link
1
assets/iPhoneOS
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
iPhone
|
1
assets/iPhoneSimulator
Symbolic link
1
assets/iPhoneSimulator
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
iPhone
|
@ -21,7 +21,8 @@ if [ -d $FWROOT ]; then
|
|||||||
rm -rf $FWROOT
|
rm -rf $FWROOT
|
||||||
fi
|
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() {
|
function check_bitcode() {
|
||||||
local FWDIR=$1
|
local FWDIR=$1
|
||||||
@ -212,11 +213,17 @@ else
|
|||||||
for SYS in ${ALL_SYSTEMS[@]}; do
|
for SYS in ${ALL_SYSTEMS[@]}; do
|
||||||
SYSDIR="$FWROOT/$SYS"
|
SYSDIR="$FWROOT/$SYS"
|
||||||
FWDIR="$SYSDIR/$FWNAME.framework"
|
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"
|
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
|
mkdir -p $FWDIR/Headers
|
||||||
libtool -static -o $FWDIR/$FWNAME lib/libcrypto-$SYS.a lib/libssl-$SYS.a
|
|
||||||
cp -r include/$FWNAME/* $FWDIR/Headers/
|
cp -r include/$FWNAME/* $FWDIR/Headers/
|
||||||
cp -L assets/$SYS/Info.plist $FWDIR/Info.plist
|
cp -L assets/$SYS/Info.plist $FWDIR/Info.plist
|
||||||
MIN_SDK_VERSION=$(get_min_sdk "$FWDIR/$FWNAME")
|
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/openssl"
|
||||||
ln -s "Versions/Current/Headers"
|
ln -s "Versions/Current/Headers"
|
||||||
ln -s "Versions/Current/Resources"
|
ln -s "Versions/Current/Resources"
|
||||||
|
|
||||||
|
cd ../../..
|
||||||
fi
|
fi
|
||||||
done
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user