Skip to content

Commit d3bbe88

Browse files
committed
ios/tvos: try to include dSYM symbols in app store builds
1 parent 5d066f6 commit d3bbe88

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

pkg/apple/fastlane/Fastfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ private_lane :ra_build_app do |options|
165165
xcodebuild_formatter: 'xcbeautify --renderer github-actions',
166166
buildlog_path: "buildlog",
167167
export_method: "app-store",
168+
include_symbols: true,
168169
export_options: {
169170
provisioningProfiles: options[:provisioningProfiles]
170171
}

pkg/apple/make-frameworks.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ fi
2929

3030
if [ -n "$BUILT_PRODUCTS_DIR" -a -n "$FRAMEWORKS_FOLDER_PATH" ] ; then
3131
OUTDIR="$BUILT_PRODUCTS_DIR"/"$FRAMEWORKS_FOLDER_PATH"
32+
DSYM_OUTDIR="$BUILT_PRODUCTS_DIR"
3233
else
3334
OUTDIR="$BASE_DIR"/Frameworks
35+
DSYM_OUTDIR="$BASE_DIR"/Frameworks
3436
fi
3537

3638
mkdir -p "$OUTDIR"
@@ -62,6 +64,29 @@ for dylib in $(find "$BASE_DIR"/modules -maxdepth 1 -type f -regex '.*libretro.*
6264
fi
6365
echo "signing $fwName"
6466
codesign --force --verbose --sign "${CODE_SIGN_IDENTITY_FOR_ITEMS}" "$fwDir"
67+
68+
# Create framework dSYM if dylib dSYM exists
69+
if [ -d "$dylib.dSYM" ] ; then
70+
echo "Creating dSYM for framework $fwName"
71+
dSYMDir="${DSYM_OUTDIR}/${fwName}.framework.dSYM"
72+
73+
# Copy entire dSYM structure to preserve all metadata and future additions
74+
cp -R "$dylib.dSYM" "$dSYMDir"
75+
76+
# Rename DWARF binary to match framework name
77+
dylibName=$(basename "$dylib")
78+
mv "$dSYMDir/Contents/Resources/DWARF/$dylibName" "$dSYMDir/Contents/Resources/DWARF/$fwName"
79+
80+
# Update binary-path in Relocations yml files if they exist
81+
if [ -d "$dSYMDir/Contents/Resources/Relocations" ] ; then
82+
find "$dSYMDir/Contents/Resources/Relocations" -name "*.yml" -type f | while read -r ymlfile ; do
83+
sed -i '' "s/binary-path: *$dylibName/binary-path: $fwName/" "$ymlfile"
84+
done
85+
fi
86+
87+
# Update Info.plist with framework identifier
88+
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier com.apple.xcode.dsym.$fwName" "$dSYMDir/Contents/Info.plist"
89+
fi
6590
done
6691

6792
# Copy in MoltenVK as an embedded library manually instead of having

pkg/apple/update-cores.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ else
3030
DRY_RUN=
3131
fi
3232

33+
if [ "$1" = "-d" -o "$1" = "--dsym" ] ; then
34+
DOWNLOAD_DSYM=1
35+
shift
36+
else
37+
DOWNLOAD_DSYM=
38+
fi
39+
3340
URL_BASE="https://buildbot.libretro.com/nightly/apple"
3441

3542
if [ "$PLATFORM_FAMILY_NAME" = "tvOS" -o "$1" = "tvos" -o "$1" = "--tvos" ] ; then
@@ -96,10 +103,44 @@ function update_dylib() {
96103
if [ "${#URL_PLATFORMS[@]}" != 1 ] ; then
97104
lipo -create -output "$dylib" "$dylib".*
98105
fi
106+
107+
# Download dSYM if requested
108+
if [ -n "$DOWNLOAD_DSYM" ] ; then
109+
for urlp in "${URL_PLATFORMS[@]}" ; do
110+
debug curl $CURL_DEBUG -o "$dylib".dSYM.zip "$URL_BASE"/"$urlp"/latest/dSYM/"$dylib".dSYM.zip
111+
curl $CURL_DEBUG -o "$dylib".dSYM.zip "$URL_BASE"/"$urlp"/latest/dSYM/"$dylib".dSYM.zip
112+
if [ -f "$dylib".dSYM.zip ] ; then
113+
debug unzip $UNZIP_DEBUG "$dylib".dSYM.zip
114+
unzip $UNZIP_DEBUG "$dylib".dSYM.zip
115+
rm -f "$dylib".dSYM.zip
116+
117+
# macos app store needs universal binaries - merge dSYMs
118+
if [ "${#URL_PLATFORMS[@]}" != 1 ] ; then
119+
mv "$dylib".dSYM "$dylib".dSYM.$(basename "$urlp")
120+
fi
121+
fi
122+
done
123+
if [ "${#URL_PLATFORMS[@]}" != 1 ] ; then
124+
# Merge dSYMs for universal binary if we have multiple architectures
125+
if ls "$dylib".dSYM.* >/dev/null 2>&1 ; then
126+
lipo -create -output "$dylib".dSYM.tmp $(find . -name "$dylib".dSYM.*/Contents/Resources/DWARF/"$dylib" -o -name "$dylib".dSYM.*/Contents/Resources/DWARF/$(basename "$dylib" .dylib))
127+
# Reconstruct dSYM bundle structure
128+
mkdir -p "$dylib".dSYM/Contents/Resources/DWARF
129+
mv "$dylib".dSYM.tmp "$dylib".dSYM/Contents/Resources/DWARF/$(basename "$dylib" .dylib)
130+
rm -rf "$dylib".dSYM.*
131+
fi
132+
fi
133+
fi
134+
99135
popd >/dev/null
100136
if [ -f "$dylib".tmp/"$dylib" ] ; then
101137
printf "${GREEN}Download ${dylib} success!${NC}\n"
102138
mv "$dylib".tmp/"$dylib" "$dylib"
139+
# Move dSYM if it exists (only when --dsym flag was used)
140+
if [ -n "$DOWNLOAD_DSYM" ] && [ -d "$dylib".tmp/"$dylib".dSYM ] ; then
141+
rm -rf "$dylib".dSYM
142+
mv "$dylib".tmp/"$dylib".dSYM "$dylib".dSYM
143+
fi
103144
fi
104145
rm -rf "$dylib".tmp
105146
) &
@@ -263,6 +304,7 @@ else
263304
if [ "$1" = "all" ] ; then
264305
dylibs=(${allcores[*]})
265306
elif [ "$1" = "appstore" ] ; then
307+
DOWNLOAD_DSYM=1
266308
exports=(${appstore_cores[*]})
267309
if [ "$PLATFORM" = "osx" ] ; then
268310
exports+=(

0 commit comments

Comments
 (0)