Create frameworks for both iPhone and AppleTV
This commit is contained in:
parent
dd9a625aa5
commit
10b342fb7e
|
@ -0,0 +1 @@
|
||||||
|
../../OpenSSL-for-tvOS/Info.plist
|
|
@ -0,0 +1 @@
|
||||||
|
../../OpenSSL-for-iOS/Info.plist
|
|
@ -473,15 +473,15 @@ fi
|
||||||
# Build iOS library if selected for build
|
# Build iOS library if selected for build
|
||||||
if [ ${#LIBSSL_IOS[@]} -gt 0 ]; then
|
if [ ${#LIBSSL_IOS[@]} -gt 0 ]; then
|
||||||
echo "Build library for iOS..."
|
echo "Build library for iOS..."
|
||||||
lipo -create ${LIBSSL_IOS[@]} -output "${CURRENTPATH}/lib/libssl.a"
|
lipo -create ${LIBSSL_IOS[@]} -output "${CURRENTPATH}/lib/libssl-iPhone.a"
|
||||||
lipo -create ${LIBCRYPTO_IOS[@]} -output "${CURRENTPATH}/lib/libcrypto.a"
|
lipo -create ${LIBCRYPTO_IOS[@]} -output "${CURRENTPATH}/lib/libcrypto-iPhone.a"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build tvOS library if selected for build
|
# Build tvOS library if selected for build
|
||||||
if [ ${#LIBSSL_TVOS[@]} -gt 0 ]; then
|
if [ ${#LIBSSL_TVOS[@]} -gt 0 ]; then
|
||||||
echo "Build library for tvOS..."
|
echo "Build library for tvOS..."
|
||||||
lipo -create ${LIBSSL_TVOS[@]} -output "${CURRENTPATH}/lib/libssl-tvOS.a"
|
lipo -create ${LIBSSL_TVOS[@]} -output "${CURRENTPATH}/lib/libssl-AppleTV.a"
|
||||||
lipo -create ${LIBCRYPTO_TVOS[@]} -output "${CURRENTPATH}/lib/libcrypto-tvOS.a"
|
lipo -create ${LIBCRYPTO_TVOS[@]} -output "${CURRENTPATH}/lib/libcrypto-AppleTV.a"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy include directory
|
# Copy include directory
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
FWNAME=openssl
|
FWNAME=openssl
|
||||||
|
FWDIR=frameworks
|
||||||
|
|
||||||
if [ ! -d lib ]; then
|
if [ ! -d lib ]; then
|
||||||
echo "Please run build-libssl.sh first!"
|
echo "Please run build-libssl.sh first!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d $FWNAME.framework ]; then
|
if [ -d $FWDIR ]; then
|
||||||
echo "Removing previous $FWNAME.framework copy"
|
echo "Removing previous $FWNAME.framework copies"
|
||||||
rm -rf $FWNAME.framework
|
rm -rf $FWDIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Creating $FWNAME.framework"
|
ALL_SYSTEMS=("iPhone" "AppleTV")
|
||||||
mkdir -p $FWNAME.framework/Headers
|
|
||||||
|
|
||||||
if [ "$1" == "dynamic" ]; then
|
if [ "$1" == "dynamic" ]; then
|
||||||
DEVELOPER=`xcode-select -print-path`
|
DEVELOPER=`xcode-select -print-path`
|
||||||
|
@ -22,7 +22,6 @@ if [ "$1" == "dynamic" ]; then
|
||||||
COMPAT_VERSION="1.0.0"
|
COMPAT_VERSION="1.0.0"
|
||||||
CURRENT_VERSION="1.0.0"
|
CURRENT_VERSION="1.0.0"
|
||||||
|
|
||||||
LIBTOOL_FLAGS="-dynamic -lSystem -ios_version_min 8.0"
|
|
||||||
RX='([A-z]+)([0-9]+(\.[0-9]+)*)-([A-z0-9]+)\.sdk'
|
RX='([A-z]+)([0-9]+(\.[0-9]+)*)-([A-z0-9]+)\.sdk'
|
||||||
|
|
||||||
cd bin
|
cd bin
|
||||||
|
@ -39,8 +38,14 @@ if [ "$1" == "dynamic" ]; then
|
||||||
CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk"
|
CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk"
|
||||||
SDK="${CROSS_TOP}/SDKs/${CROSS_SDK}"
|
SDK="${CROSS_TOP}/SDKs/${CROSS_SDK}"
|
||||||
|
|
||||||
|
if [[ $PLATFORM == AppleTV* ]]; then
|
||||||
|
MIN_SDK="-tvos_version_min 9.0"
|
||||||
|
else
|
||||||
|
MIN_SDK="-ios_version_min 8.0"
|
||||||
|
fi
|
||||||
|
|
||||||
#cd $TARGETDIR
|
#cd $TARGETDIR
|
||||||
#libtool $LIBTOOL_FLAGS -L"$SDK/usr/lib/" -install_name $INSTALL_NAME -compatibility_version $COMPAT_VERSION -current_version $CURRENT_VERSION lib/*.a -o $FWNAME.dylib
|
#libtool -dynamic -lSystem $MIN_SDK -L"$SDK/usr/lib/" -install_name $INSTALL_NAME -compatibility_version $COMPAT_VERSION -current_version $CURRENT_VERSION lib/*.a -o $FWNAME.dylib
|
||||||
|
|
||||||
TARGETOBJ="${TARGETDIR}/obj"
|
TARGETOBJ="${TARGETDIR}/obj"
|
||||||
rm -rf $TARGETOBJ
|
rm -rf $TARGETOBJ
|
||||||
|
@ -49,27 +54,43 @@ if [ "$1" == "dynamic" ]; then
|
||||||
ar -x ../lib/libcrypto.a
|
ar -x ../lib/libcrypto.a
|
||||||
ar -x ../lib/libssl.a
|
ar -x ../lib/libssl.a
|
||||||
cd ..
|
cd ..
|
||||||
ld obj/*.o -dylib -lSystem -ios_version_min 8.0 -L"$SDK/usr/lib/" -compatibility_version $COMPAT_VERSION -current_version $CURRENT_VERSION -application_extension -o $FWNAME.dylib
|
ld obj/*.o -dylib -lSystem $MIN_SDK -L"$SDK/usr/lib/" -compatibility_version $COMPAT_VERSION -current_version $CURRENT_VERSION -application_extension -o $FWNAME.dylib
|
||||||
install_name_tool -id $INSTALL_NAME $FWNAME.dylib
|
install_name_tool -id $INSTALL_NAME $FWNAME.dylib
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
lipo -create bin/*/$FWNAME.dylib -output $FWNAME.framework/$FWNAME
|
for SYS in ${ALL_SYSTEMS[@]}; do
|
||||||
|
SYSDIR=$FWDIR/$SYS
|
||||||
|
|
||||||
|
# FIXME: skip if no device objects
|
||||||
|
|
||||||
|
echo "Creating framework for $SYS"
|
||||||
|
mkdir -p $SYSDIR/$FWNAME.framework/Headers
|
||||||
|
lipo -create bin/${SYS}*/$FWNAME.dylib -output $SYSDIR/$FWNAME.framework/$FWNAME
|
||||||
|
cp -r include/$FWNAME/* $SYSDIR/$FWNAME.framework/Headers/
|
||||||
|
cp -L assets/$SYS/Info.plist $SYSDIR/$FWNAME.framework/Info.plist
|
||||||
|
echo "Created $SYSDIR/$FWNAME.framework"
|
||||||
|
done
|
||||||
|
|
||||||
rm bin/*/$FWNAME.dylib
|
rm bin/*/$FWNAME.dylib
|
||||||
else
|
else
|
||||||
LIBTOOL_FLAGS="-static"
|
for SYS in ${ALL_SYSTEMS[@]}; do
|
||||||
libtool $LIBTOOL_FLAGS -o $FWNAME.framework/$FWNAME lib/libcrypto.a lib/libssl.a
|
SYSDIR=$FWDIR/$SYS
|
||||||
|
|
||||||
|
# FIXME: skip if no device objects
|
||||||
|
|
||||||
|
echo "Creating framework for $SYS"
|
||||||
|
mkdir -p $SYSDIR/$FWNAME.framework/Headers
|
||||||
|
libtool -static -o $SYSDIR/$FWNAME.framework/$FWNAME lib/libcrypto-$SYS.a lib/libssl-$SYS.a
|
||||||
|
cp -r include/$FWNAME/* $SYSDIR/$FWNAME.framework/Headers/
|
||||||
|
cp -L assets/$SYS/Info.plist $SYSDIR/$FWNAME.framework/Info.plist
|
||||||
|
echo "Created $SYSDIR/$FWNAME.framework"
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp -r include/$FWNAME/* $FWNAME.framework/Headers/
|
check_bitcode=`otool -arch arm64 -l $FWDIR/iPhone/$FWNAME.framework/$FWNAME | grep __bitcode`
|
||||||
|
|
||||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
||||||
cp $DIR/"OpenSSL-for-iOS/OpenSSL-for-iOS-Info.plist" $FWNAME.framework/Info.plist
|
|
||||||
echo "Created $FWNAME.framework"
|
|
||||||
|
|
||||||
check_bitcode=`otool -arch arm64 -l $FWNAME.framework/$FWNAME | grep __bitcode`
|
|
||||||
if [ -z "$check_bitcode" ]
|
if [ -z "$check_bitcode" ]
|
||||||
then
|
then
|
||||||
echo "INFO: $FWNAME.framework doesn't contain Bitcode"
|
echo "INFO: $FWNAME.framework doesn't contain Bitcode"
|
||||||
|
|
Loading…
Reference in New Issue