|
@@ -20,7 +20,6 @@
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
|
|
|
|
|
-
|
|
|
set -euo pipefail
|
|
|
|
|
|
WOLFSSL_DIR=$(pwd)/../../
|
|
@@ -28,12 +27,9 @@ OUTDIR=$(pwd)/artifacts
|
|
|
LIPODIR=${OUTDIR}/lib
|
|
|
SDK_OUTPUT_DIR=${OUTDIR}/xcframework
|
|
|
|
|
|
-
|
|
|
CFLAGS_COMMON=""
|
|
|
-# Optional configure flags passed in by user through -c argument
|
|
|
-CONF_OPTS_EXTRA=""
|
|
|
# Base configure flags
|
|
|
-CONF_OPTS_COMMON="--disable-shared --enable-static"
|
|
|
+CONF_OPTS="--disable-shared --enable-static"
|
|
|
|
|
|
helpFunction()
|
|
|
{
|
|
@@ -47,7 +43,7 @@ helpFunction()
|
|
|
while getopts ":c:" opt; do
|
|
|
case $opt in
|
|
|
c)
|
|
|
- CONF_OPTS_EXTRA="$OPTARG"
|
|
|
+ CONF_OPTS+=" $OPTARG"
|
|
|
;;
|
|
|
\?)
|
|
|
echo "Invalid option: -$OPTARG" >&2; helpFunction
|
|
@@ -55,279 +51,60 @@ while getopts ":c:" opt; do
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
-# Amalgamate extra CLI options with base options
|
|
|
-CONF_OPTS="${CONF_OPTS_COMMON} ${CONF_OPTS_EXTRA}"
|
|
|
-
|
|
|
rm -rf $OUTDIR
|
|
|
mkdir -p $LIPODIR
|
|
|
mkdir -p $SDK_OUTPUT_DIR
|
|
|
|
|
|
-
|
|
|
-buildIOSSim()
|
|
|
-{
|
|
|
- set -x
|
|
|
- pushd .
|
|
|
- cd $WOLFSSL_DIR
|
|
|
-
|
|
|
- ARCH=$1
|
|
|
- HOST="${ARCH}-apple-darwin"
|
|
|
- SDK_ROOT=$(xcrun --sdk iphonesimulator --show-sdk-path)
|
|
|
-
|
|
|
- ./configure -prefix=${OUTDIR}/wolfssl-ios-simulator-${ARCH} ${CONF_OPTS} --host=${HOST} \
|
|
|
- CFLAGS="${CFLAGS_COMMON} -arch ${ARCH} -isysroot ${SDK_ROOT}"
|
|
|
- make -j
|
|
|
- make install
|
|
|
-
|
|
|
- popd
|
|
|
- set +x
|
|
|
-}
|
|
|
-
|
|
|
-buildIOS()
|
|
|
-{
|
|
|
+build() { # <ARCH=arm64|x86_64> <TYPE=iphonesimulator|iphoneos|macosx|watchos|watchsimulator|appletvos|appletvsimulator>
|
|
|
set -x
|
|
|
pushd .
|
|
|
cd $WOLFSSL_DIR
|
|
|
|
|
|
- ARCH=$1
|
|
|
+ ARCH=$1
|
|
|
HOST="${ARCH}-apple-darwin"
|
|
|
- SDK_ROOT=$(xcrun --sdk iphoneos --show-sdk-path)
|
|
|
+ TYPE=$2
|
|
|
+ SDK_ROOT=$(xcrun --sdk ${TYPE} --show-sdk-path)
|
|
|
|
|
|
- ./configure -prefix=${OUTDIR}/wolfssl-ios-${ARCH} ${CONF_OPTS} --host=${HOST} \
|
|
|
+ ./configure -prefix=${OUTDIR}/wolfssl-${TYPE}-${ARCH} ${CONF_OPTS} --host=${HOST} \
|
|
|
CFLAGS="${CFLAGS_COMMON} -arch ${ARCH} -isysroot ${SDK_ROOT}"
|
|
|
- make -j
|
|
|
+ make -j src/libwolfssl.la
|
|
|
make install
|
|
|
|
|
|
popd
|
|
|
set +x
|
|
|
}
|
|
|
|
|
|
-buildMacOS()
|
|
|
-{
|
|
|
- set -x
|
|
|
- pushd .
|
|
|
- cd $WOLFSSL_DIR
|
|
|
+XCFRAMEWORKS=
|
|
|
+for type in iphonesimulator macosx appletvsimulator watchsimulator ; do
|
|
|
+ build arm64 ${type}
|
|
|
+ build x86_64 ${type}
|
|
|
|
|
|
- ARCH=$1
|
|
|
- HOST="${ARCH}-apple-darwin"
|
|
|
- SDK_ROOT=$(xcrun --sdk macosx --show-sdk-path)
|
|
|
+ # Create universal binaries from architecture-specific static libraries
|
|
|
+ lipo \
|
|
|
+ "$OUTDIR/wolfssl-${type}-x86_64/lib/libwolfssl.a" \
|
|
|
+ "$OUTDIR/wolfssl-${type}-arm64/lib/libwolfssl.a" \
|
|
|
+ -create -output $LIPODIR/libwolfssl-${type}.a
|
|
|
|
|
|
- ./configure -prefix=${OUTDIR}/wolfssl-macos-${ARCH} ${CONF_OPTS} --host=${HOST} \
|
|
|
- CFLAGS="${CFLAGS_COMMON} -arch ${ARCH} -isysroot ${SDK_ROOT}"
|
|
|
- make -j
|
|
|
- make install
|
|
|
-
|
|
|
- popd
|
|
|
- set +x
|
|
|
-}
|
|
|
-
|
|
|
-buildWatchOS()
|
|
|
-{
|
|
|
- set -x
|
|
|
- pushd .
|
|
|
- cd $WOLFSSL_DIR
|
|
|
-
|
|
|
- ARCH=$1
|
|
|
- HOST="${ARCH}-apple-darwin"
|
|
|
- SDK_ROOT=$(xcrun --sdk watchos --show-sdk-path)
|
|
|
-
|
|
|
- ./configure -prefix=${OUTDIR}/wolfssl-watchos-${ARCH} ${CONF_OPTS} --host=${HOST} \
|
|
|
- CFLAGS="${CFLAGS_COMMON} -arch ${ARCH} -isysroot ${SDK_ROOT}"
|
|
|
- make -j
|
|
|
- make install
|
|
|
-
|
|
|
- popd
|
|
|
- set +x
|
|
|
-}
|
|
|
-
|
|
|
-buildWatchOSSim()
|
|
|
-{
|
|
|
- set -x
|
|
|
- pushd .
|
|
|
- cd $WOLFSSL_DIR
|
|
|
-
|
|
|
- ARCH=$1
|
|
|
- HOST="${ARCH}-apple-darwin"
|
|
|
- SDK_ROOT=$(xcrun --sdk watchsimulator --show-sdk-path)
|
|
|
-
|
|
|
- ./configure -prefix=${OUTDIR}/wolfssl-watchos-simulator-${ARCH} ${CONF_OPTS} --host=${HOST} \
|
|
|
- CFLAGS="${CFLAGS_COMMON} -arch ${ARCH} -isysroot ${SDK_ROOT}"
|
|
|
- make -j
|
|
|
- make install
|
|
|
-
|
|
|
- popd
|
|
|
- set +x
|
|
|
-}
|
|
|
-
|
|
|
-buildTVOS()
|
|
|
-{
|
|
|
- set -x
|
|
|
- pushd .
|
|
|
- cd $WOLFSSL_DIR
|
|
|
-
|
|
|
- ARCH=arm64
|
|
|
- HOST="${ARCH}-apple-darwin"
|
|
|
- SDK_ROOT=$(xcrun --sdk appletvos --show-sdk-path)
|
|
|
-
|
|
|
- ./configure -prefix=${OUTDIR}/wolfssl-tvos-${ARCH} ${CONF_OPTS} --host=${HOST} \
|
|
|
- CFLAGS="${CFLAGS_COMMON} -arch ${ARCH} -isysroot ${SDK_ROOT}"
|
|
|
- make -j
|
|
|
- make install
|
|
|
-
|
|
|
- popd
|
|
|
- set +x
|
|
|
-}
|
|
|
-
|
|
|
-buildTVOSSim()
|
|
|
-{
|
|
|
- set -x
|
|
|
- pushd .
|
|
|
- cd $WOLFSSL_DIR
|
|
|
-
|
|
|
- ARCH=$1
|
|
|
- HOST="${ARCH}-apple-darwin"
|
|
|
- SDK_ROOT=$(xcrun --sdk appletvsimulator --show-sdk-path)
|
|
|
-
|
|
|
- ./configure -prefix=${OUTDIR}/wolfssl-tvos-simulator-${ARCH} ${CONF_OPTS} --host=${HOST} \
|
|
|
- CFLAGS="${CFLAGS_COMMON} -arch ${ARCH} -isysroot ${SDK_ROOT}"
|
|
|
- make -j
|
|
|
- make install
|
|
|
-
|
|
|
- popd
|
|
|
- set +x
|
|
|
-}
|
|
|
-
|
|
|
-buildCatalyst()
|
|
|
-{
|
|
|
- echo "TBD"
|
|
|
-}
|
|
|
-
|
|
|
-############################################################################################################################################
|
|
|
-# IOS Simulator ############################################################################################################################
|
|
|
-############################################################################################################################################
|
|
|
-buildIOSSim arm64
|
|
|
-buildIOSSim x86_64
|
|
|
-
|
|
|
-# Create universal binaries from architecture-specific static libraries
|
|
|
-lipo \
|
|
|
- "$OUTDIR/wolfssl-ios-simulator-x86_64/lib/libwolfssl.a" \
|
|
|
- "$OUTDIR/wolfssl-ios-simulator-arm64/lib/libwolfssl.a" \
|
|
|
- -create -output $LIPODIR/libwolfssl-ios-simulator.a
|
|
|
-
|
|
|
-echo "Checking libraries"
|
|
|
-xcrun -sdk iphonesimulator lipo -info $LIPODIR/libwolfssl-ios-simulator.a
|
|
|
-
|
|
|
-############################################################################################################################################
|
|
|
-# IOS ######################################################################################################################################
|
|
|
-############################################################################################################################################
|
|
|
-buildIOS arm64
|
|
|
-
|
|
|
-# Create universal binaries from architecture-specific static libraries
|
|
|
-lipo \
|
|
|
- "$OUTDIR/wolfssl-ios-arm64/lib/libwolfssl.a" \
|
|
|
- -create -output $LIPODIR/libwolfssl-ios.a
|
|
|
-
|
|
|
-echo "Checking libraries"
|
|
|
-xcrun -sdk iphoneos lipo -info $LIPODIR/libwolfssl-ios.a
|
|
|
-
|
|
|
-
|
|
|
-############################################################################################################################################
|
|
|
-# MacOS ####################################################################################################################################
|
|
|
-############################################################################################################################################
|
|
|
-buildMacOS arm64
|
|
|
-buildMacOS x86_64
|
|
|
-
|
|
|
-# Create universal binaries from architecture-specific static libraries
|
|
|
-lipo \
|
|
|
- "$OUTDIR/wolfssl-macos-x86_64/lib/libwolfssl.a" \
|
|
|
- "$OUTDIR/wolfssl-macos-arm64/lib/libwolfssl.a" \
|
|
|
- -create -output $LIPODIR/libwolfssl-macos.a
|
|
|
-
|
|
|
-echo "Checking libraries"
|
|
|
-xcrun -sdk macosx lipo -info $LIPODIR/libwolfssl-macos.a
|
|
|
-
|
|
|
-
|
|
|
-############################################################################################################################################
|
|
|
-# tvOS Simulator ###########################################################################################################################
|
|
|
-############################################################################################################################################
|
|
|
-buildTVOSSim arm64
|
|
|
-buildTVOSSim x86_64
|
|
|
-
|
|
|
-# Create universal binaries from architecture-specific static libraries
|
|
|
-lipo \
|
|
|
- "$OUTDIR/wolfssl-tvos-simulator-x86_64/lib/libwolfssl.a" \
|
|
|
- "$OUTDIR/wolfssl-tvos-simulator-arm64/lib/libwolfssl.a" \
|
|
|
- -create -output $LIPODIR/libwolfssl-tvos-simulator.a
|
|
|
-
|
|
|
-echo "Checking libraries"
|
|
|
-xcrun -sdk appletvsimulator lipo -info $LIPODIR/libwolfssl-tvos-simulator.a
|
|
|
-
|
|
|
-
|
|
|
-############################################################################################################################################
|
|
|
-# tvOS #####################################################################################################################################
|
|
|
-############################################################################################################################################
|
|
|
-buildTVOS arm64
|
|
|
-
|
|
|
-# Create universal binaries from architecture-specific static libraries
|
|
|
-lipo \
|
|
|
- "$OUTDIR/wolfssl-tvos-arm64/lib/libwolfssl.a" \
|
|
|
- -create -output $LIPODIR/libwolfssl-tvos.a
|
|
|
-
|
|
|
-echo "Checking libraries"
|
|
|
-xcrun -sdk appletvos lipo -info $LIPODIR/libwolfssl-tvos.a
|
|
|
-
|
|
|
-
|
|
|
-############################################################################################################################################
|
|
|
-# watchOS Simulator ########################################################################################################################
|
|
|
-############################################################################################################################################
|
|
|
-buildWatchOSSim arm64
|
|
|
-buildWatchOSSim x86_64
|
|
|
-
|
|
|
-# Create universal binaries from architecture-specific static libraries
|
|
|
-lipo \
|
|
|
- "$OUTDIR/wolfssl-watchos-simulator-arm64/lib/libwolfssl.a" \
|
|
|
- "$OUTDIR/wolfssl-watchos-simulator-x86_64/lib/libwolfssl.a" \
|
|
|
- -create -output $LIPODIR/libwolfssl-watchos-simulator.a
|
|
|
-
|
|
|
-echo "Checking libraries"
|
|
|
-xcrun -sdk watchsimulator lipo -info $LIPODIR/libwolfssl-watchos-simulator.a
|
|
|
-
|
|
|
-
|
|
|
-############################################################################################################################################
|
|
|
-# watchOS ##################################################################################################################################
|
|
|
-############################################################################################################################################
|
|
|
-buildWatchOS arm64
|
|
|
-
|
|
|
-# Create universal binaries from architecture-specific static libraries
|
|
|
-lipo \
|
|
|
- "$OUTDIR/wolfssl-watchos-arm64/lib/libwolfssl.a" \
|
|
|
- -create -output $LIPODIR/libwolfssl-watchos.a
|
|
|
-
|
|
|
-echo "Checking libraries"
|
|
|
-xcrun -sdk watchos lipo -info $LIPODIR/libwolfssl-watchos.a
|
|
|
+ echo "Checking libraries"
|
|
|
+ xcrun -sdk ${type} lipo -info $LIPODIR/libwolfssl-${type}.a
|
|
|
+ XCFRAMEWORKS+=" -library ${LIPODIR}/libwolfssl-${type}.a -headers ${OUTDIR}/wolfssl-${type}-arm64/include"
|
|
|
+done
|
|
|
|
|
|
+for type in iphoneos appletvos ; do
|
|
|
+ build arm64 ${type}
|
|
|
|
|
|
-############################################################################################################################################
|
|
|
-# Catalyst #################################################################################################################################
|
|
|
-############################################################################################################################################
|
|
|
+ # Create universal binaries from architecture-specific static libraries
|
|
|
+ lipo \
|
|
|
+ "$OUTDIR/wolfssl-${type}-arm64/lib/libwolfssl.a" \
|
|
|
+ -create -output $LIPODIR/libwolfssl-${type}.a
|
|
|
|
|
|
+ echo "Checking libraries"
|
|
|
+ xcrun -sdk ${type} lipo -info $LIPODIR/libwolfssl-${type}.a
|
|
|
+ XCFRAMEWORKS+=" -library ${LIPODIR}/libwolfssl-${type}.a -headers ${OUTDIR}/wolfssl-${type}-arm64/include"
|
|
|
+done
|
|
|
|
|
|
############################################################################################################################################
|
|
|
# ********** BUILD FRAMEWORK
|
|
|
############################################################################################################################################
|
|
|
|
|
|
-xcodebuild -create-xcframework \
|
|
|
- -library ${LIPODIR}/libwolfssl-ios-simulator.a \
|
|
|
- -headers ${OUTDIR}/wolfssl-ios-simulator-arm64/include \
|
|
|
- -library ${LIPODIR}/libwolfssl-ios.a \
|
|
|
- -headers ${OUTDIR}/wolfssl-ios-arm64/include \
|
|
|
- -library ${LIPODIR}/libwolfssl-macos.a \
|
|
|
- -headers ${OUTDIR}/wolfssl-macos-arm64/include \
|
|
|
- -library ${LIPODIR}/libwolfssl-tvos.a \
|
|
|
- -headers ${OUTDIR}/wolfssl-tvos-arm64/include \
|
|
|
- -library ${LIPODIR}/libwolfssl-tvos-simulator.a \
|
|
|
- -headers ${OUTDIR}/wolfssl-tvos-simulator-arm64/include \
|
|
|
- -library ${LIPODIR}/libwolfssl-watchos.a \
|
|
|
- -headers ${OUTDIR}/wolfssl-watchos-arm64/include \
|
|
|
- -library ${LIPODIR}/libwolfssl-watchos-simulator.a \
|
|
|
- -headers ${OUTDIR}/wolfssl-watchos-simulator-arm64/include \
|
|
|
- -output ${SDK_OUTPUT_DIR}/libwolfssl.xcframework
|
|
|
+xcodebuild -create-xcframework ${XCFRAMEWORKS} -output ${SDK_OUTPUT_DIR}/libwolfssl.xcframework
|