Example #1
0
def main():
  opt = ParseOption()

  if not opt.qtdir:
    PrintErrorAndExit('--qtdir option is mandatory.')

  if not opt.target:
    PrintErrorAndExit('--target option is mandatory.')

  qtdir = os.path.abspath(opt.qtdir)
  target = os.path.abspath(opt.target)

  # Changes the reference to QtCore framework from the target application
  cmd = ["install_name_tool", "-change",
         "%s/lib/QtCore.framework/Versions/4/QtCore" % qtdir,
         "@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore",
         "%s" % target]
  RunOrDie(cmd)

  # Changes the reference to QtGui framework from the target application
  cmd = ["install_name_tool", "-change",
         "%s/lib/QtGui.framework/Versions/4/QtGui" % qtdir,
         "@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui",
         "%s" % target]
  RunOrDie(cmd)
def ChangeReferences(qtdir, path, version, target, ref_to, references=None):
    """Change the references of frameworks, by using install_name_tool."""
    del qtdir  # No longer used because the default path was changed to @rpath.

    # Change id
    cmd = [
        'install_name_tool', '-id',
        '%s/%s' % (ref_to, path),
        '%s/%s' % (target, path)
    ]
    RunOrDie(cmd)

    if not references:
        return

    # Change references
    for ref in references:
        ref_framework_path = GetFrameworkPath(ref, version)
        change_cmd = [
            'install_name_tool', '-change',
            '@rpath/%s' % ref_framework_path,
            '%s/%s' % (ref_to, ref_framework_path),
            '%s/%s' % (target, path)
        ]
        RunOrDie(change_cmd)
Example #3
0
def main():
    opt = ParseOption()

    if not opt.qtdir:
        PrintErrorAndExit('--qtdir option is mandatory.')

    if not opt.target:
        PrintErrorAndExit('--target option is mandatory.')

    qtdir = os.path.abspath(opt.qtdir)
    target = os.path.abspath(opt.target)

    # Copies QtCore.  For codesign, Info.plist should be copied to Resources/.
    CopyFiles(['%s/lib/QtCore.framework/Versions/4/QtCore' % qtdir],
              '%s/QtCore.framework/Versions/4/QtCore' % target)
    CopyFiles(['%s/lib/QtCore.framework/Contents/Info.plist' % qtdir],
              '%s/QtCore.framework/Resources/' % target)

    # Copies QtGui.  For codesign, Info.plist should be copied to Resources/.
    CopyFiles(['%s/lib/QtGui.framework/Versions/4/QtGui' % qtdir],
              '%s/QtGui.framework/Versions/4/QtGui' % target)
    CopyFiles(['%s/lib/QtGui.framework/Contents/Info.plist' % qtdir],
              '%s/QtGui.framework/Resources/' % target)

    # Copies Resources of QtGui
    CopyFiles(['%s/lib/QtGui.framework/Versions/4/Resources' % qtdir],
              '%s/QtGui.framework/Resources' % target,
              recursive=True)

    # Changes QtGui id
    cmd = [
        "install_name_tool", "-id",
        "@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui",
        "%s/QtGui.framework/Versions/4/QtGui" % target
    ]
    RunOrDie(cmd)

    # Changes QtCore id
    cmd = [
        "install_name_tool", "-id",
        "@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore",
        '%s/QtCore.framework/Versions/4/QtCore' % target
    ]
    RunOrDie(cmd)

    # Changes the reference to QtCore framework from QtGui
    cmd = [
        "install_name_tool", "-change",
        "%s/lib/QtCore.framework/Versions/4/QtCore" % qtdir,
        "@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore",
        "%s/QtGui.framework/Versions/4/QtGui" % target
    ]
    RunOrDie(cmd)
Example #4
0
def main():
    opt = ParseOption()

    if not opt.pkgproj:
        PrintErrorAndExit('--pkgproj option is mandatory.')
    pkgproj = os.path.abspath(opt.pkgproj)

    if not opt.product_dir:
        PrintErrorAndExit('--product_dir option is mandatory.')
    product_dir = os.path.abspath(opt.product_dir)

    # Make sure Packages is installed
    packagesbuild_path = ''
    if os.path.exists('/usr/local/bin/packagesbuild'):
        packagesbuild_path = '/usr/local/bin/packagesbuild'
    elif os.path.exists('/usr/bin/packagesbuild'):
        packagesbuild_path = '/usr/bin/packagesbuild'
    else:
        logging.critical('error: Cannot find "packagesbuild"')
        sys.exit(1)

    # codesign
    CodesignPackage(product_dir)

    # Build the package
    cmd = [packagesbuild_path, pkgproj]
    RunOrDie(cmd)
def ChangeReferences(path, target, ref_to, references=None):
    """Change the references of frameworks, by using install_name_tool."""
    # Change id
    cmd = [
        'install_name_tool', '-id',
        '%s/%s' % (ref_to, path),
        '%s/%s' % (target, path)
    ]
    RunOrDie(cmd)

    if not references:
        return

    # Change references
    for ref in references:
        ref_framework_path = GetFrameworkPath(ref)
        change_cmd = [
            'install_name_tool', '-change',
            '@rpath/%s' % ref_framework_path,
            '%s/%s' % (ref_to, ref_framework_path),
            '%s/%s' % (target, path)
        ]
        RunOrDie(change_cmd)
Example #6
0
def InstallNameTool(target, reference_from, reference_to):
    cmd = [
        'install_name_tool', '-change', reference_from, reference_to, target
    ]
    RunOrDie(cmd)