From 1677e0a8f9cb097e5b7613d51489244772b8b9be Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Sat, 26 Feb 2022 15:14:36 -0800 Subject: [PATCH] Packaging: Ship macOS dSYMs in their own .dmg. Create a Wireshark.dSYM bundle for our debugging symbols. Create a separate .dmg for the dSYM bundle, similar to what we do for Windows. `dwarfdump --uuid run/Wireshark.dSYM` returns what app This reduces the size of the application bundle and .dmg quite a bit (sizes measured with `du -sm`): 51 Wireshark 3.7.0 Intel 64.dmg 81 Wireshark dSYM 3.7.0 Intel 64.dmg 182 Wireshark.app 262 Wireshark.dSYM --- CMakeLists.txt | 21 ++- docbook/release-notes.adoc | 2 + .../Debugging_symbols_installation.adoc | 17 +++ packaging/macosx/Read_me_first.adoc | 2 +- packaging/macosx/osx-app.sh.in | 85 +++++++---- packaging/macosx/osx-dmg.sh.in | 36 +++-- ...ttings.py.in => wireshark-app.dmgbuild.in} | 19 +++ packaging/macosx/wireshark-dsym.dmgbuild.in | 136 ++++++++++++++++++ 8 files changed, 273 insertions(+), 45 deletions(-) create mode 100644 packaging/macosx/Debugging_symbols_installation.adoc rename packaging/macosx/{dmgbuild-settings.py.in => wireshark-app.dmgbuild.in} (90%) create mode 100644 packaging/macosx/wireshark-dsym.dmgbuild.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 71a0f1d08c..31b98f03b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1702,9 +1702,10 @@ set(CFG_OUT_FILES image/wireshark.exe.manifest image/wireshark.rc packaging/macosx/Info.plist - packaging/macosx/dmgbuild-settings.py packaging/macosx/osx-app.sh packaging/macosx/osx-dmg.sh + packaging/macosx/wireshark-app.dmgbuild + packaging/macosx/wireshark-dsym.dmgbuild packaging/source/git-export-release.sh wireshark.pc ) @@ -3168,8 +3169,22 @@ if(ENABLE_APPLICATION_BUNDLE) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macosx/Read_me_first.adoc ) - add_custom_target(read_me_first_html DEPENDS ${_read_me_first} ) - add_dependencies(dmg_package_prep read_me_first_html) + + set(_dsym_installation "packaging/macosx/Debugging symbols installation.html") + ADD_CUSTOM_COMMAND( + OUTPUT + ${_dsym_installation} + COMMAND ${ASCIIDOCTOR_EXECUTABLE} + --backend html + --out-file ${_dsym_installation} + --attribute include-dir=${CMAKE_SOURCE_DIR}/docbook + ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macosx/Debugging_symbols_installation.adoc + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macosx/Debugging_symbols_installation.adoc + ) + + add_custom_target(dmg_package_readmes DEPENDS ${_read_me_first} ${_dsym_installation} ) + add_dependencies(dmg_package_prep dmg_package_readmes) ADD_CUSTOM_TARGET( dmg_package COMMAND bash -x ${CMAKE_BINARY_DIR}/packaging/macosx/osx-dmg.sh diff --git a/docbook/release-notes.adoc b/docbook/release-notes.adoc index 10f30cbdcd..d6c93604a8 100644 --- a/docbook/release-notes.adoc +++ b/docbook/release-notes.adoc @@ -97,6 +97,8 @@ They previously shipped with Npcap 1.55. * Support to display JSON mapping for Protobuf message. +* macOS debugging symbols are now shipped in separate packages. + === Removed Features and Support * CMake: The options starting with DISABLE_something were renamed ENABLE_something for consistency. diff --git a/packaging/macosx/Debugging_symbols_installation.adoc b/packaging/macosx/Debugging_symbols_installation.adoc new file mode 100644 index 0000000000..a7c1b99e2e --- /dev/null +++ b/packaging/macosx/Debugging_symbols_installation.adoc @@ -0,0 +1,17 @@ +// Required attributes: +// include-dir + +include::{include-dir}/attributes.adoc[] +:stylesheet: {include-dir}/ws.css + +== Debugging Symbols for Wireshark + +This archive contains the debugging symbols for Wireshark {wireshark-version}. +The debugging symbols are only necessary if Wireshark is crashing and you need to report an issue to the Wireshark development team. + +WARNING: This won't work properly with any version other than Wireshark {wireshark-version}. + +To install the symbols, drag _Wireshark.dSYM_ to the same location as _Wireshark_. +This is usually your _Applications_ folder. + +To uninstall, drag _Wireshark.dSYM_ to the trash. diff --git a/packaging/macosx/Read_me_first.adoc b/packaging/macosx/Read_me_first.adoc index a715a4507d..1f6073ded3 100644 --- a/packaging/macosx/Read_me_first.adoc +++ b/packaging/macosx/Read_me_first.adoc @@ -5,7 +5,7 @@ include::{include-dir}/attributes.adoc[] :stylesheet: {include-dir}/ws.css -= Before You Begin +== Before You Begin This release of Wireshark requires macOS {min-macos-version} or later. If you are running an earlier version of macOS you can install using another packaging system such as Homebrew or MacPorts. diff --git a/packaging/macosx/osx-app.sh.in b/packaging/macosx/osx-app.sh.in index 382b33bb1c..70503bd410 100755 --- a/packaging/macosx/osx-app.sh.in +++ b/packaging/macosx/osx-app.sh.in @@ -434,42 +434,69 @@ else fi -dsymify_file () { - echo " $1" - dsymutil --minimize "$1" -} +bundle_dsym=$bundle.dSYM -echo "Dsymifying executables:" -if [ -z "$bundle_binary_list" ] ; then - echo "No executables specified for dsymifying." - exit 1 -fi -for binary in $bundle_binary_list ; do - if [ -e "$binary" ];then - dsymify_file "$binary" - fi -done - -echo "Dsymifying frameworks:" +frameworks=() for framework in "$pkglib"/*.framework/Versions/*/* ; do if [ -f "$framework" ];then - dsymify_file "$framework" + frameworks+=("$framework") fi done -echo "Dsymifying libraries:" -for library in "$pkglib"/*.dylib ; do - # - # Squelch warnings, in case the .o files from building - # support libraries aren't around any more. - # - dsymify_file "$library" | grep -E -v 'unable to open object file' -done +echo "Dsymifying binaries:" +# shellcheck disable=SC2086 +dsymutil --minimize --out "$bundle_dsym" \ + $bundle_binary_list \ + "${frameworks[@]}" \ + "$pkglib"/*.dylib -echo "Dsymifying plugins:" -for plugin in "$pkgplugin"/*/*.so ; do - dsymify_file "$plugin" -done +# echo "Stripping binaries:" +# # shellcheck disable=SC2086 +# strip -S \ +# $bundle_binary_list \ +# "${frameworks[@]}" \ +# "$pkglib"/*.dylib \ +# "$pkgplugin"/*/*.so + +# XXX What's the proper directory layout here? +# dsymify_file () { +# # out_dsym="${1/#$bundle/$bundle_dsym}.dSYM" +# echo " $1" +# dsymutil --minimize --out "$bundle_dsym" "$1" +# strip "$1" +# } + +# echo "Dsymifying and stripping executables:" +# if [ -z "$bundle_binary_list" ] ; then +# echo "No executables specified for dsymifying." +# exit 1 +# fi +# for binary in $bundle_binary_list ; do +# if [ -e "$binary" ];then +# dsymify_file "$binary" +# fi +# done + +# echo "Dsymifying and stripping frameworks:" +# for framework in "$pkglib"/*.framework/Versions/*/* ; do +# if [ -f "$framework" ];then +# dsymify_file "$framework" +# fi +# done + +# echo "Dsymifying and stripping libraries:" +# for library in "$pkglib"/*.dylib ; do +# # +# # Squelch warnings, in case the .o files from building +# # support libraries aren't around any more. +# # +# dsymify_file "$library" | grep -E -v 'unable to open object file' +# done + +# echo "Dsymifying and stripping plugins:" +# for plugin in "$pkgplugin"/*/*.so ; do +# dsymify_file "$plugin" +# done codesign_file () { # https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html diff --git a/packaging/macosx/osx-dmg.sh.in b/packaging/macosx/osx-dmg.sh.in index a922e8a680..ed7105d964 100755 --- a/packaging/macosx/osx-dmg.sh.in +++ b/packaging/macosx/osx-dmg.sh.in @@ -7,7 +7,8 @@ set -e # Defaults dmgbuild="@DMGBUILD_EXECUTABLE@" version="@VERSION@" -settings_file="@CMAKE_BINARY_DIR@/packaging/macosx/dmgbuild-settings.py" +app_settings_file="@CMAKE_BINARY_DIR@/packaging/macosx/wireshark-app.dmgbuild" +dsym_settings_file="@CMAKE_BINARY_DIR@/packaging/macosx/wireshark-dsym.dmgbuild" architecture="" # Help message @@ -24,8 +25,8 @@ OPTIONS -h,--help Display this help message. -Icons are positioned and the background image is set in -dmgbuild-settings.py.in. +Icons are positioned and the background image is set in wireshark-app.dmgbuild.in +and wireshark-dsym.dmgbuild.in. " } @@ -58,27 +59,38 @@ do shift 1 done -vol_name="Wireshark ${version}" -img_name="$vol_name $architecture.dmg" +app_vol_name="Wireshark ${version}" +app_img_name="$app_vol_name $architecture.dmg" -echo -e "\\nCREATE WIRESHARK DISK IMAGE\\n" +printf "\nCreating application disk image\n" "$dmgbuild" \ --no-hidpi \ - -s "$settings_file" \ - "$vol_name" \ - "$img_name" || exit 1 + -s "$app_settings_file" \ + "$app_vol_name" \ + "$app_img_name" || exit 1 -echo -e "\\nSIGN WIRESHARK DISK IMAGE\\n" +dsym_vol_name="Wireshark dSYM ${version}" +dsym_img_name="$dsym_vol_name $architecture.dmg" + +printf "\nCreating debugging symbols disk image\n" + +"$dmgbuild" \ + --no-hidpi \ + -s "$dsym_settings_file" \ + "$dsym_vol_name" \ + "$dsym_img_name" || exit 1 + +printf "\nSigning disk images\n" # TN2206, "Signing Disk Images" if [ -n "$CODE_SIGN_IDENTITY" ] ; then - echo -e "Signing $img_name" + echo -e "Signing $app_img_name and $dsym_img_name" codesign \ --sign "Developer ID Application: $CODE_SIGN_IDENTITY" \ --timestamp \ --verbose \ - "$img_name" + "$app_img_name" "$dsym_img_name" fi exit 0 diff --git a/packaging/macosx/dmgbuild-settings.py.in b/packaging/macosx/wireshark-app.dmgbuild.in similarity index 90% rename from packaging/macosx/dmgbuild-settings.py.in rename to packaging/macosx/wireshark-app.dmgbuild.in index 18e36f081f..7a873c2dc7 100644 --- a/packaging/macosx/dmgbuild-settings.py.in +++ b/packaging/macosx/wireshark-app.dmgbuild.in @@ -41,7 +41,26 @@ ws_uninstall_path_helper = 'Remove Wireshark from the system path.pkg' # UDZO - UDIF zlib-compressed image # UDBZ - UDIF bzip2-compressed image (Mac OS X 10.4+ only) # ULFO - UDIF lzfse-compressed image (OS X 10.11+ only) +# ULMO - UDIF lzma-compressed image (macOS 10.15+ only) # Volume format (see hdiutil create -help) +# +# A test with the following bundles resulted in the following .dmg sizes, +# measured with `du -sm`: +# 182 Wireshark.app +# 267 Wireshark.dSYM +# +# UDBZ +# 51 Wireshark 3.7.0 Intel 64.dmg +# 81 Wireshark dSYM 3.7.0 Intel 64.dmg +# +# ULFO +# 51 Wireshark 3.7.0 Intel 64.dmg +# 81 Wireshark dSYM 3.7.0 Intel 64.dmg +# +# ULMO +# 40 Wireshark 3.7.0 Intel 64.dmg +# 50 Wireshark dSYM 3.7.0 Intel 64.dmg + format = defines.get('format', 'UDBZ') # Compression level (if relevant) diff --git a/packaging/macosx/wireshark-dsym.dmgbuild.in b/packaging/macosx/wireshark-dsym.dmgbuild.in new file mode 100644 index 0000000000..272c337e2c --- /dev/null +++ b/packaging/macosx/wireshark-dsym.dmgbuild.in @@ -0,0 +1,136 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +import biplist +import os.path + +# +# Example settings file for dmgbuild +# +# Adapted from https://raw.githubusercontent.com/al45tair/dmgbuild/master/examples/settings.py + +# Use like this: dmgbuild -s settings.py "Test Volume" test.dmg + +# You can actually use this file for your own application (not just TextEdit) +# by doing e.g. +# +# dmgbuild -s settings.py -D app=/path/to/My.app "My Application" MyApp.dmg + +# .. Useful stuff .............................................................. + +ws_version = '@VERSION@' +ws_volname = 'Wireshark Debugging Symbols' + ws_version +ws_srcdir = '@CMAKE_SOURCE_DIR@' +ws_bindir = '@CMAKE_BINARY_DIR@' +ws_app_dsym = 'Wireshark.dSYM' +ws_readme_dsym = 'Debugging symbols installation.html' + +# .. Basics .................................................................... + +# Uncomment to override the output filename +# filename = ws_volname + ' Intel 64.dmg' + +# Uncomment to override the output volume name +# volume_name = 'Wireshark ' + ws_version + +# From the hdiutil man page: +# UDZO - UDIF zlib-compressed image +# UDBZ - UDIF bzip2-compressed image (Mac OS X 10.4+ only) +# ULFO - UDIF lzfse-compressed image (OS X 10.11+ only) +# ULMO - UDIF lzma-compressed image (macOS 10.15+ only) +# Volume format (see hdiutil create -help) +format = defines.get('format', 'UDBZ') + +# Compression level (if relevant) +compression_level = 9 + +# Volume size +size = None + +# Files to include +files = [ + os.path.join(ws_bindir, 'run', ws_app_dsym), + os.path.join(ws_bindir, 'packaging', 'macosx', ws_readme_dsym), +] + +# Symlinks to create +symlinks = { + 'Applications': '/Applications', + } + +# Volume icon +# +# You can either define icon, in which case that icon file will be copied to the +# image, *or* you can define badge_icon, in which case the icon file you specify +# will be used to badge the system's Removable Disk icon +# +badge_icon = os.path.join(ws_srcdir, 'packaging', 'macosx', 'wsiconvol.icns') +#badge_icon = icon_from_app(application) + +# Where to put the icons +icon_locations = { + ws_app_dsym: ( 80, 64), + 'Applications': (240, 64), + ws_readme_dsym: (160, 170), + } + +# .. Window configuration ...................................................... + +# Background +# +# This is a STRING containing any of the following: +# +# #3344ff - web-style RGB color +# #34f - web-style RGB color, short form (#34f == #3344ff) +# rgb(1,0,0) - RGB color, each value is between 0 and 1 +# hsl(120,1,.5) - HSL (hue saturation lightness) color +# hwb(300,0,0) - HWB (hue whiteness blackness) color +# cmyk(0,1,0,0) - CMYK color +# goldenrod - X11/SVG named color +# builtin-arrow - A simple built-in background with a blue arrow +# /foo/bar/baz.png - The path to an image file +# +# The hue component in hsl() and hwb() may include a unit; it defaults to +# degrees ('deg'), but also supports radians ('rad') and gradians ('grad' +# or 'gon'). +# +# Other color components may be expressed either in the range 0 to 1, or +# as percentages (e.g. 60% is equivalent to 0.6). +background = os.path.join(ws_srcdir, 'packaging', 'macosx', 'dmg_background.png') + +show_status_bar = False +show_tab_view = False +show_toolbar = False +show_pathbar = False +show_sidebar = False +sidebar_width = 180 + +# Window position in ((x, y), (w, h)) format +window_rect = ((600, 200), (350, 325)) + +# Select the default view; must be one of +# +# 'icon-view' +# 'list-view' +# 'column-view' +# 'coverflow' +# +default_view = 'icon-view' + +# General view configuration +show_icon_preview = False + +# Set these to True to force inclusion of icon/list view settings (otherwise +# we only include settings for the default view) +include_icon_view_settings = 'auto' +include_list_view_settings = 'auto' + +# .. Icon view configuration ................................................... + +arrange_by = None +grid_offset = (0, 0) +#grid_spacing = 100 +scroll_position = (0, 0) +#label_pos = 'bottom' # or 'right' +text_size = 12 +icon_size = 72