Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop get_target_sdk nonsense #56

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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