fix
[novacoin.git] / contrib / macdeploy / macdeployqtplus
index 914edb7..7981eca 100755 (executable)
@@ -17,7 +17,8 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-import subprocess, sys, re, os, shutil, os.path
+import subprocess, sys, re, os, shutil, stat, os.path
+from string import Template
 from time import sleep
 from argparse import ArgumentParser
 
@@ -169,7 +170,12 @@ class DeploymentInfo(object):
         elif os.path.exists(os.path.join(parentDir, "share", "qt4", "translations")):
             # MacPorts layout, e.g. "/opt/local/share/qt4"
             self.qtPath = os.path.join(parentDir, "share", "qt4")
-        
+        elif os.path.exists(os.path.join(os.path.dirname(parentDir), "share", "qt4", "translations")):
+            # Newer Macports layout
+            self.qtPath = os.path.join(os.path.dirname(parentDir), "share", "qt4")
+        else:
+            self.qtPath = os.getenv("QTDIR", None)
+
         if self.qtPath is not None:
             pluginPath = os.path.join(self.qtPath, "plugins")
             if os.path.exists(pluginPath):
@@ -239,7 +245,12 @@ def runStrip(binaryPath, verbose):
     subprocess.check_call(["strip", "-x", binaryPath])
 
 def copyFramework(framework, path, verbose):
-    fromPath = framework.sourceFilePath
+    if framework.sourceFilePath.startswith("Qt"):
+        #standard place for Nokia Qt installer's frameworks
+        fromPath = "/Library/Frameworks/" + framework.sourceFilePath
+    else:
+        fromPath = framework.sourceFilePath
+
     toDir = os.path.join(path, framework.destinationDirectory)
     toPath = os.path.join(toDir, framework.binaryName)
     
@@ -256,7 +267,11 @@ def copyFramework(framework, path, verbose):
     if verbose >= 3:
         print "Copied:", fromPath
         print " to:", toPath
-    
+
+    permissions = os.stat(toPath)
+    if not permissions.st_mode & stat.S_IWRITE:
+      os.chmod(toPath, permissions.st_mode | stat.S_IWRITE)
+
     if not framework.isDylib(): # Copy resources for real frameworks
         fromResourcesDir = framework.sourceResourcesDirectory
         if os.path.exists(fromResourcesDir):
@@ -338,7 +353,7 @@ def deployPlugins(appBundleInfo, deploymentInfo, strip, verbose):
         if pluginDirectory == "designer":
             # Skip designer plugins
             continue
-        elif pluginDirectory == "phonon":
+        elif pluginDirectory == "phonon" or pluginDirectory == "phonon_backend":
             # Deploy the phonon plugins only if phonon is in use
             if not deploymentInfo.usesFramework("phonon"):
                 continue