mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-04 18:20:42 +00:00
Add version information to macOS application bundle and dmg.
This commit is contained in:
parent
8417e7d43f
commit
740ff460e7
@ -3,17 +3,19 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>OSCAR</string>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<string>${QMAKE_FULL_VERSION}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>${ASSETCATALOG_COMPILER_APPICON_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${QMAKE_FULL_VERSION}</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<string>${QMAKE_PKGINFO_TYPEINFO}</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
@ -22,15 +22,23 @@ if [[ ${APP} != "" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create deployable application bundle (if it hasn't been already been done)
|
||||
# Create a deployable application bundle (if it hasn't been already been done).
|
||||
if [[ ! -d "${APP}/Contents/Frameworks/QtCore.framework" ]]; then
|
||||
echo "${QT_BIN}"/macdeployqt "${APP}"
|
||||
"${QT_BIN}"/macdeployqt "${APP}" || exit
|
||||
fi
|
||||
|
||||
# TODO: add version number to target .dmg filename
|
||||
# 1. Set the version in the Info.plist during build.
|
||||
# 2. Get the version from ${APP}/Contents/Info.plist
|
||||
# Get the version from the application bundle.
|
||||
VERSION=`/usr/libexec/PlistBuddy -c "Print CFBundleGetInfoString" ${APP}/Contents/Info.plist`
|
||||
echo ${APP} is version ${VERSION}
|
||||
|
||||
# If it's a prerelease version, include the git revision.
|
||||
if [[ ${VERSION} == *-* ]]; then
|
||||
GIT_REVISION=`/usr/libexec/PlistBuddy -c "Print GitRevision" ${APP}/Contents/Info.plist 2>/dev/null`
|
||||
if [[ ${GIT_REVISION} != "" ]]; then
|
||||
VERSION=${VERSION}-${GIT_REVISION}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir "${STAGING_DIR}" || exit
|
||||
@ -42,6 +50,6 @@ do
|
||||
done
|
||||
|
||||
echo "Creating .dmg"
|
||||
hdiutil create -srcfolder "${STAGING_DIR}" -volname "${TARGET}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDZO -imagekey zlib-level=9 -o "${TARGET}.dmg" -ov
|
||||
hdiutil create -srcfolder "${STAGING_DIR}" -volname "${TARGET}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDZO -imagekey zlib-level=9 -o "${TARGET}-${VERSION}.dmg" -ov
|
||||
|
||||
rm -rf "${STAGING_DIR}"
|
||||
|
24
Building/MacOS/finalize_plist
Executable file
24
Building/MacOS/finalize_plist
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
SRC=$1
|
||||
PLIST=$2
|
||||
|
||||
if [[ ! -d ${SRC} ]]; then
|
||||
echo "${SRC} is not a directory!"
|
||||
exit 128
|
||||
fi
|
||||
if [[ ! -f ${PLIST} ]]; then
|
||||
echo "${PLIST} does not exist!"
|
||||
exit 128
|
||||
fi
|
||||
|
||||
GIT_REVISION=`awk '/#define GIT_REVISION / { gsub(/"/, "", $3); print $3 }' ${SRC}/git_info.h`
|
||||
if [[ ${GIT_REVISION} != "" ]]; then
|
||||
/usr/libexec/PlistBuddy -c "Add GitRevision string ${GIT_REVISION}" ${PLIST} 2>/dev/null
|
||||
if [[ $? == 1 ]]; then
|
||||
/usr/libexec/PlistBuddy -c "Set GitRevision ${GIT_REVISION}" ${PLIST}
|
||||
fi
|
||||
fi
|
||||
|
||||
# This is where we would set CFBundleVersion if needed in the future.
|
||||
|
@ -93,7 +93,8 @@ QMAKE_TARGET_PRODUCT = OSCAR
|
||||
QMAKE_TARGET_COMPANY = The OSCAR Team
|
||||
QMAKE_TARGET_COPYRIGHT = © 2019 The OSCAR Team
|
||||
QMAKE_TARGET_DESCRIPTION = "OpenSource CPAP Analysis Reporter"
|
||||
VERSION = 0.0.0.0
|
||||
_VERSION_FILE = $$cat(./VERSION)
|
||||
VERSION = $$section(_VERSION_FILE, '"', 1, 1)
|
||||
RC_ICONS = ./icons/logo.ico
|
||||
|
||||
macx {
|
||||
@ -513,11 +514,20 @@ test {
|
||||
}
|
||||
|
||||
macx {
|
||||
# On macOS put a custom Info.plist into the bundle that disables dark mode on Mojave
|
||||
QMAKE_INFO_PLIST = "../Building/MacOS/Info.plist.in"
|
||||
app_bundle {
|
||||
# On macOS put a custom Info.plist into the bundle that disables dark mode on Mojave.
|
||||
QMAKE_INFO_PLIST = "../Building/MacOS/Info.plist.in"
|
||||
|
||||
# Add the git revision to the Info.plist.
|
||||
Info_plist.target = Info.plist
|
||||
Info_plist.depends = $${TARGET}.app/Contents/Info.plist
|
||||
Info_plist.commands = $$_PRO_FILE_PWD_/../Building/MacOS/finalize_plist $$_PRO_FILE_PWD_ $${TARGET}.app/Contents/Info.plist
|
||||
QMAKE_EXTRA_TARGETS += Info_plist
|
||||
PRE_TARGETDEPS += $$Info_plist.target
|
||||
}
|
||||
|
||||
# Add a dist-mac target to build the distribution .dmg.
|
||||
QMAKE_EXTRA_TARGETS += dist-mac
|
||||
dist-mac.commands = QT_BIN=$$[QT_INSTALL_PREFIX]/bin $$_PRO_FILE_PWD_/../Building/MacOS/create_dmg OSCAR OSCAR.app $$_PRO_FILE_PWD_/../Building/MacOS/README.rtfd
|
||||
dist-mac.commands = QT_BIN=$$[QT_INSTALL_PREFIX]/bin $$_PRO_FILE_PWD_/../Building/MacOS/create_dmg $${TARGET} $${TARGET}.app $$_PRO_FILE_PWD_/../Building/MacOS/README.rtfd
|
||||
dist-mac.depends = $${TARGET}.app/Contents/MacOS/$${TARGET}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user