Wireshark-dev: [Wireshark-dev] Building a .dmg package on a recent macOS setup
From: Lori Jakab <lorand.jakab@xxxxxxxxx>
Date: Wed, 20 Jun 2018 11:36:45 +0200
Hi,

I'm running on macOS High Sierra 10.13.5 with Xcode 9.4.1 + Command Line Tools and using Homebrew for installing most open source packages (like Qt5). I would say this is a pretty common developer setup on macOS. I can build the Wireshark binaries with this setup and they run fine. However, I can't build the macOS installer package, because PackageMaker is no longer available from Apple. The last paragraph in README.macos no longer applies:

If you want to build Wireshark installer packages on a system that
doesn't include Xcode 3.x or earlier, you will need to install some
additional tools.  From the Xcode menu, select the Open Developer Tool
menu, and then select More Developer Tools... from that menu.  That will
open up a page on the Apple Developer Connection Web site; you may need
a developer account to download the additional tools.  Download the
Auxiliary Tools for Xcode package; when the dmg opens, drag all its
contents to the Contents/Applications subdirectory of the Xcode.app
directory (normally /Applications/Xcode.app/Contents/Applications); then
copy .../Contents/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
to /usr/bin/packagemaker (the PackageMaker app, when run from the
command line rather than as a double-clicked app, is the packagemaker
command).

The build fails with:

Scanning dependencies of target dmg_package
+ set_ds_store=false
+ ds_store_root=root.ds_store
+ app_bundle=Wireshark.app
+ rw_name=RWwireshark.dmg
+ volume_name=Wireshark
+ src_dir=.
+ tmp_dir=/tmp/dmg-41852
+ auto_open_opt=
+ '[' -f /Applications/Xcode.app/Contents/Applications/PackageMaker.app/Contents/MacOS/PackageMaker ']'
+ '[' -f /Applications/Xcode.app/Developer/Tools/packagemaker ']'
+ '[' -f /Applications/Xcode.app/Developer/usr/bin/packagemaker ']'
+ '[' -f /Developer/Tools/packagemaker ']'
+ '[' -f /Developer/usr/bin/packagemaker ']'
+ '[' -f /usr/bin/packagemaker ']'
+ '[' -f /usr/local/bin/packagemaker ']'
+ '[' -z '' ']'
+ echo '/Users/lojakab/src/cmake-build-dir/packaging/macosx/osx-dmg.sh: couldn'\''t find PackageMaker'
/Users/lojakab/src/cmake-build-dir/packaging/macosx/osx-dmg.sh: couldn't find PackageMaker
+ exit 1
make[3]: *** [CMakeFiles/dmg_package] Error 1
make[2]: *** [CMakeFiles/dmg_package.dir/all] Error 2
make[1]: *** [CMakeFiles/dmg_package.dir/rule] Error 2
make: *** [dmg_package] Error 2

Trying to find a solution I came across several posts saying that pkgbuild and productbuild should be used to build .dmg packages.

How are the official Wireshark macOS packages built? Is it possible to build a working .dmg on a recent system?

Thanks,
-Lori