From 6d90c28513996616fa630718d5c030f28ceb34fa Mon Sep 17 00:00:00 2001 From: dijunkun Date: Sun, 13 Sep 2026 06:39:26 +0800 Subject: [PATCH] [perf] strip packaged Slint runtime symbols --- apps/desktop/scripts/linux/package_deb.sh | 5 ++++- apps/desktop/scripts/macos/bundle_app.sh | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/desktop/scripts/linux/package_deb.sh b/apps/desktop/scripts/linux/package_deb.sh index b9feed9f..fa320f65 100755 --- a/apps/desktop/scripts/linux/package_deb.sh +++ b/apps/desktop/scripts/linux/package_deb.sh @@ -87,7 +87,7 @@ if [[ ! -x "$BUILD_BINARY" ]]; then exit 1 fi -for command_name in readelf ldd dpkg-deb; do +for command_name in readelf ldd dpkg-deb strip; do if ! command -v "$command_name" >/dev/null 2>&1; then echo "Required packaging command is missing: $command_name" >&2 exit 1 @@ -128,6 +128,9 @@ if [[ -n "$SLINT_NEEDED" ]]; then exit 1 fi install -m 0755 "$SLINT_LIBRARY" "$PRIVATE_DIR/$SLINT_NEEDED" + # Keep dynamic exports/relocations while removing unneeded symbols from the + # staged copy. Never strip Xmake's cached runtime in place. + strip --strip-unneeded "$PRIVATE_DIR/$SLINT_NEEDED" fi cat > "$BIN_DIR/$PKG_NAME" <<'EOF' diff --git a/apps/desktop/scripts/macos/bundle_app.sh b/apps/desktop/scripts/macos/bundle_app.sh index d0cdee9a..be02645b 100755 --- a/apps/desktop/scripts/macos/bundle_app.sh +++ b/apps/desktop/scripts/macos/bundle_app.sh @@ -11,7 +11,7 @@ EXPECTED_ARCH="$2" APP_EXECUTABLE="$APP_BUNDLE/Contents/MacOS/CrossDesk" FRAMEWORKS_DIR="$APP_BUNDLE/Contents/Frameworks" -for command_name in codesign install_name_tool lipo otool; do +for command_name in codesign install_name_tool lipo otool strip; do if ! command -v "$command_name" >/dev/null 2>&1; then echo "Required bundling command is missing: $command_name" >&2 exit 1 @@ -123,7 +123,11 @@ if ! otool -l "$APP_EXECUTABLE" | awk ' install_name_tool -add_rpath "@executable_path/../Frameworks" "$APP_EXECUTABLE" fi -# install_name_tool invalidates the linker's ad-hoc signature. Sign nested code +# Strip only the staged runtime, retaining exported symbols for Slint's C ABI. +# The package cache remains intact for debugging and other consumers. +strip -S -x "$FRAMEWORKS_DIR/$SLINT_NAME" + +# install_name_tool and strip invalidate the linker's ad-hoc signature. Sign nested code # first, then seal the complete app bundle so local packages remain launchable. codesign --force --sign - "$FRAMEWORKS_DIR/$SLINT_NAME" codesign --force --deep --sign - "$APP_BUNDLE"