Skip to content

Commit

Permalink
Catalyst fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonacox committed Jul 18, 2023
1 parent 1c5699c commit 1c64481
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
6 changes: 2 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -408,13 +408,11 @@ lipo -create -output $ARCHIVE/bin/openssl /tmp/openssl-x86_64 /tmp/openssl-arm64
mv /tmp/openssl-* $ARCHIVE/bin
echo
echo -e "${bold}Testing Universal Mac binaries for ${BUILD_MACHINE}...${dim}"
echo -e " ${bold}cURL${normal}"
echo -e " ${bold}cURL${dim}"
file $ARCHIVE/bin/curl
echo -e "${dim}"
$ARCHIVE/bin/curl -V
echo -e " ${bold}OpenSSL${normal}"
echo -e " ${bold}OpenSSL${dim}"
file $ARCHIVE/bin/openssl
echo -e "${dim}"
$ARCHIVE/bin/openssl version

## Done - Display Build Duration
Expand Down
17 changes: 12 additions & 5 deletions openssl/openssl-build-phase1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ buildCatalyst()
{
ARCH=$1

# disabe bitcode for openssl 3
if [[ "$OPENSSL_VERSION" = "openssl-3.0"* ]]; then
CC_BITCODE_FLAG=""
else
CC_BITCODE_FLAG="-fembed-bitcode"
fi

pushd . > /dev/null
cd "${OPENSSL_VERSION}"

Expand All @@ -215,7 +222,7 @@ buildCatalyst()
export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
export CROSS_SDK="${PLATFORM}.sdk"
export BUILD_TOOLS="${DEVELOPER}"
export CC="${BUILD_TOOLS}/usr/bin/gcc -fembed-bitcode -arch ${ARCH} -target ${ARCH}-apple-ios${CATALYST_IOS}-macabi"
export CC="${BUILD_TOOLS}/usr/bin/gcc ${CC_BITCODE_FLAG} -arch ${ARCH} -target ${ARCH}-apple-ios${CATALYST_IOS}-macabi"

if [[ $ARCH == "x86_64" ]]; then
TARGET="darwin64-x86_64-cc"
Expand All @@ -224,12 +231,12 @@ buildCatalyst()
# Apple ARM Silicon Build Machine Detected - cross compile
export CC="clang"
export CXX="clang"
export CFLAGS=" -Os -mmacosx-version-min=${MACOS_X86_64_VERSION} -arch ${ARCH} -fembed-bitcode -target ${ARCH}-apple-ios${CATALYST_IOS}-macabi "
export CFLAGS=" -Os -mmacosx-version-min=${MACOS_X86_64_VERSION} -arch ${ARCH} ${CC_BITCODE_FLAG} -target ${ARCH}-apple-ios${CATALYST_IOS}-macabi "
export LDFLAGS=" -arch ${ARCH} -isysroot ${DEVELOPER}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk "
export CPPFLAGS=" -I.. -isysroot ${DEVELOPER}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk "
else
# Apple x86_64 Build Machine Detected - native build
export CFLAGS=" -Os -mmacosx-version-min=${MACOS_X86_64_VERSION} -arch ${ARCH} -fembed-bitcode -target ${ARCH}-apple-ios${CATALYST_IOS}-macabi "
export CFLAGS=" -Os -mmacosx-version-min=${MACOS_X86_64_VERSION} -arch ${ARCH} ${CC_BITCODE_FLAG} -target ${ARCH}-apple-ios${CATALYST_IOS}-macabi "
fi
fi
if [[ $ARCH == "arm64" ]]; then
Expand All @@ -238,10 +245,10 @@ buildCatalyst()
if [ ${BUILD_MACHINE} == 'arm64' ]; then
# Apple ARM Silicon Build Machine Detected - native build
export CC="${BUILD_TOOLS}/usr/bin/gcc"
export CFLAGS=" -Os -mmacosx-version-min=${MACOS_ARM64_VERSION} -arch ${ARCH} -fembed-bitcode -target ${ARCH}-apple-ios${CATALYST_IOS}-macabi "
export CFLAGS=" -Os -mmacosx-version-min=${MACOS_ARM64_VERSION} -arch ${ARCH} ${CC_BITCODE_FLAG} -target ${ARCH}-apple-ios${CATALYST_IOS}-macabi "
else
# Apple x86_64 Build Machine Detected - cross compile
export CFLAGS=" -Os -mmacosx-version-min=${MACOS_ARM64_VERSION} -arch ${ARCH} -fembed-bitcode -target ${ARCH}-apple-ios${CATALYST_IOS}-macabi "
export CFLAGS=" -Os -mmacosx-version-min=${MACOS_ARM64_VERSION} -arch ${ARCH} ${CC_BITCODE_FLAG} -target ${ARCH}-apple-ios${CATALYST_IOS}-macabi "
export LDFLAGS=" -arch ${ARCH} -isysroot ${DEVELOPER}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk "
export CPPFLAGS=" -I.. -isysroot ${DEVELOPER}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk "
fi
Expand Down

0 comments on commit 1c64481

Please sign in to comment.