2 # Don't consider packaging a success if any commands fail
3 # See http://redsymbol.net/articles/unofficial-bash-strict-mode/
7 if [ -s "$myname" ] && [ -x "$myname" ]; then
8 # $myname is already a valid file name
13 /*) exit 1;; # absolute path - do not search PATH
15 # Search all directories from the PATH variable. Take
16 # care to interpret leading and trailing ":" as meaning
17 # the current directory; the same is true for "::" within
20 # Replace leading : with . in PATH, store in p
22 # Replace trailing : with .
26 # Temporary input field separator, see FAQ #1
28 # Split the path on colons and loop through each of them
30 [ -f "$dir/$myname" ] || continue # no file
31 [ -x "$dir/$myname" ] || continue # not executable
33 break # only return first matching file
35 # Restore old input field separator
41 if [ ! -f "$mypath" ]; then
42 echo >&2 "cannot find full path name: $myname"
46 SCRIPTDIR=$(dirname $mypath)
47 QUASSEL_VERSION=$(git describe)
50 # check the working dir
51 # Default to "." using Bash default-value syntax
53 WORKINGDIR="${WORKINGDIR}/"
54 PACKAGETMPDIR="${WORKINGDIR}PACKAGE_TMP_DIR_${BUILDTYPE}"
55 QUASSEL_DMG="Quassel${BUILDTYPE}_MacOSX-x86_64_${QUASSEL_VERSION}.dmg"
57 # Default to null string
58 if [[ -z ${3:-} ]]; then
61 # Options provided, append to list
62 ADDITIONAL_PLUGINS=",$3"
65 echo "ADDITIONAL_PLUGINS: ${ADDITIONAL_PLUGINS}"
70 cp -r ${WORKINGDIR}Quassel\ Client.app ${PACKAGETMPDIR}/
71 ${SCRIPTDIR}/macosx_DeployApp.py --plugins=qcocoa,qgenericbearer,qcorewlanbearer,qmacstyle${ADDITIONAL_PLUGINS} "${PACKAGETMPDIR}/Quassel Client.app"
74 cp ${WORKINGDIR}quasselcore ${PACKAGETMPDIR}/
75 ${SCRIPTDIR}/macosx_DeployApp.py --nobundle --plugins=qsqlite,qsqlpsql${ADDITIONAL_PLUGINS} ${PACKAGETMPDIR}
78 cp -r ${WORKINGDIR}Quassel.app ${PACKAGETMPDIR}/
79 ${SCRIPTDIR}/macosx_DeployApp.py --plugins=qsqlite,qsqlpsql,qcocoa,qgenericbearer,qcorewlanbearer,qmacstyle${ADDITIONAL_PLUGINS} "${PACKAGETMPDIR}/Quassel.app"
82 echo >&2 "Valid parameters are \"Client\", \"Core\", or \"Mono\"."
83 rmdir ${PACKAGETMPDIR}
88 echo "Creating macOS disk image with hdiutil: 'Quassel ${BUILDTYPE} - ${QUASSEL_VERSION}'"
90 # Modern macOS versions support APFS, however default to HFS+ for now in order
91 # to ensure old macOS versions can parse the package and display the warning
92 # about being out of date. This mirrors the approach taken by Qt's macdeployqt
93 # tool. In the future if this isn't needed, just remove "-fs HFS+" to revert
96 # See https://doc.qt.io/qt-5/macos-deployment.html
98 # hdiutil seems to have a bit of a reputation for failing to create disk images
99 # for various reasons.
101 # If you've come here to see why on earth your macOS build is failing despite
102 # making changes entirely unrelated to macOS, you have my sympathy.
104 # There are two main approaches:
106 # 1. Let hdiutil calculate a size automatically
108 # 2. Separately calculate the size with a margin of error, then specify this
109 # to hdiutil during disk image creation.
111 # Both seem to have caused issues, but in recent tests, option #1 seemed more
116 hdiutil create -srcfolder ${PACKAGETMPDIR} -format UDBZ -fs HFS+ -volname "Quassel ${BUILDTYPE} - ${QUASSEL_VERSION}" "${WORKINGDIR}${QUASSEL_DMG}" >/dev/null
118 # If hdiutil changes over time and fails often, you can try the other option.
122 #PACKAGESIZE_MARGIN="1.1"
123 #PACKAGESIZE=$(echo "$(du -ms ${PACKAGETMPDIR} | cut -f1) * $PACKAGESIZE_MARGIN" | bc)
124 #echo "PACKAGESIZE: $PACKAGESIZE MB"
125 #hdiutil create -srcfolder ${PACKAGETMPDIR} -format UDBZ -fs HFS+ -size ${PACKAGESIZE}M -volname "Quassel ${BUILDTYPE} - ${QUASSEL_VERSION}" "${WORKINGDIR}${QUASSEL_DMG}" >/dev/null
128 # Regardless of choice, clean up the packaging temporary directory
129 rm -rf ${PACKAGETMPDIR}