Create dynamic framework from arch dylibs
This commit is contained in:
parent
10019638e8
commit
e62bdf0984
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
FWNAME=openssl
|
FWNAME=openssl
|
||||||
|
|
||||||
|
@ -12,15 +12,57 @@ if [ -d $FWNAME.framework ]; then
|
||||||
rm -rf $FWNAME.framework
|
rm -rf $FWNAME.framework
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "dynamic" ]; then
|
|
||||||
LIBTOOL_FLAGS="-dynamic -undefined dynamic_lookup -ios_version_min 8.0"
|
|
||||||
else
|
|
||||||
LIBTOOL_FLAGS="-static"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Creating $FWNAME.framework"
|
echo "Creating $FWNAME.framework"
|
||||||
mkdir -p $FWNAME.framework/Headers
|
mkdir -p $FWNAME.framework/Headers
|
||||||
libtool -no_warning_for_no_symbols $LIBTOOL_FLAGS -o $FWNAME.framework/$FWNAME lib/libcrypto.a lib/libssl.a
|
|
||||||
|
if [ "$1" == "dynamic" ]; then
|
||||||
|
DEVELOPER=`xcode-select -print-path`
|
||||||
|
FW_EXEC_NAME="${FWNAME}.framework/${FWNAME}"
|
||||||
|
INSTALL_NAME="@rpath/${FW_EXEC_NAME}"
|
||||||
|
COMPAT_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'
|
||||||
|
|
||||||
|
cd bin
|
||||||
|
for TARGETDIR in `ls -d *.sdk`; do
|
||||||
|
if [[ $TARGETDIR =~ $RX ]]; then
|
||||||
|
PLATFORM="${BASH_REMATCH[1]}"
|
||||||
|
SDKVERSION="${BASH_REMATCH[2]}"
|
||||||
|
ARCH="${BASH_REMATCH[4]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Assembling .dylib for $ARCH"
|
||||||
|
|
||||||
|
CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
|
||||||
|
CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk"
|
||||||
|
SDK="${CROSS_TOP}/SDKs/${CROSS_SDK}"
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
TARGETOBJ="${TARGETDIR}/obj"
|
||||||
|
rm -rf $TARGETOBJ
|
||||||
|
mkdir $TARGETOBJ
|
||||||
|
cd $TARGETOBJ
|
||||||
|
ar -x ../lib/libcrypto.a
|
||||||
|
ar -x ../lib/libssl.a
|
||||||
|
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
|
||||||
|
install_name_tool -id $INSTALL_NAME $FWNAME.dylib
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
done
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
lipo -create bin/*/$FWNAME.dylib -output $FWNAME.framework/$FWNAME
|
||||||
|
rm bin/*/$FWNAME.dylib
|
||||||
|
else
|
||||||
|
LIBTOOL_FLAGS="-static"
|
||||||
|
libtool $LIBTOOL_FLAGS -o $FWNAME.framework/$FWNAME lib/libcrypto.a lib/libssl.a
|
||||||
|
fi
|
||||||
|
|
||||||
cp -r include/$FWNAME/* $FWNAME.framework/Headers/
|
cp -r include/$FWNAME/* $FWNAME.framework/Headers/
|
||||||
|
|
||||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
|
Loading…
Reference in New Issue