From c821d29d24e50871885345f9c558026d3b907d09 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 16 Jan 2024 10:14:33 -0800 Subject: [PATCH] Don't export c++ symbols when installing via CocoaPods This brings the CocoaPods build in alignment with the prebuilt framework. --- CHANGELOG.md | 5 +++++ Realm.podspec | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7f7bd7391..6dca6ef481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ x.y.z Release notes (yyyy-MM-dd) ============================================================= ### Enhancements * Add a privacy manifest to both frameworks. +* Internal C++ symbols are no longer exported from Realm.framework when + installing via CocoaPods, which reduces the size of the binary by ~5%, + improves app startup time a little, and eliminates some warnings when linking + the framework. This was already the case when using Carthage or a prebuilt + framework ([PR #8464](https://github.com/realm/realm-swift/pull/8464)). ### Fixed * `@Persisted`'s Encodable implementation did not allow the encoder to diff --git a/Realm.podspec b/Realm.podspec index fc0810c0e7..7e9035e8ff 100644 --- a/Realm.podspec +++ b/Realm.podspec @@ -144,9 +144,9 @@ Pod::Spec.new do |s| 'REALM_LD_CLASSIC_1400' => '', 'REALM_LD_CLASSIC_1500' => '-Wl,-ld_classic', 'REALM_LD_CLASSIC' => '$(REALM_LD_CLASSIC_$(XCODE_VERSION_MAJOR))', - 'OTHER_LDFLAGS' => '$(REALM_LD_CLASSIC)', + 'OTHER_LDFLAGS' => '$(REALM_LD_CLASSIC) "-Wl,-unexported_symbols_list,${PODS_ROOT}/Realm/Configuration/Realm/PrivateSymbols.txt"', } - s.preserve_paths = %w(include scripts) + s.preserve_paths = %w(include scripts Configuration/Realm/PrivateSymbols.txt) s.resource_bundles = {'realm_objc_privacy' => ['Realm/PrivacyInfo.xcprivacy']} s.ios.deployment_target = '11.0'