Пример #1
0
def CopyQt(qtdir, qtlib, target):
    """Copy a Qt framework from qtdir to target."""
    srcdir = '%s/lib/%s.framework/Versions/5/' % (qtdir, qtlib)
    dstdir = '%s/%s.framework/' % (target, qtlib)

    # This function creates the following file, directory and symbolic links.
    #
    # QtCore.framework/Versions/5/QtCore
    # QtCore.framework/Versions/5/Resources/
    # QtCore.framwwork/QtCore@ -> Versions/5/QtCore
    # QtCore.framwwork/Resources@ -> Versions/5/Resources
    # QtCore.framework/Versions/Current -> 5

    # cp {qtdir}/lib/QtCore.framework/Versions/5/QtCore
    #    {target}/QtCore.framework/Versions/5/QtCore
    CopyFiles([srcdir + qtlib], dstdir + 'Versions/5/' + qtlib)

    # Copies Resources of QtGui
    # cp -r {qtdir}/lib/QtCore.framework/Resources
    #       {target}/QtCore.framework/Versions/5/Resources
    CopyFiles([srcdir + 'Resources'],
              dstdir + 'Versions/5/Resources',
              recursive=True)

    # ln -s 5 {target}/QtCore.framework/Versions/Current
    Symlink('5', dstdir + 'Versions/Current')

    # ln -s Versions/Current/QtCore {target}/QtCore.framework/QtCore
    Symlink('Versions/Current/' + qtlib, dstdir + qtlib)

    # ln -s Versions/Current/Resources {target}/QtCore.framework/Resources
    Symlink('Versions/Current/Resources', dstdir + 'Resources')
Пример #2
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)
Пример #3
0
def CopyQt(qtdir, qtlib, version, target, copy_resources=False):
    """Copy a Qt framework from qtdir to target."""
    framework_path = GetFrameworkPath(qtlib, version)
    CopyFiles(['%s/lib/%s' % (qtdir, framework_path)],
              '%s/%s' % (target, framework_path))

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

    if version == '4':
        # For codesign, Info.plist should be copied to Resources/.
        CopyFiles(['%s/lib/%s.framework/Contents/Info.plist' % (qtdir, qtlib)],
                  '%s/%s.framework/Resources/Info.plist' % (target, qtlib))
Пример #4
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)

    ref_to = '@executable_path/../../../ConfigDialog.app/Contents/Frameworks'

    CopyQt(qtdir, 'QtCore', '5', target, copy_resources=True)
    CopyQt(qtdir, 'QtGui', '5', target, copy_resources=True)
    CopyQt(qtdir, 'QtWidgets', '5', target, copy_resources=True)
    CopyQt(qtdir, 'QtPrintSupport', '5', target, copy_resources=True)

    ChangeReferences(qtdir, GetFrameworkPath('QtCore', '5'), '5', target,
                     ref_to)
    ChangeReferences(qtdir,
                     GetFrameworkPath('QtGui', '5'),
                     '5',
                     target,
                     ref_to,
                     references=['QtCore'])
    ChangeReferences(qtdir,
                     GetFrameworkPath('QtWidgets', '5'),
                     '5',
                     target,
                     ref_to,
                     references=['QtCore', 'QtGui'])
    ChangeReferences(qtdir,
                     GetFrameworkPath('QtPrintSupport', '5'),
                     '5',
                     target,
                     ref_to,
                     references=['QtCore', 'QtGui', 'QtWidgets'])

    libqcocoa = 'QtCore.framework/Resources/plugins/platforms/libqcocoa.dylib'
    CopyFiles(['%s/plugins/platforms/libqcocoa.dylib' % qtdir],
              '%s/%s' % (target, libqcocoa))
    ChangeReferences(
        qtdir,
        libqcocoa,
        '5',
        target,
        ref_to,
        references=['QtCore', 'QtGui', 'QtWidgets', 'QtPrintSupport'])