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

Add mergeable libraries support to dynamic libraries #4381

Merged
merged 5 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Added breadcrumb.origin private field (#4358)
- Custom redact modifier for SwiftUI (#4362)
- Add mergeable libraries support to dynamic libraries (#4381)

### Improvements

Expand Down
40 changes: 37 additions & 3 deletions scripts/build-xcframework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,38 @@ generate_xcframework() {

local resolved_configuration="Release$configuration_suffix"
local resolved_product_name="$scheme$configuration_suffix"

local OTHER_LDFLAGS="-Wl,-make_mergeable"

if [ "$MACH_O_TYPE" = "staticlib" ]; then
#For static framework we disabled symbols because they are not distributed in the framework causing warnings.
GCC_GENERATE_DEBUGGING_SYMBOLS="NO"
OTHER_LDFLAGS="" # Disable mergeable libraries for static libs
fi

rm -rf Carthage/DerivedData

for sdk in "${sdks[@]}"; do
if grep -q "${sdk}" <<< "$ALL_SDKS"; then

xcodebuild archive -project Sentry.xcodeproj/ -scheme "$scheme" -configuration "$resolved_configuration" -sdk "$sdk" -archivePath "./Carthage/archive/${scheme}${suffix}/${sdk}.xcarchive" CODE_SIGNING_REQUIRED=NO SKIP_INSTALL=NO CODE_SIGN_IDENTITY= CARTHAGE=YES MACH_O_TYPE="$MACH_O_TYPE" ENABLE_CODE_COVERAGE=NO GCC_GENERATE_DEBUGGING_SYMBOLS="$GCC_GENERATE_DEBUGGING_SYMBOLS"
## watchos and watchsimulator dont support make_mergeable: ld: unknown option: -make_mergeable
if [[ "$sdk" == "watchos" || "$sdk" == "watchsimulator" ]]; then
OTHER_LDFLAGS=""
fi

xcodebuild archive \
-project Sentry.xcodeproj/ \
-scheme "$scheme" \
-configuration "$resolved_configuration" \
-sdk "$sdk" \
-archivePath "./Carthage/archive/${scheme}${suffix}/${sdk}.xcarchive" \
CODE_SIGNING_REQUIRED=NO \
SKIP_INSTALL=NO \
CODE_SIGN_IDENTITY= \
CARTHAGE=YES \
MACH_O_TYPE="$MACH_O_TYPE" \
ENABLE_CODE_COVERAGE=NO \
GCC_GENERATE_DEBUGGING_SYMBOLS="$GCC_GENERATE_DEBUGGING_SYMBOLS" \
OTHER_LDFLAGS="$OTHER_LDFLAGS"

createxcframework+="-framework Carthage/archive/${scheme}${suffix}/${sdk}.xcarchive/Products/Library/Frameworks/${resolved_product_name}.framework "

Expand All @@ -56,7 +76,21 @@ generate_xcframework() {
done

#Create framework for mac catalyst
xcodebuild -project Sentry.xcodeproj/ -scheme "$scheme" -configuration "$resolved_configuration" -sdk iphoneos -destination 'platform=macOS,variant=Mac Catalyst' -derivedDataPath ./Carthage/DerivedData CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES MACH_O_TYPE="$MACH_O_TYPE" SUPPORTS_MACCATALYST=YES ENABLE_CODE_COVERAGE=NO GCC_GENERATE_DEBUGGING_SYMBOLS="$GCC_GENERATE_DEBUGGING_SYMBOLS"
xcodebuild \
-project Sentry.xcodeproj/ \
-scheme "$scheme" \
-configuration "$resolved_configuration" \
-sdk iphoneos \
-destination 'platform=macOS,variant=Mac Catalyst' \
-derivedDataPath ./Carthage/DerivedData \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_IDENTITY= \
CARTHAGE=YES \
MACH_O_TYPE="$MACH_O_TYPE" \
SUPPORTS_MACCATALYST=YES \
ENABLE_CODE_COVERAGE=NO \
GCC_GENERATE_DEBUGGING_SYMBOLS="$GCC_GENERATE_DEBUGGING_SYMBOLS" \
OTHER_LDFLAGS="$OTHER_LDFLAGS"

if [ "$MACH_O_TYPE" = "staticlib" ]; then
local infoPlist="Carthage/DerivedData/Build/Products/$resolved_configuration-maccatalyst/${scheme}.framework/Resources/Info.plist"
Expand Down