Made Qt frameworks reorganised only once

This commit is contained in:
Xinyu Hou 2014-11-04 15:41:36 +00:00
parent 546a40a653
commit deed8a28a2
1 changed files with 45 additions and 33 deletions

View File

@ -757,6 +757,12 @@ class InternalCommands:
raise Exception('Build command not supported with generator: ' + generator) raise Exception('Build command not supported with generator: ' + generator)
def makeGui(self, targets, args=""): def makeGui(self, targets, args=""):
name = "Synergy.app"
self.try_chdir(self.getGenerator().binDir)
if os.path.exists(name):
print "removing exisiting bundle"
shutil.rmtree(name)
self.restore_chdir()
if sys.platform == 'win32': if sys.platform == 'win32':
gui_make_cmd = self.w32_make_cmd gui_make_cmd = self.w32_make_cmd
@ -789,16 +795,49 @@ class InternalCommands:
for target in targets: for target in targets:
self.macPostMake(target) self.macPostMake(target)
self.fixQtFrameworksLayout()
def symlink(self, source, target): def symlink(self, source, target):
if not os.path.exists(target): if not os.path.exists(target):
print 'link: ', source,'-->', target
os.symlink(source, target) os.symlink(source, target)
def move(self, source, target): def move(self, source, target):
if os.path.exists(source): if os.path.exists(source):
if not os.path.exists(target): shutil.move(source, target)
print 'move: ', source,'-->', target
shutil.move(source, target) def fixQtFrameworksLayout(self):
# reorganize Qt frameworks layout on Mac 10.9.5 or later
# http://goo.gl/BFnQ8l
# QtCore example:
# QtCore.framework/
# QtCore -> Versions/Current/QtCore
# Resources -> Versions/Current/Resources
# Versions/
# Current -> 5
# 5/
# QtCore
# Resources/
# Info.plist
dir = self.getGenerator().binDir
target = dir + "/Synergy.app/Contents/Frameworks"
(major, minor) = self.getMacVersion()
for root, dirs, files in os.walk(target):
for dir in dirs:
if dir.startswith("Qt"):
if major == 10:
if minor >= 9:
self.try_chdir(target + "/" + dir +"/Versions")
self.symlink("5", "Current")
self.move("../Resources", "5")
self.restore_chdir()
self.try_chdir(target + "/" + dir)
dot = dir.find('.')
frameworkName = dir[:dot]
self.symlink("Versions/Current/" + frameworkName, frameworkName)
self.symlink("Versions/Current/Resources", "Resources")
self.restore_chdir()
def macPostMake(self, target): def macPostMake(self, target):
@ -839,22 +878,9 @@ class InternalCommands:
# TODO: auto-detect, qt can now be installed anywhere. # TODO: auto-detect, qt can now be installed anywhere.
frameworkRootDir = "/Developer/Qt5.2.1/5.2.1/clang_64/lib" frameworkRootDir = "/Developer/Qt5.2.1/5.2.1/clang_64/lib"
# copy the missing Info.plist files for the frameworks.
# reorganize Qt frameworks layout, if it is for Mac 10.9.5 or later
# http://goo.gl/BFnQ8l
# QtCore example:
# QtCore.framework/
# QtCore -> Versions/Current/QtCore
# Resources -> Versions/Current/Resources
# Versions/
# Current -> 5
# 5/
# QtCore
# Resources/
# Info.plist
target = dir + "/Synergy.app/Contents/Frameworks" target = dir + "/Synergy.app/Contents/Frameworks"
(major, minor) = self.getMacVersion()
# copy the missing Info.plist files for the frameworks.
for root, dirs, files in os.walk(target): for root, dirs, files in os.walk(target):
for dir in dirs: for dir in dirs:
if dir.startswith("Qt"): if dir.startswith("Qt"):
@ -862,20 +888,6 @@ class InternalCommands:
frameworkRootDir + "/" + dir + "/Contents/Info.plist", frameworkRootDir + "/" + dir + "/Contents/Info.plist",
target + "/" + dir + "/Resources/") target + "/" + dir + "/Resources/")
if major == 10:
if minor >= 9:
self.try_chdir(target + "/" + dir +"/Versions")
self.symlink("5", "Current")
self.move("../Resources", "5")
self.restore_chdir()
self.try_chdir(target + "/" + dir)
dot = dir.find('.')
frameworkName = dir[:dot]
self.symlink("Versions/Current/" + frameworkName, frameworkName)
self.symlink("Versions/Current/Resources", "Resources")
self.restore_chdir()
def signmac(self): def signmac(self):
self.loadConfig() self.loadConfig()
if not self.macIdentity: if not self.macIdentity: