Skip to content

Commit

Permalink
Drop get_target_sdk nonsense (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
keeshux authored Dec 12, 2023
1 parent c155625 commit dbbc044
Showing 1 changed file with 8 additions and 29 deletions.
37 changes: 8 additions & 29 deletions create-openssl-framework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,6 @@ function get_min_sdk() {
set -o pipefail
}

function get_target_sdk() {
local file=$1
set +o pipefail
otool -l "$file" | awk "
/^Load command/ {
last_command = \"\"
}
\$1 == \"cmd\" {
last_command = \$2
}
((last_command ~ /LC_BUILD_VERSION/ && \$1 == \"sdk\") ||
(last_command ~ /^LC_VERSION_MIN_/ && \$1 == \"sdk\")) &&
(\$2 ~ /^[1-9]/) {
print \$2
exit
}
"
set -o pipefail
}

# Read OpenSSL version from opensslv.h file.
#
# In modern OpenSSL releases the version line looks like this:
Expand Down Expand Up @@ -131,22 +110,22 @@ for TARGETDIR in `ls -d *.sdk`; do
MIN_SDK_VERSION=$(get_min_sdk "${TARGETDIR}/lib/libcrypto.a")
TARGET_SDK_VERSION=$(get_target_sdk "${TARGETDIR}/lib/libcrypto.a")
if [[ $PLATFORM == AppleTVSimulator* ]]; then
MIN_SDK="-platform_version tvos-simulator $MIN_SDK_VERSION $TARGET_SDK_VERSION"
MIN_SDK="-platform_version tvos-simulator $MIN_SDK_VERSION $SDKVERSION"
elif [[ $PLATFORM == AppleTV* ]]; then
MIN_SDK="-platform_version tvos $MIN_SDK_VERSION $TARGET_SDK_VERSION"
MIN_SDK="-platform_version tvos $MIN_SDK_VERSION $SDKVERSION"
elif [[ $PLATFORM == MacOSX* ]]; then
MIN_SDK="-platform_version macos $MIN_SDK_VERSION $TARGET_SDK_VERSION"
MIN_SDK="-platform_version macos $MIN_SDK_VERSION $SDKVERSION"
elif [[ $PLATFORM == Catalyst* ]]; then
MIN_SDK="-platform_version mac-catalyst $MIN_SDK_VERSION $TARGET_SDK_VERSION"
MIN_SDK="-platform_version mac-catalyst $MIN_SDK_VERSION $SDKVERSION"
PLATFORM="MacOSX"
elif [[ $PLATFORM == iPhoneSimulator* ]]; then
MIN_SDK="-platform_version ios-simulator $MIN_SDK_VERSION $TARGET_SDK_VERSION"
MIN_SDK="-platform_version ios-simulator $MIN_SDK_VERSION $SDKVERSION"
elif [[ $PLATFORM == WatchOS* ]]; then
MIN_SDK="-platform_version watchos $MIN_SDK_VERSION $TARGET_SDK_VERSION"
MIN_SDK="-platform_version watchos $MIN_SDK_VERSION $SDKVERSION"
elif [[ $PLATFORM == WatchSimulator* ]]; then
MIN_SDK="-platform_version watchos-simulator $MIN_SDK_VERSION $TARGET_SDK_VERSION"
MIN_SDK="-platform_version watchos-simulator $MIN_SDK_VERSION $SDKVERSION"
else
MIN_SDK="-platform_version ios $MIN_SDK_VERSION $TARGET_SDK_VERSION"
MIN_SDK="-platform_version ios $MIN_SDK_VERSION $SDKVERSION"
fi

CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
Expand Down

0 comments on commit dbbc044

Please sign in to comment.