|
| 1 | +MacOS |
| 2 | +===== |
| 3 | + |
| 4 | +References |
| 5 | +---------- |
| 6 | + |
| 7 | +* Code Signing: |
| 8 | + * <https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html> |
| 9 | + * <https://developer.apple.com/library/archive/technotes/tn2206/_index.html> |
| 10 | + |
| 11 | +* Notarizing |
| 12 | + * <https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution> |
| 13 | + |
| 14 | +Prerequisites |
| 15 | +------------- |
| 16 | + |
| 17 | +```shell |
| 18 | + sudo gem install asciidoctor |
| 19 | + pip3 install dmgbuild |
| 20 | + brew install pkgconfig sparkle doxygen libp11 libgnutils gettext asciidoctor docbook docbook-xsl |
| 21 | + brew install --cask libndi |
| 22 | +``` |
| 23 | + |
| 24 | +Build |
| 25 | +----- |
| 26 | + |
| 27 | +* Run one time only, or if moving to a new Wireshark revision |
| 28 | + |
| 29 | + ```shell |
| 30 | + tools/macos-setup-brew.sh --install-optional |
| 31 | + ``` |
| 32 | + |
| 33 | +* Here are some exports |
| 34 | + |
| 35 | + ```shell |
| 36 | + export PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig |
| 37 | + export CMAKE_PREFIX_PATH=/opt/homebrew/opt/qt@6 |
| 38 | + export PATH=/usr/local/opt/qt@6/bin:$PATH |
| 39 | + ``` |
| 40 | + |
| 41 | +* Choose a code signing certificate |
| 42 | + * in this example I want to use certificate #4 which was most recently created in XCode Preferences |
| 43 | + |
| 44 | + ```shell |
| 45 | + ❯ security find-identity -p codesigning -v login.keychain |
| 46 | + 1) 02BD99C3D9CE9E301DF3D9D2E1C6148DFE95AC79 "Apple Development: fred.klassen@broadcom.com (PZ339J2MU7)" |
| 47 | + 2) AA173803B28511E3EE2D222D1054A63A7B1938DB "Apple Development: Fred Klassen (VRZWY3PKS3)" |
| 48 | + 3) 0E3D74157F689870D378A291EBC3B1C927BA28D2 "Mac Developer: Fred Klassen (VRZWY3PKS3)" |
| 49 | + 4) 8FE4FBC459A9DA4B372D15A8F606D9B976DE339B "Apple Development: Fred Klassen (VRZWY3PKS3)" |
| 50 | + 4 valid identities found |
| 51 | + ``` |
| 52 | + |
| 53 | + * for clarity I use `8FE4FBC459A9DA4B372D15A8F606D9B976DE339B` but could also select `Apple Development: Fred Klassen (VRZWY3PKS3)` |
| 54 | +* Build |
| 55 | +
|
| 56 | + ```shell |
| 57 | + mkdir build; cd build |
| 58 | + cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 -G Ninja .. |
| 59 | + cmake --build . |
| 60 | + ``` |
| 61 | +
|
| 62 | +* Build an app bundle and sign it |
| 63 | +
|
| 64 | + ```shell |
| 65 | + cmake --build . --target wireshark_app_bundle |
| 66 | + codesign --sign "8FE4FBC459A9DA4B372D15A8F606D9B976DE339B" --prefix "org.broadcom.appneta" \ |
| 67 | + --entitlements ~/git/wireshark/packaging/macosx/entitlements.plist --timestamp --verbose --deep -f \ |
| 68 | + run/Wireshark.app |
| 69 | + ``` |
| 70 | +
|
| 71 | +* Test and note any error messages regarding missing libraries |
| 72 | +
|
| 73 | + ```shell |
| 74 | + run/Wireshark.app/Contents/MacOS/Wireshark --help |
| 75 | + run/Wireshark.app/Contents/MacOS/Wireshark |
| 76 | + ``` |
| 77 | +
|
| 78 | + * often QtDBus.framework is missing so copy it (must use `ditto` not `cp -r`) |
| 79 | +
|
| 80 | + ```shell |
| 81 | + pushd run/Wireshark.app/Contests/Frameworks |
| 82 | + ditto /opt/homebrew/Cellar/qt//6.6.0/lib/QtDBus.framework QtDBus.framework |
| 83 | + codesign --sign "8FE4FBC459A9DA4B372D15A8F606D9B976DE339B" --prefix "org.broadcom.appneta" --entitlements ~/git/wireshark/packaging/macosx/entitlements.plist --timestamp --verbose -f --deep QtDBus.framework |
| 84 | + popd |
| 85 | + ``` |
| 86 | +
|
| 87 | + * if libraries are missing, it may be easier to install upstream official build and copy those libraries as they have updated @rpath |
| 88 | +
|
| 89 | + ```shell |
| 90 | + pushd run/Wireshark.app/Contests/Frameworks |
| 91 | + ditto /Applications/Wireshark_orig.app/Contents/Frameworks/libdbus.1.3.dylib . |
| 92 | + codesign --sign "8FE4FBC459A9DA4B372D15A8F606D9B976DE339B" --prefix "org.broadcom.appneta" --entitlements ~/git/wireshark/packaging/macosx/entitlements.plist --timestamp --verbose -f libdbus.1.3.dylib |
| 93 | + popd |
| 94 | + ``` |
| 95 | +
|
| 96 | +* Make a backup copy of `run/Wireshark.app` as the next command will break it |
| 97 | +
|
| 98 | + ```shell |
| 99 | + mkdir -p ~/data |
| 100 | + ditto run/Wireshark.app ~/data/ |
| 101 | + ``` |
| 102 | +
|
| 103 | +* Make the install `.dmg` file |
| 104 | +
|
| 105 | + ```shell |
| 106 | + cmake --build . --target wireshark_dmg |
| 107 | + ``` |
| 108 | +
|
| 109 | +* Replace a broken `Wireshark.app` in the dmg bundle with the working one |
| 110 | +
|
| 111 | + ```shell |
| 112 | + pushd run |
| 113 | + hdiutil convert Wireshark\ 4.2.0.appneta.58\ Arm\ 64.dmg -format UDRW -o Wireshark\ 4.2.0.appneta.58\ Arm\ 64-rw.dmg |
| 114 | + hdiutil resize -size 500M Wireshark\ 4.2.0.appneta.58\ Arm\ 64-rw.dmg |
| 115 | + hdiutil attach Wireshark\ 4.2.0.appneta.58\ Arm\ 64-rw.dmg |
| 116 | + rm -rf /Volumes/Wireshark\ 4.2.0.appneta.58/Wireshark.app |
| 117 | + ditto ~/data/Wireshark.app /Volumes/Wireshark\ 4.2.0.appneta.58/Wireshark.app |
| 118 | + ``` |
| 119 | +
|
| 120 | + * At this point you will use Finder to unmount the `.dmg` bundle |
| 121 | + * Now convert R/W bundle to R/O |
| 122 | +
|
| 123 | + ```shell |
| 124 | + hdiutil convert Wireshark\ 4.2.0.appneta.58\ Arm\ 64-rw.dmg -format UDRO -o ~/data/Wireshark\ 4.2.0.appneta.58\ Arm\ 64.dmg |
| 125 | + popd |
| 126 | + ``` |
| 127 | +* Code sign the new bundle |
| 128 | +
|
| 129 | + ```shell |
| 130 | + codesign --sign "8FE4FBC459A9DA4B372D15A8F606D9B976DE339B" --prefix "org.broadcom.appneta" --entitlements ~/git/wireshark/packaging/macosx/entitlements.plist --timestamp --verbose -f Wireshark\ 4.2.0.appneta.58\ Arm\ 64.dmg |
| 131 | + ``` |
| 132 | +
|
| 133 | +* Test the new installer program |
| 134 | +
|
| 135 | +Notarize - optional (only supported on TC build machines) |
| 136 | +--------------------------------------------------------- |
| 137 | +
|
| 138 | +At this point you may want to notarize the app_bundle - you will require an |
| 139 | +application-specific password - <https://support.apple.com/en-us/HT204397> |
| 140 | +
|
| 141 | +```shell |
| 142 | +cd run |
| 143 | +ditto -ck --keepParent Wireshark.app Wireshark.zip |
| 144 | +xcrun altool --notarize-app --primary-bundle-id "com.appneta.wireshark.app" --username <apple id> --password <app-specific password> --file Wireshark.zip |
| 145 | +``` |
| 146 | +
|
| 147 | +Wait up to 5 minutes for success - check using this command |
| 148 | +
|
| 149 | +```shell |
| 150 | +xcrun altool --notarize-history 0 --username <apple id> --password <app-specific password> |
| 151 | +``` |
| 152 | +
|
| 153 | +Staple the notarization result so app can be verified as notarized when offline |
| 154 | +
|
| 155 | +```shell |
| 156 | +xcrun stapler staple Wireshark.app |
| 157 | +cd .. |
| 158 | +``` |
| 159 | +
|
| 160 | +macOS Notarize Package |
| 161 | +---------------------- |
| 162 | +
|
| 163 | +* this probably will break `Wireshark.app` but it is here for reference |
| 164 | +
|
| 165 | +```shell |
| 166 | +cd run |
| 167 | +../packaging/macosx/osx-dmg.sh |
| 168 | +xcrun altool --notarize-app --primary-bundle-id "com.appneta.wireshark.dmg" --username <apple id> --password <app-specific password> --file Wireshark\ <version>\ Intel\ 64.dmg |
| 169 | +xcrun altool --notarize-history 0 --username <apple id> --password <app-specific password> |
| 170 | +xcrun stapler staple Wireshark\ <version>\ Intel\ 64.dmg |
| 171 | +cd .. |
| 172 | +``` |
| 173 | +
|
| 174 | +Linux |
| 175 | +===== |
| 176 | +
|
| 177 | +To build Linux debug |
| 178 | +--------------------- |
| 179 | +
|
| 180 | +```shell |
| 181 | +mkdir -p build-debug |
| 182 | +cd build-debug |
| 183 | +cmake -DCMAKE_BUILD_TYPE=Debug .. |
| 184 | +make -j6 |
| 185 | +``` |
| 186 | +
|
| 187 | +Make Linux Package |
| 188 | +------------------ |
| 189 | +
|
| 190 | +Install prerequisites |
| 191 | +
|
| 192 | + $ sudo tools/debian-setup.sh --install-all |
| 193 | +
|
| 194 | +Build packages (from wireshark directory) |
| 195 | +
|
| 196 | + $ dpkg-buildpackage -b -us -uc -jauto |
| 197 | + $ mkdir -p ~/data/wireshark_4.4.5.appneta.61_repo |
| 198 | + $ mv ../wireshark_4.4.5* ~/data/wireshark-4.4.5-appneta.61_repo |
| 199 | +
|
| 200 | +Once packages are made, do something like: |
| 201 | +
|
| 202 | + cd ~/data/wireshark-4.4.5-appneta.61_repo |
| 203 | + dpkg-scanpackages . | xz -c > Packages.xz |
| 204 | +
|
| 205 | +Optionally you can move directory and install packages locally |
| 206 | +... in /etc/apt/sources.list.d/wireshark.list ... (not working for Debian bookworm) |
| 207 | +
|
| 208 | + deb [trusted=yes] file:/home/fklassen/data/wireshark-4.4.5-appneta-61-repo ./ |
| 209 | + $ sudo apt update |
| 210 | + $ sudo apt install wireshark |
| 211 | +
|
| 212 | +To manually install, remove any old versions of wireshark and run something like this: |
| 213 | +
|
| 214 | + sudo dpkg -i libwireshark18_4.4.5.appneta.61_arm64.deb libwireshark-data_4.4.5.appneta.61_all.deb libwiretap15_4.4.5.appneta.61_arm64.deb libwsutil16_4.4.5.appneta.61_arm64.deb tshark_4.4.5.appneta.61_arm64.deb wireshark_4.4.5.appneta.61_arm64.deb wireshark-common_4.4.5.appneta.61_arm64.deb wireshark-dev_4.4.5.appneta.61_arm64.deb wireshark-doc_4.4.5.appneta.61_all.deb |
| 215 | +
|
| 216 | +Windows |
| 217 | +======= |
| 218 | +
|
| 219 | +* Set up as per [install guide](https://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWin32.html). |
| 220 | + No need to install Git, CMake, Python or Perl on Windows Dev machine. Install Qt5 not Qt6. |
| 221 | +
|
| 222 | +* I had to open a regular Command Prompt and run |
| 223 | + `"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"` |
| 224 | + rather than open a "x64 Native Tools Command Prompt for VS 2019". |
| 225 | +
|
| 226 | +* Set the following environmental variables e.g. |
| 227 | +
|
| 228 | +``` |
| 229 | +set WIRESHARK_BASE_DIR=C:\Users\fklassen\git |
| 230 | +set WIRESHARK_VERSION_EXTRA=-appneta.60 |
| 231 | +set WIRESHARK_QT6_PREFIX_PATH=C:\Qt\6.8.0\msvc2022_64 |
| 232 | +``` |
| 233 | +
|
| 234 | +* Create a build directory and change into it e.g |
| 235 | +
|
| 236 | + > mkdir ..\wsbuild64 |
| 237 | + > cd ..\wsbuild64 |
| 238 | +
|
| 239 | +* Generate build files |
| 240 | +
|
| 241 | + > "C:\Program Files\CMake\bin\cmake" -G "Visual Studio 16 2019" -A x64 ..\wireshark |
| 242 | +
|
| 243 | +* Make |
| 244 | +
|
| 245 | + > msbuild /m /p:Configuration=RelWithDebInfo Wireshark.sln |
0 commit comments