After the development of OS X is completed, there may be a feeling of incompleteness - for complete happiness I would like to see my application in the catalog, especially since this is probably the best platform for selling desktop applications. On this subject there is an article from Qt 4.8 times in the official blog, and even older on Habré . Fortunately, there is no longer a need to rebuild Qt, however with the advent of OS X 10.9 some bugs have become critical, you have to get out.<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>Russian</string> <key>CFBundleDisplayName</key> <string>iStodo</string> <key>CFBundleExecutable</key> <string>iStodo</string> <key>CFBundleIconFile</key> <string>iStodo.icns</string> <key>CFBundleIdentifier</key> <string>ru.istodo.istodo</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>iStodo</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> <string>1.1.0</string> <key>CFBundleSignature</key> <string>????</string> <key>NSPrincipalClass</key> <string>NSApplication</string> <key>LSApplicationCategoryType</key> <string>public.app-category.productivity</string> </dict> </plist> QMAKE_INFO_PLIST= $${PWD}/Info.plist QMAKE_CFLAGS += -gdwarf-2 QMAKE_CXXFLAGS += -gdwarf-2 QApplication::setOrganizationName("MyCompany") QApplication::setApplicationName("MyApp") <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.security.app-sandbox</key> <true/> <key>com.apple.security.files.user-selected.read-write</key> <true/> </dict> </plist> codesign -s "3rd Party Mac Developer Application: Developer Name" myApp.app/Contents/Frameworks/QtSql.framework/ codesign -s "3rd Party Mac Developer Application: Developer Name" myApp.app/Contents/PlugIns/platforms/libqcocoa.dylib codesign --entitlements myAppEntitlements.plist -s "3rd Party Mac Developer Application: Developer Name" myApp.app codesign --display --verbose=4 myApp.app productbuild --component "myApp.app" /Applications --sign "3rd Party Mac Developer Installer: Developer Name" --product "myApp.app/Contents/Info.plist" myApp.pkg sudo installer -store -pkg myApp.pkg -target / 
version = "1.2" appName = "myApp" devName = "Developer Name" pathToQt = "/Users/_USER_NAME_/Qt5.2.0/5.2.0/clang_64/" entitlements = "myAppEntitlements.plist" # -*- coding: utf-8 -*- import os import glob import shutil from subprocess import call # Setup app info (Don't forget to change the version in the Info.plist) version = "1.2" appName = "myApp" devName = "Developer Name" pathToQt = "/Users/_USER_/Qt5.2.0/5.2.0/clang_64/" entitlements = "myAppEntitlements.plist" fullApp = appName +".app" dirName = appName + "_" + version # if we need only libqsqlite.dylib sqliteOnly = True sqldriversDir = fullApp+"/Contents/PlugIns/sqldrivers/" frameworksDir = fullApp+"/Contents/Frameworks/" pluginsDir = fullApp+"/Contents/PlugIns/" print("Prepearing to deploy...") # Check files and paths if not os.path.exists(pathToQt) or not os.path.isdir(pathToQt): print("Incorrect path to Qt") exit() if not os.path.exists(fullApp) or not os.path.isdir(fullApp): print("App bundle not found") exit() if not os.path.exists(entitlements) or os.path.isdir(entitlements): print("Entitlements file not found") exit() #remove old build if os.path.exists(dirName): shutil.rmtree(dirName) os.makedirs(dirName) # Copy all necessary files to new folder shutil.copy(entitlements, dirName) shutil.copytree(fullApp, dirName+"/"+fullApp) # Copy Qt libs for create independent app os.chdir(os.getcwd()+"/"+dirName) print("\nDeploying Qt to .app bundle...") call([pathToQt+"bin/macdeployqt", fullApp]) print("...done\n") # Other libs in Qt 5.2(at least) will be rejected from Mac App Store anyway if sqliteOnly and os.path.exists(sqldriversDir): sqllibs = glob.glob(sqldriversDir+"*.dylib") for lib in sqllibs: if os.path.basename(lib) != "libqsqlite.dylib": os.remove(lib) # Copy plists for frameworks (it's fix macdeployqt bug) frameworks = os.listdir(frameworksDir) for framework in frameworks: shutil.copy(pathToQt+"lib/"+framework+"/Contents/Info.plist", frameworksDir+framework+"/Resources/") print("\nSigning frameworks, dylibs, and binary...") # Sign frameworks (it's strange, but we can't sign "Versions" folder) os.system('codesign -s "3rd Party Mac Developer Application: '+devName+'" '+frameworksDir+"*") # Sign plugins pluginGroups = os.listdir(pluginsDir) for group in pluginGroups: os.system('codesign -s "3rd Party Mac Developer Application: '+devName+'" '+pluginsDir+group+"/*") # Sign app os.system('codesign --entitlements '+entitlements+' -s "3rd Party Mac Developer Application: '+devName+'" '+fullApp) print("\nCheck signing:") os.system("codesign --display --verbose=4 "+fullApp) # - - - print("\nBuilding package...") os.system('productbuild --component "'+fullApp+'" /Applications --sign "3rd Party Mac Developer Installer: '+devName+'" --product "'+fullApp+'/Contents/Info.plist" '+appName+'.pkg') print("...done\n") print('\nFor test install, run follow command: sudo installer -store -pkg '+dirName+'/'+appName+'.pkg -target /') Source: https://habr.com/ru/post/215971/
All Articles