X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=scripts%2Fbuild%2Fmacosx_makebundle.py;h=85742a0610a3cf7b97a4d5c1c99524bf54ca007b;hp=f3b86da42df7d5ea81b70ebb7c4372718cd1c58f;hb=28eb43dd1ccd882b2975c346297842c1dc074469;hpb=8cece06596c290d69c1f32b7221c796437f5fabb diff --git a/scripts/build/macosx_makebundle.py b/scripts/build/macosx_makebundle.py index f3b86da4..85742a06 100755 --- a/scripts/build/macosx_makebundle.py +++ b/scripts/build/macosx_makebundle.py @@ -18,6 +18,9 @@ import os.path import sys import commands +# Handling Qt properties +import macosx_qt + # ============================== # Constants # ============================== @@ -39,7 +42,7 @@ if(os.path.dirname(EXE_NAME)): CONTENTS_DIR += BUNDLE_NAME + ".app/Contents/" BUNDLE_VERSION = commands.getoutput("git --git-dir=" + SOURCE_DIR + "/.git/ describe") -ICON_FILE = "pics/quassel.icns" +ICONSET_FOLDER = "pics/iconset/" def createBundle(): @@ -50,23 +53,38 @@ def createBundle(): pass -def copyFiles(exeFile, iconFile): +def copyFiles(exeFile, iconset): os.system("cp %s %sMacOs/%s" % (exeFile, CONTENTS_DIR.replace(' ', '\ '), BUNDLE_NAME.replace(' ', '\ '))) - os.system("cp %s/%s %s/Resources" % (SOURCE_DIR, iconFile, CONTENTS_DIR.replace(' ', '\ '))) + os.system("cp -r %s/%s %s/Resources/quassel.iconset/" % (SOURCE_DIR, iconset, CONTENTS_DIR.replace(' ', '\ '))) -def createPlist(bundleName, iconFile, bundleVersion): +def createPlist(bundleName, bundleVersion): templateFile = file(SOURCE_DIR + "/scripts/build/Info.plist", 'r') template = templateFile.read() templateFile.close() + # Get the minimum macOS deployment version + QT_MACOSX_DEPLOYMENT_TARGET = macosx_qt.qtMakespec('QMAKE_MACOSX_DEPLOYMENT_TARGET') + # Keep in sync with QMAKE_MACOSX_DEPLOYMENT_TARGET + # See https://doc.qt.io/qt-5/macos.html + if QT_MACOSX_DEPLOYMENT_TARGET is None: + # Something went wrong + sys.exit("Could not determine 'QMAKE_MACOSX_DEPLOYMENT_TARGET', check build scripts") + print("Qt macOS deployment target (minimum version): %s" % QT_MACOSX_DEPLOYMENT_TARGET) + plistFile = file(CONTENTS_DIR + "Info.plist", 'w') plistFile.write(template % {"BUNDLE_NAME": bundleName, - "ICON_FILE": iconFile[iconFile.rfind("/") + 1:], - "BUNDLE_VERSION": bundleVersion}) + "ICON_FILE": "quassel.icns", + "BUNDLE_VERSION": bundleVersion, + "QT_MACOSX_DEPLOYMENT_TARGET": QT_MACOSX_DEPLOYMENT_TARGET}) plistFile.close() +def convertIconset(): + os.system("iconutil -c icns %s/Resources/quassel.iconset" % CONTENTS_DIR.replace(' ', '\ ')) + os.system("rm -R %s/Resources/quassel.iconset" % CONTENTS_DIR.replace(' ', '\ ')) + if __name__ == "__main__": createBundle() - createPlist(BUNDLE_NAME, ICON_FILE, BUNDLE_VERSION) - copyFiles(EXE_NAME, ICON_FILE) + createPlist(BUNDLE_NAME, BUNDLE_VERSION) + copyFiles(EXE_NAME, ICONSET_FOLDER) + convertIconset()