Ejemplo n.º 1
0
def main():
    args = get_args()
    if common.is_mac_platform():
        deploy_mac(args)
        return

    (qt_install_info, qt_install) = get_qt_install_info(args.qmake_binary)

    qtcreator_binary_path = os.path.dirname(args.qtcreator_binary)
    install_dir = os.path.abspath(os.path.join(qtcreator_binary_path, '..'))
    if common.is_linux_platform():
        qt_deploy_prefix = os.path.join(install_dir, 'lib', 'Qt')
    else:
        qt_deploy_prefix = os.path.join(install_dir, 'bin')

    chrpath_bin = None
    if common.is_linux_platform():
        chrpath_bin = which('chrpath')
        if chrpath_bin == None:
            print("Cannot find required binary 'chrpath'.")
            sys.exit(2)

    plugins = [
        'assetimporters', 'accessible', 'codecs', 'designer', 'iconengines',
        'imageformats', 'platformthemes', 'platforminputcontexts', 'platforms',
        'printsupport', 'qmltooling', 'sqldrivers', 'styles',
        'xcbglintegrations', 'wayland-decoration-client',
        'wayland-graphics-integration-client', 'wayland-shell-integration',
        'tls'
    ]

    if common.is_windows_platform():
        global debug_build
        debug_build = is_debug(args.qtcreator_binary)

    if common.is_windows_platform():
        copy_qt_libs(qt_deploy_prefix, qt_install.bin, qt_install.bin,
                     qt_install.plugins, qt_install.qml, plugins)
    else:
        copy_qt_libs(qt_deploy_prefix, qt_install.bin, qt_install.lib,
                     qt_install.plugins, qt_install.qml, plugins)
    copy_translations(install_dir, qt_install.translations)
    if args.llvm_path:
        deploy_libclang(install_dir, args.llvm_path, chrpath_bin)

    if args.elfutils_path:
        deploy_elfutils(install_dir, chrpath_bin, args)
    if not common.is_windows_platform():
        print("fixing rpaths...")
        common.fix_rpaths(install_dir, os.path.join(qt_deploy_prefix, 'lib'),
                          qt_install_info, chrpath_bin)
        add_qt_conf(os.path.join(install_dir, 'libexec', 'qtcreator'),
                    qt_deploy_prefix)  # e.g. for qml2puppet
        add_qt_conf(os.path.join(qt_deploy_prefix, 'bin'),
                    qt_deploy_prefix)  # e.g. qtdiag
    add_qt_conf(os.path.join(install_dir, 'bin'), qt_deploy_prefix)
Ejemplo n.º 2
0
def add_qt_conf(target_path, qt_prefix_path):
    qtconf_filepath = os.path.join(target_path, 'qt.conf')
    prefix_path = os.path.relpath(qt_prefix_path, target_path).replace('\\', '/')
    print('Creating qt.conf in "{0}":'.format(qtconf_filepath))
    f = open(qtconf_filepath, 'w')
    f.write('[Paths]\n')
    f.write('Prefix={0}\n'.format(prefix_path))
    f.write('Binaries={0}\n'.format('bin' if common.is_linux_platform() else '.'))
    f.write('Libraries={0}\n'.format('lib' if common.is_linux_platform() else '.'))
    f.write('Plugins=plugins\n')
    f.write('Qml2Imports=qml\n')
    f.close()
Ejemplo n.º 3
0
def add_qt_conf(target_path, qt_prefix_path):
    qtconf_filepath = os.path.join(target_path, 'qt.conf')
    prefix_path = os.path.relpath(qt_prefix_path, target_path).replace('\\', '/')
    print('Creating qt.conf in "{0}":'.format(qtconf_filepath))
    f = open(qtconf_filepath, 'w')
    f.write('[Paths]\n')
    f.write('Prefix={0}\n'.format(prefix_path))
    f.write('Binaries={0}\n'.format('bin' if common.is_linux_platform() else '.'))
    f.write('Libraries={0}\n'.format('lib' if common.is_linux_platform() else '.'))
    f.write('Plugins=plugins\n')
    f.write('Imports=imports\n')
    f.write('Qml2Imports=qml\n')
    f.close()
Ejemplo n.º 4
0
def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin):
    # contains pairs of (source, target directory)
    deployinfo = []
    resourcesource = os.path.join(llvm_install_dir, 'lib', 'clang')
    if common.is_windows_platform():
        clangbindirtarget = os.path.join(install_dir, 'bin', 'clang', 'bin')
        if not os.path.exists(clangbindirtarget):
            os.makedirs(clangbindirtarget)
        clanglibdirtarget = os.path.join(install_dir, 'bin', 'clang', 'lib')
        if not os.path.exists(clanglibdirtarget):
            os.makedirs(clanglibdirtarget)
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'libclang.dll'),
                           os.path.join(install_dir, 'bin')))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang.exe'),
                           clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang-cl.exe'),
                           clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clangd.exe'),
                           clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang-tidy.exe'),
                           clangbindirtarget))
        resourcetarget = os.path.join(clanglibdirtarget, 'clang')
    else:
        libsources = glob(os.path.join(llvm_install_dir, 'lib', 'libclang.so*'))
        for libsource in libsources:
            deployinfo.append((libsource, os.path.join(install_dir, 'lib', 'qtcreator')))
        clangbinary = os.path.join(llvm_install_dir, 'bin', 'clang')
        clangdbinary = os.path.join(llvm_install_dir, 'bin', 'clangd')
        clangtidybinary = os.path.join(llvm_install_dir, 'bin', 'clang-tidy')
        clangbinary_targetdir = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'bin')
        if not os.path.exists(clangbinary_targetdir):
            os.makedirs(clangbinary_targetdir)
        deployinfo.append((clangbinary, clangbinary_targetdir))
        deployinfo.append((clangdbinary, clangbinary_targetdir))
        deployinfo.append((clangtidybinary, clangbinary_targetdir))
        # copy link target if clang is actually a symlink
        if os.path.islink(clangbinary):
            linktarget = os.readlink(clangbinary)
            deployinfo.append((os.path.join(os.path.dirname(clangbinary), linktarget),
                               os.path.join(clangbinary_targetdir, linktarget)))
        resourcetarget = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'lib', 'clang')

    print("copying libclang...")
    for source, target in deployinfo:
        print(source, '->', target)
        copyPreservingLinks(source, target)

    if common.is_linux_platform():
        # libclang was statically compiled, so there is no need for the RPATHs
        # and they are confusing when fixing RPATHs later in the process
        print("removing libclang RPATHs...")
        for source, target in deployinfo:
            if not os.path.islink(target):
                targetfilepath = target if not os.path.isdir(target) else os.path.join(target, os.path.basename(source))
                subprocess.check_call([chrpath_bin, '-d', targetfilepath])

    print(resourcesource, '->', resourcetarget)
    if (os.path.exists(resourcetarget)):
        shutil.rmtree(resourcetarget)
    common.copytree(resourcesource, resourcetarget, symlinks=True)
Ejemplo n.º 5
0
def deploy_elfutils(qtc_install_dir, chrpath_bin, args):
    if common.is_mac_platform():
        return

    def lib_name(name, version):
        return ('lib' + name + '.so.' +
                version if common.is_linux_platform() else name + '.dll')

    version = '1'
    libs = ['elf', 'dw']
    elfutils_lib_path = os.path.join(args.elfutils_path, 'lib')
    if common.is_linux_platform():
        install_path = os.path.join(qtc_install_dir, 'lib', 'elfutils')
        backends_install_path = install_path
    elif common.is_windows_platform():
        install_path = os.path.join(qtc_install_dir, 'bin')
        backends_install_path = os.path.join(qtc_install_dir, 'lib',
                                             'elfutils')
        libs.append('eu_compat')
    if not os.path.exists(install_path):
        os.makedirs(install_path)
    if not os.path.exists(backends_install_path):
        os.makedirs(backends_install_path)
    # copy main libs
    libs = [
        os.path.join(elfutils_lib_path, lib_name(lib, version)) for lib in libs
    ]
    for lib in libs:
        print(lib, '->', install_path)
        shutil.copy(lib, install_path)
    # fix rpath
    if common.is_linux_platform():
        relative_path = os.path.relpath(backends_install_path, install_path)
        subprocess.check_call([
            chrpath_bin, '-r',
            os.path.join('$ORIGIN', relative_path),
            os.path.join(install_path, lib_name('dw', version))
        ])
    # copy backend files
    # only non-versioned, we never dlopen the versioned ones
    files = glob(os.path.join(elfutils_lib_path, 'elfutils', '*ebl_*.*'))
    versioned_files = glob(
        os.path.join(elfutils_lib_path, 'elfutils', '*ebl_*.*-*.*.*'))
    unversioned_files = [file for file in files if file not in versioned_files]
    for file in unversioned_files:
        print(file, '->', backends_install_path)
        shutil.copy(file, backends_install_path)
Ejemplo n.º 6
0
def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin):
    # contains pairs of (source, target directory)
    deployinfo = []
    resourcesource = os.path.join(llvm_install_dir, 'lib', 'clang')
    if common.is_windows_platform():
        clangbindirtarget = os.path.join(install_dir, 'bin', 'clang', 'bin')
        if not os.path.exists(clangbindirtarget):
            os.makedirs(clangbindirtarget)
        clanglibdirtarget = os.path.join(install_dir, 'bin', 'clang', 'lib')
        if not os.path.exists(clanglibdirtarget):
            os.makedirs(clanglibdirtarget)
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'libclang.dll'),
                           os.path.join(install_dir, 'bin')))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang.exe'),
                           clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang-cl.exe'),
                           clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clangd.exe'),
                           clangbindirtarget))
        resourcetarget = os.path.join(clanglibdirtarget, 'clang')
    else:
        libsources = glob(os.path.join(llvm_install_dir, 'lib', 'libclang.so*'))
        for libsource in libsources:
            deployinfo.append((libsource, os.path.join(install_dir, 'lib', 'qtcreator')))
        clangbinary = os.path.join(llvm_install_dir, 'bin', 'clang')
        clangdbinary = os.path.join(llvm_install_dir, 'bin', 'clangd')
        clangbinary_targetdir = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'bin')
        if not os.path.exists(clangbinary_targetdir):
            os.makedirs(clangbinary_targetdir)
        deployinfo.append((clangbinary, clangbinary_targetdir))
        deployinfo.append((clangdbinary, clangbinary_targetdir))
        # copy link target if clang is actually a symlink
        if os.path.islink(clangbinary):
            linktarget = os.readlink(clangbinary)
            deployinfo.append((os.path.join(os.path.dirname(clangbinary), linktarget),
                               os.path.join(clangbinary_targetdir, linktarget)))
        resourcetarget = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'lib', 'clang')

    print("copying libclang...")
    for source, target in deployinfo:
        print(source, '->', target)
        copyPreservingLinks(source, target)

    if common.is_linux_platform():
        # libclang was statically compiled, so there is no need for the RPATHs
        # and they are confusing when fixing RPATHs later in the process
        print("removing libclang RPATHs...")
        for source, target in deployinfo:
            if not os.path.islink(target):
                targetfilepath = target if not os.path.isdir(target) else os.path.join(target, os.path.basename(source))
                subprocess.check_call([chrpath_bin, '-d', targetfilepath])

    print(resourcesource, '->', resourcetarget)
    if (os.path.exists(resourcetarget)):
        shutil.rmtree(resourcetarget)
    common.copytree(resourcesource, resourcetarget, symlinks=True)
Ejemplo n.º 7
0
def parse_arguments():
    parser = argparse.ArgumentParser(description="Deploy and 7z a directory of plugins.")
    parser.add_argument('--7z', help='path to 7z binary',
        default='7z.exe' if common.is_windows_platform() else '7z',
        metavar='<7z_binary>', dest='sevenzip')
    parser.add_argument('--qmake_binary', help='path to qmake binary which was used for compilation',
        required=common.is_linux_platform(), metavar='<qmake_binary>')
    parser.add_argument('source_directory', help='directory to deploy and 7z')
    parser.add_argument('target_file', help='target file path of the resulting 7z')
    return parser.parse_args()
Ejemplo n.º 8
0
def add_qt_conf(target_path, qt_prefix_path):
    qtconf_filepath = os.path.join(target_path, 'qt.conf')
    prefix_path = os.path.relpath(qt_prefix_path, target_path).replace('\\', '/')
    print('Creating qt.conf in "{0}":'.format(qtconf_filepath))
    f = open(qtconf_filepath, 'w')
    f.write('[Paths]\n')
    f.write('Prefix={0}\n'.format(prefix_path))
    if common.is_linux_platform():
        f.write('Libraries=lib\n')
    f.write('Plugins=plugins\n')
    f.close()
Ejemplo n.º 9
0
def parse_arguments():
    parser = argparse.ArgumentParser(
        description="Deploy and 7z a directory of plugins.")
    parser.add_argument(
        '--7z',
        help='path to 7z binary',
        default='7z.exe' if common.is_windows_platform() else '7z',
        metavar='<7z_binary>',
        dest='sevenzip')
    parser.add_argument(
        '--qmake_binary',
        help='path to qmake binary which was used for compilation',
        required=common.is_linux_platform(),
        metavar='<qmake_binary>')
    parser.add_argument('source_directory', help='directory to deploy and 7z')
    parser.add_argument('target_file',
                        help='target file path of the resulting 7z')
    return parser.parse_args()
Ejemplo n.º 10
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], 'hi', ['help', 'ignore-errors'])
    except getopt.GetoptError:
        usage()
        sys.exit(2)
    for o, _ in opts:
        if o in ('-h', '--help'):
            usage()
            sys.exit(0)
        if o in ('-i', '--ignore-errors'):
            global ignoreErrors
            ignoreErrors = True
            print "Note: Ignoring all errors"

    if len(args) < 1:
        usage()
        sys.exit(2)

    install_dir = args[0]
    if common.is_linux_platform():
        qt_deploy_prefix = os.path.join(install_dir, 'lib', 'Qt')
    else:
        qt_deploy_prefix = os.path.join(install_dir, 'bin')
    qmake_bin = 'qmake'
    if len(args) > 1:
        qmake_bin = args[1]
    qmake_bin = which(qmake_bin)

    if qmake_bin == None:
        print "Cannot find required binary 'qmake'."
        sys.exit(2)

    chrpath_bin = None
    if common.is_linux_platform():
        chrpath_bin = which('chrpath')
        if chrpath_bin == None:
            print "Cannot find required binary 'chrpath'."
            sys.exit(2)

    qt_install_info = common.get_qt_install_info(qmake_bin)
    QT_INSTALL_LIBS = qt_install_info['QT_INSTALL_LIBS']
    QT_INSTALL_BINS = qt_install_info['QT_INSTALL_BINS']
    QT_INSTALL_PLUGINS = qt_install_info['QT_INSTALL_PLUGINS']
    QT_INSTALL_IMPORTS = qt_install_info['QT_INSTALL_IMPORTS']
    QT_INSTALL_QML = ""
    QT_INSTALL_TRANSLATIONS = qt_install_info['QT_INSTALL_TRANSLATIONS']

    plugins = ['egldeviceintegrations', 'iconengines', 'imageformats', 'platforms', 'printsupport', 'sqldrivers', 'xcbglintegrations']
    imports = ['Qt', 'QtWebKit']

    if common.is_windows_platform():
        global debug_build
        debug_build = is_debug_build(install_dir)

    if common.is_windows_platform():
        copy_qt_libs(qt_deploy_prefix, QT_INSTALL_BINS, QT_INSTALL_PLUGINS, QT_INSTALL_IMPORTS, QT_INSTALL_QML, plugins, imports)
    else:
        copy_qt_libs(qt_deploy_prefix, QT_INSTALL_LIBS, QT_INSTALL_PLUGINS, QT_INSTALL_IMPORTS, QT_INSTALL_QML, plugins, imports)
    if "LLVM_INSTALL_DIR" in os.environ:
        deploy_libclang(install_dir, os.environ["LLVM_INSTALL_DIR"], chrpath_bin)

    if not common.is_windows_platform():
        print "fixing rpaths..."
        common.fix_rpaths(install_dir, os.path.join(qt_deploy_prefix, 'lib'), qt_install_info, chrpath_bin)
    add_qt_conf(os.path.join(install_dir, 'bin'), qt_deploy_prefix)
Ejemplo n.º 11
0
##
#############################################################################

import argparse
import os
import subprocess
import sys

import common

def parse_arguments():
    parser = argparse.ArgumentParser(description="Deploy and 7z a directory of plugins.")
    parser.add_argument('--7z', help='path to 7z binary',
        default='7z.exe' if common.is_windows_platform() else '7z',
        metavar='<7z_binary>', dest='sevenzip')
    parser.add_argument('--qmake_binary', help='path to qmake binary which was used for compilation',
        required=common.is_linux_platform(), metavar='<qmake_binary>')
    parser.add_argument('source_directory', help='directory to deploy and 7z')
    parser.add_argument('target_file', help='target file path of the resulting 7z')
    return parser.parse_args()

if __name__ == "__main__":
    arguments = parse_arguments()
    if common.is_linux_platform():
        qt_install_info = common.get_qt_install_info(arguments.qmake_binary)
        common.fix_rpaths(arguments.source_directory,
                          os.path.join(arguments.source_directory, 'lib', 'Qt', 'lib'),
                          qt_install_info)
    subprocess.check_call([arguments.sevenzip, 'a', '-mx9', arguments.target_file,
        os.path.join(arguments.source_directory, '*')])
Ejemplo n.º 12
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], 'hi',
                                       ['help', 'ignore-errors'])
    except getopt.GetoptError:
        usage()
        sys.exit(2)
    for o, _ in opts:
        if o in ('-h', '--help'):
            usage()
            sys.exit(0)
        if o in ('-i', '--ignore-errors'):
            global ignoreErrors
            ignoreErrors = True
            print("Note: Ignoring all errors")

    slaq_binary = os.path.abspath(args[0])
    if common.is_windows_platform(
    ) and not slaq_binary.lower().endswith(".exe"):
        slaq_binary = slaq_binary + ".exe"

    if len(args) < 1 or not os.path.isfile(slaq_binary):
        usage()
        sys.exit(2)

    slaq_binary_path = os.path.dirname(slaq_binary)
    install_dir = os.path.abspath(slaq_binary_path)
    qt_deploy_prefix = install_dir
    qmake_bin = 'qmake'
    if len(args) > 1:
        qmake_bin = args[1]
    qmake_bin = which(qmake_bin)

    if qmake_bin == None:
        print("Cannot find required binary 'qmake'.")
        sys.exit(2)

    chrpath_bin = None
    if common.is_linux_platform():
        chrpath_bin = which('chrpath')
        if chrpath_bin == None:
            print("Cannot find required binary 'chrpath'.")
            sys.exit(2)

    qt_install_info = common.get_qt_install_info(qmake_bin)
    QT_INSTALL_LIBS = qt_install_info['QT_INSTALL_LIBS']
    QT_INSTALL_BINS = qt_install_info['QT_INSTALL_BINS']
    QT_INSTALL_PLUGINS = qt_install_info['QT_INSTALL_PLUGINS']
    QT_INSTALL_IMPORTS = qt_install_info['QT_INSTALL_IMPORTS']
    QT_INSTALL_QML = qt_install_info['QT_INSTALL_QML']

    plugins = [
        'codecs', 'audio', 'imageformats', 'platformthemes', 'mediaservice',
        'platforms', 'bearer', 'xcbglintegrations'
    ]
    imports = ['Qt']
    qmlimports = [
        'Qt', 'QtQuick', 'QtQml', 'QtMultimedia', 'QtGraphicalEffects',
        'QtQuick.2', 'QtWebEngine'
    ]
    extralibs = ['libstdc++.so']

    if common.is_windows_platform():
        libraries = []
        copy_libs(qt_deploy_prefix, QT_INSTALL_PLUGINS, QT_INSTALL_IMPORTS,
                  QT_INSTALL_QML, plugins, imports, qmlimports, libraries)
    else:
        lddlibs = common.ldd([slaq_binary])
        libraries = [
            lib for lib in lddlibs
            if QT_INSTALL_LIBS in lib or any(s in lib for s in extralibs)
        ]
        #add extra lib no included in ldd
        libraries.append(os.path.join(QT_INSTALL_LIBS, "libQt5XcbQpa.so.5"))
        libraries.append(os.path.join(QT_INSTALL_LIBS, "libQt5DBus.so.5"))
        copy_libs(qt_deploy_prefix, QT_INSTALL_PLUGINS, QT_INSTALL_IMPORTS,
                  QT_INSTALL_QML, plugins, imports, qmlimports, libraries)

    if not common.is_windows_platform():
        print("fixing rpaths...")
        common.fix_rpaths(install_dir, os.path.join(qt_deploy_prefix, 'lib'),
                          qt_install_info, chrpath_bin)
    add_qt_conf(install_dir, qt_deploy_prefix)
Ejemplo n.º 13
0
def build_qtcreator(args, paths):
    if not os.path.exists(paths.build):
        os.makedirs(paths.build)
    prefix_paths = [paths.qt]
    if args.llvm_path:
        prefix_paths += [args.llvm_path]
    if args.elfutils_path:
        prefix_paths += [args.elfutils_path]
    build_type = 'Debug' if args.debug else 'Release'
    with_docs_str = 'OFF' if args.no_docs else 'ON'
    cmake_args = [
        'cmake', '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths),
        '-DCMAKE_BUILD_TYPE=' + build_type, '-DWITH_DOCS=' + with_docs_str,
        '-DBUILD_DEVELOPER_DOCS=' + with_docs_str,
        '-DBUILD_EXECUTABLE_SDKTOOL=OFF',
        '-DCMAKE_INSTALL_PREFIX=' + paths.install, '-DWITH_TESTS=OFF', '-G',
        'Ninja'
    ]

    if args.python3:
        cmake_args += ['-DPYTHON_EXECUTABLE=' + args.python3]

    # force MSVC on Windows, because it looks for GCC in the PATH first,
    # even if MSVC is first mentioned in the PATH...
    # TODO would be nicer if we only did this if cl.exe is indeed first in the PATH
    if common.is_windows_platform():
        cmake_args += [
            '-DCMAKE_C_COMPILER=cl', '-DCMAKE_CXX_COMPILER=cl',
            '-DBUILD_EXECUTABLE_WIN32INTERRUPT=OFF',
            '-DBUILD_EXECUTABLE_WIN64INTERRUPT=OFF',
            '-DBUILD_LIBRARY_QTCREATORCDBEXT=OFF'
        ]
        if args.python_path:
            python_library = glob.glob(
                os.path.join(args.python_path, 'libs', 'python??.lib'))
            if python_library:
                cmake_args += [
                    '-DPYTHON_LIBRARY=' + python_library[0],
                    '-DPYTHON_INCLUDE_DIR=' +
                    os.path.join(args.python_path, 'include')
                ]

    # TODO this works around a CMake bug https://gitlab.kitware.com/cmake/cmake/issues/20119
    if common.is_linux_platform():
        cmake_args += ['-DBUILD_WITH_PCH=OFF']

    ide_revision = common.get_commit_SHA(paths.src)
    if ide_revision:
        cmake_args += [
            '-DIDE_REVISION=ON', '-DIDE_REVISION_STR=' + ide_revision,
            '-DIDE_REVISION_URL_STR=https://code.qt.io/cgit/qt-creator/qt-creator.git/log/?id='
            + ide_revision
        ]

    common.check_print_call(cmake_args + [paths.src], paths.build)
    common.check_print_call(['cmake', '--build', '.'], paths.build)
    if not args.no_docs:
        common.check_print_call(['cmake', '--build', '.', '--target', 'docs'],
                                paths.build)

    common.check_print_call(
        ['cmake', '--install', '.', '--prefix', paths.install, '--strip'],
        paths.build)
    common.check_print_call([
        'cmake', '--install', '.', '--prefix', paths.dev_install,
        '--component', 'Devel'
    ], paths.build)
Ejemplo n.º 14
0
        description="Deploy and 7z a directory of plugins.")
    parser.add_argument(
        '--7z',
        help='path to 7z binary',
        default='7z.exe' if common.is_windows_platform() else '7z',
        metavar='<7z_binary>',
        dest='sevenzip')
    parser.add_argument(
        '--qmake_binary',
        help='path to qmake binary which was used for compilation',
        required=common.is_linux_platform(),
        metavar='<qmake_binary>')
    parser.add_argument('source_directory', help='directory to deploy and 7z')
    parser.add_argument('target_file',
                        help='target file path of the resulting 7z')
    return parser.parse_args()


if __name__ == "__main__":
    arguments = parse_arguments()
    if common.is_linux_platform():
        qt_install_info = common.get_qt_install_info(arguments.qmake_binary)
        common.fix_rpaths(
            arguments.source_directory,
            os.path.join(arguments.source_directory, 'lib', 'qtcreator'),
            qt_install_info)
    subprocess.check_call([
        arguments.sevenzip, 'a', '-mx9', arguments.target_file,
        os.path.join(arguments.source_directory, '*')
    ])
Ejemplo n.º 15
0
def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin):
    # contains pairs of (source, target directory)
    deployinfo = []
    resourcesource = os.path.join(llvm_install_dir, 'lib', 'clang')
    if common.is_windows_platform():
        clangbindirtarget = os.path.join(install_dir, 'bin', 'clang', 'bin')
        if not os.path.exists(clangbindirtarget):
            os.makedirs(clangbindirtarget)
        clanglibdirtarget = os.path.join(install_dir, 'bin', 'clang', 'lib')
        if not os.path.exists(clanglibdirtarget):
            os.makedirs(clanglibdirtarget)
        deployinfo.append(
            (os.path.join(llvm_install_dir, 'bin',
                          'libclang.dll'), os.path.join(install_dir, 'bin')))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin',
                                        'clang.exe'), clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin',
                                        'clang-cl.exe'), clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin',
                                        'clangd.exe'), clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin',
                                        'clang-tidy.exe'), clangbindirtarget))
        deployinfo.append(
            (os.path.join(llvm_install_dir, 'bin',
                          'clazy-standalone.exe'), clangbindirtarget))
        resourcetarget = os.path.join(clanglibdirtarget, 'clang')
    else:
        # libclang -> Qt Creator libraries
        libsources = glob(os.path.join(llvm_install_dir, 'lib',
                                       'libclang.so*'))
        for libsource in libsources:
            deployinfo.append(
                (libsource, os.path.join(install_dir, 'lib', 'qtcreator')))
        # clang binaries -> clang libexec
        clangbinary_targetdir = os.path.join(install_dir, 'libexec',
                                             'qtcreator', 'clang', 'bin')
        if not os.path.exists(clangbinary_targetdir):
            os.makedirs(clangbinary_targetdir)
        for binary in ['clang', 'clangd', 'clang-tidy', 'clazy-standalone']:
            binary_filepath = os.path.join(llvm_install_dir, 'bin', binary)
            deployinfo.append((binary_filepath, clangbinary_targetdir))
            # add link target if binary is actually a symlink (to a binary in the same directory)
            if os.path.islink(binary_filepath):
                linktarget = os.readlink(binary_filepath)
                deployinfo.append(
                    (os.path.join(os.path.dirname(binary_filepath),
                                  linktarget),
                     os.path.join(clangbinary_targetdir, linktarget)))
        clanglibs_targetdir = os.path.join(install_dir, 'libexec', 'qtcreator',
                                           'clang', 'lib')
        # support libraries (for clazy) -> clang libexec
        if not os.path.exists(clanglibs_targetdir):
            os.makedirs(clanglibs_targetdir)
        for lib_pattern in ['ClazyPlugin.so', 'libclang-cpp.so*']:
            for lib in glob(os.path.join(llvm_install_dir, 'lib',
                                         lib_pattern)):
                deployinfo.append((lib, clanglibs_targetdir))
        resourcetarget = os.path.join(install_dir, 'libexec', 'qtcreator',
                                      'clang', 'lib', 'clang')

    print("copying libclang...")
    for source, target in deployinfo:
        print(source, '->', target)
        copyPreservingLinks(source, target)

    if common.is_linux_platform():
        # libclang was statically compiled, so there is no need for the RPATHs
        # and they are confusing when fixing RPATHs later in the process.
        # Also fix clazy-standalone RPATH.
        print("fixing Clang RPATHs...")
        for source, target in deployinfo:
            filename = os.path.basename(source)
            targetfilepath = target if not os.path.isdir(
                target) else os.path.join(target, filename)
            if filename == 'clazy-standalone':
                subprocess.check_call(
                    [chrpath_bin, '-r', '$ORIGIN/../lib', targetfilepath])
            elif not os.path.islink(target):
                targetfilepath = target if not os.path.isdir(
                    target) else os.path.join(target, os.path.basename(source))
                subprocess.check_call([chrpath_bin, '-d', targetfilepath])

    print(resourcesource, '->', resourcetarget)
    if (os.path.exists(resourcetarget)):
        shutil.rmtree(resourcetarget)
    common.copytree(resourcesource, resourcetarget, symlinks=True)
Ejemplo n.º 16
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], 'hi',
                                       ['help', 'ignore-errors'])
    except getopt.GetoptError:
        usage()
        sys.exit(2)
    for o, _ in opts:
        if o in ('-h', '--help'):
            usage()
            sys.exit(0)
        if o in ('-i', '--ignore-errors'):
            global ignoreErrors
            ignoreErrors = True
            print("Note: Ignoring all errors")

    qtcreator_binary = os.path.abspath(args[0])
    if common.is_windows_platform(
    ) and not qtcreator_binary.lower().endswith(".exe"):
        qtcreator_binary = qtcreator_binary + ".exe"

    if len(args) < 1 or not os.path.isfile(qtcreator_binary):
        usage()
        sys.exit(2)

    qtcreator_binary_path = os.path.dirname(qtcreator_binary)
    install_dir = os.path.abspath(os.path.join(qtcreator_binary_path, '..'))
    if common.is_linux_platform():
        qt_deploy_prefix = os.path.join(install_dir, 'lib', 'Qt')
    else:
        qt_deploy_prefix = os.path.join(install_dir, 'bin')
    qmake_bin = 'qmake'
    if len(args) > 1:
        qmake_bin = args[1]
    qmake_bin = which(qmake_bin)

    if qmake_bin == None:
        print("Cannot find required binary 'qmake'.")
        sys.exit(2)

    chrpath_bin = None
    if common.is_linux_platform():
        chrpath_bin = which('chrpath')
        if chrpath_bin == None:
            print("Cannot find required binary 'chrpath'.")
            sys.exit(2)

    qt_install_info = common.get_qt_install_info(qmake_bin)
    QT_INSTALL_LIBS = qt_install_info['QT_INSTALL_LIBS']
    QT_INSTALL_BINS = qt_install_info['QT_INSTALL_BINS']
    QT_INSTALL_PLUGINS = qt_install_info['QT_INSTALL_PLUGINS']
    QT_INSTALL_IMPORTS = qt_install_info['QT_INSTALL_IMPORTS']
    QT_INSTALL_QML = qt_install_info['QT_INSTALL_QML']
    QT_INSTALL_TRANSLATIONS = qt_install_info['QT_INSTALL_TRANSLATIONS']

    plugins = [
        'accessible',
        'codecs',
        'designer',
        'iconengines',
        'imageformats',
        'platformthemes',
        'platforminputcontexts',
        'platforms',
        'printsupport',
        'qmltooling',
        'sqldrivers',
        'styles',
        'xcbglintegrations',
        'wayland-decoration-client',
        'wayland-graphics-integration-client',
        'wayland-shell-integration',
    ]
    imports = ['Qt', 'QtWebKit']

    if common.is_windows_platform():
        global debug_build
        debug_build = is_debug(qtcreator_binary)

    if common.is_windows_platform():
        copy_qt_libs(qt_deploy_prefix, QT_INSTALL_BINS, QT_INSTALL_BINS,
                     QT_INSTALL_PLUGINS, QT_INSTALL_IMPORTS, QT_INSTALL_QML,
                     plugins, imports)
    else:
        copy_qt_libs(qt_deploy_prefix, QT_INSTALL_BINS, QT_INSTALL_LIBS,
                     QT_INSTALL_PLUGINS, QT_INSTALL_IMPORTS, QT_INSTALL_QML,
                     plugins, imports)
    copy_translations(install_dir, QT_INSTALL_TRANSLATIONS)
    if "LLVM_INSTALL_DIR" in os.environ:
        deploy_libclang(install_dir, os.environ["LLVM_INSTALL_DIR"],
                        chrpath_bin)

    if not common.is_windows_platform():
        print("fixing rpaths...")
        common.fix_rpaths(install_dir, os.path.join(qt_deploy_prefix, 'lib'),
                          qt_install_info, chrpath_bin)
        add_qt_conf(os.path.join(install_dir, 'libexec', 'qtcreator'),
                    qt_deploy_prefix)  # e.g. for qml2puppet
        add_qt_conf(os.path.join(qt_deploy_prefix, 'bin'),
                    qt_deploy_prefix)  # e.g. qtdiag
    add_qt_conf(os.path.join(install_dir, 'bin'), qt_deploy_prefix)
Ejemplo n.º 17
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], 'hi', ['help', 'ignore-errors'])
    except getopt.GetoptError:
        usage()
        sys.exit(2)
    for o, _ in opts:
        if o in ('-h', '--help'):
            usage()
            sys.exit(0)
        if o in ('-i', '--ignore-errors'):
            global ignoreErrors
            ignoreErrors = True
            print("Note: Ignoring all errors")

    qtcreator_binary = os.path.abspath(args[0])
    if common.is_windows_platform() and not qtcreator_binary.lower().endswith(".exe"):
        qtcreator_binary = qtcreator_binary + ".exe"

    if len(args) < 1 or not os.path.isfile(qtcreator_binary):
        usage()
        sys.exit(2)

    qtcreator_binary_path = os.path.dirname(qtcreator_binary)
    install_dir = os.path.abspath(os.path.join(qtcreator_binary_path, '..'))
    if common.is_linux_platform():
        qt_deploy_prefix = os.path.join(install_dir, 'lib', 'Qt')
    else:
        qt_deploy_prefix = os.path.join(install_dir, 'bin')
    qmake_bin = 'qmake'
    if len(args) > 1:
        qmake_bin = args[1]
    qmake_bin = which(qmake_bin)

    if qmake_bin == None:
        print("Cannot find required binary 'qmake'.")
        sys.exit(2)

    chrpath_bin = None
    if common.is_linux_platform():
        chrpath_bin = which('chrpath')
        if chrpath_bin == None:
            print("Cannot find required binary 'chrpath'.")
            sys.exit(2)

    qt_install_info = common.get_qt_install_info(qmake_bin)
    QT_INSTALL_LIBS = qt_install_info['QT_INSTALL_LIBS']
    QT_INSTALL_BINS = qt_install_info['QT_INSTALL_BINS']
    QT_INSTALL_PLUGINS = qt_install_info['QT_INSTALL_PLUGINS']
    QT_INSTALL_IMPORTS = qt_install_info['QT_INSTALL_IMPORTS']
    QT_INSTALL_QML = qt_install_info['QT_INSTALL_QML']
    QT_INSTALL_TRANSLATIONS = qt_install_info['QT_INSTALL_TRANSLATIONS']

    plugins = ['accessible', 'codecs', 'designer', 'iconengines', 'imageformats', 'platformthemes',
               'platforminputcontexts', 'platforms', 'printsupport', 'qmltooling', 'sqldrivers', 'styles',
               'xcbglintegrations',
               'wayland-decoration-client',
               'wayland-graphics-integration-client',
               'wayland-shell-integration',
               ]
    imports = ['Qt', 'QtWebKit']

    if common.is_windows_platform():
        global debug_build
        debug_build = is_debug(qtcreator_binary)

    if common.is_windows_platform():
        copy_qt_libs(qt_deploy_prefix, QT_INSTALL_BINS, QT_INSTALL_BINS, QT_INSTALL_PLUGINS, QT_INSTALL_IMPORTS, QT_INSTALL_QML, plugins, imports)
    else:
        copy_qt_libs(qt_deploy_prefix, QT_INSTALL_BINS, QT_INSTALL_LIBS, QT_INSTALL_PLUGINS, QT_INSTALL_IMPORTS, QT_INSTALL_QML, plugins, imports)
    copy_translations(install_dir, QT_INSTALL_TRANSLATIONS)
    if "LLVM_INSTALL_DIR" in os.environ:
        deploy_libclang(install_dir, os.environ["LLVM_INSTALL_DIR"], chrpath_bin)

    if not common.is_windows_platform():
        print("fixing rpaths...")
        common.fix_rpaths(install_dir, os.path.join(qt_deploy_prefix, 'lib'), qt_install_info, chrpath_bin)
        add_qt_conf(os.path.join(install_dir, 'libexec', 'qtcreator'), qt_deploy_prefix) # e.g. for qml2puppet
        add_qt_conf(os.path.join(qt_deploy_prefix, 'bin'), qt_deploy_prefix) # e.g. qtdiag
    add_qt_conf(os.path.join(install_dir, 'bin'), qt_deploy_prefix)
Ejemplo n.º 18
0
 def lib_name(name, version):
     return ('lib' + name + '.so.' +
             version if common.is_linux_platform() else name + '.dll')
Ejemplo n.º 19
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], 'hi', ['help', 'ignore-errors'])
    except getopt.GetoptError:
        usage()
        sys.exit(2)
    for o, _ in opts:
        if o in ('-h', '--help'):
            usage()
            sys.exit(0)
        if o in ('-i', '--ignore-errors'):
            global ignoreErrors
            ignoreErrors = True
            print "Note: Ignoring all errors"

    if len(args) < 1:
        usage()
        sys.exit(2)

    install_dir = args[0]
    if common.is_linux_platform():
        qt_deploy_prefix = os.path.join(install_dir, 'lib', 'Qt')
    else:
        qt_deploy_prefix = os.path.join(install_dir, 'bin')
    qmake_bin = 'qmake'
    if len(args) > 1:
        qmake_bin = args[1]
    qmake_bin = which(qmake_bin)

    if qmake_bin == None:
        print "Cannot find required binary 'qmake'."
        sys.exit(2)

    chrpath_bin = None
    if common.is_linux_platform():
        chrpath_bin = which('chrpath')
        if chrpath_bin == None:
            print "Cannot find required binary 'chrpath'."
            sys.exit(2)

    qt_install_info = common.get_qt_install_info(qmake_bin)
    QT_INSTALL_LIBS = qt_install_info['QT_INSTALL_LIBS']
    QT_INSTALL_BINS = qt_install_info['QT_INSTALL_BINS']
    QT_INSTALL_PLUGINS = qt_install_info['QT_INSTALL_PLUGINS']
    QT_INSTALL_IMPORTS = qt_install_info['QT_INSTALL_IMPORTS']
    #OPENMV-DIFF#
    #QT_INSTALL_QML = qt_install_info['QT_INSTALL_QML']
    #OPENMV-DIFF#
    QT_INSTALL_QML = ""
    #OPENMV-DIFF#
    QT_INSTALL_TRANSLATIONS = qt_install_info['QT_INSTALL_TRANSLATIONS']

    #OPENMV-DIFF#
    #plugins = ['accessible', 'codecs', 'designer', 'iconengines', 'imageformats', 'platformthemes', 'platforminputcontexts', 'platforms', 'printsupport', 'sqldrivers', 'xcbglintegrations']
    #OPENMV-DIFF#
    plugins = ['egldeviceintegrations', 'iconengines', 'imageformats', 'platforms', 'printsupport', 'sqldrivers', 'xcbglintegrations']
    #OPENMV-DIFF#
    imports = ['Qt', 'QtWebKit']

    if common.is_windows_platform():
        global debug_build
        debug_build = is_debug_build(install_dir)

    if common.is_windows_platform():
        copy_qt_libs(qt_deploy_prefix, QT_INSTALL_BINS, QT_INSTALL_PLUGINS, QT_INSTALL_IMPORTS, QT_INSTALL_QML, plugins, imports)
    else:
        copy_qt_libs(qt_deploy_prefix, QT_INSTALL_LIBS, QT_INSTALL_PLUGINS, QT_INSTALL_IMPORTS, QT_INSTALL_QML, plugins, imports)
    copy_translations(install_dir, QT_INSTALL_TRANSLATIONS)
    if "LLVM_INSTALL_DIR" in os.environ:
        deploy_libclang(install_dir, os.environ["LLVM_INSTALL_DIR"], chrpath_bin)

    if not common.is_windows_platform():
        print "fixing rpaths..."
        common.fix_rpaths(install_dir, os.path.join(qt_deploy_prefix, 'lib'), qt_install_info, chrpath_bin)
        #OPENMV-DIFF#
        #add_qt_conf(os.path.join(install_dir, 'libexec', 'qtcreator'), qt_deploy_prefix) # e.g. for qml2puppet
        #OPENMV-DIFF#
    add_qt_conf(os.path.join(install_dir, 'bin'), qt_deploy_prefix)
Ejemplo n.º 20
0
def main():
    args = get_args()

    qtcreator_binary_path = os.path.dirname(args.qtcreator_binary)
    install_dir = os.path.abspath(os.path.join(qtcreator_binary_path, '..'))
    if common.is_linux_platform():
        qt_deploy_prefix = os.path.join(install_dir, 'lib', 'Qt')
    else:
        qt_deploy_prefix = os.path.join(install_dir, 'bin')

    chrpath_bin = None
    if common.is_linux_platform():
        chrpath_bin = which('chrpath')
        if chrpath_bin == None:
            print("Cannot find required binary 'chrpath'.")
            sys.exit(2)

    qt_install_info = common.get_qt_install_info(args.qmake_binary)
    QT_INSTALL_LIBS = qt_install_info['QT_INSTALL_LIBS']
    QT_INSTALL_BINS = qt_install_info['QT_INSTALL_BINS']
    QT_INSTALL_PLUGINS = qt_install_info['QT_INSTALL_PLUGINS']
    QT_INSTALL_IMPORTS = qt_install_info['QT_INSTALL_IMPORTS']
    QT_INSTALL_QML = qt_install_info['QT_INSTALL_QML']
    QT_INSTALL_TRANSLATIONS = qt_install_info['QT_INSTALL_TRANSLATIONS']

    plugins = [
        'assetimporters',
        'accessible',
        'codecs',
        'designer',
        'iconengines',
        'imageformats',
        'platformthemes',
        'platforminputcontexts',
        'platforms',
        'printsupport',
        'qmltooling',
        'sqldrivers',
        'styles',
        'xcbglintegrations',
        'wayland-decoration-client',
        'wayland-graphics-integration-client',
        'wayland-shell-integration',
    ]
    imports = ['Qt', 'QtWebKit']

    if common.is_windows_platform():
        global debug_build
        debug_build = is_debug(args.qtcreator_binary)

    if common.is_windows_platform():
        copy_qt_libs(qt_deploy_prefix, QT_INSTALL_BINS, QT_INSTALL_BINS,
                     QT_INSTALL_PLUGINS, QT_INSTALL_IMPORTS, QT_INSTALL_QML,
                     plugins, imports)
    else:
        copy_qt_libs(qt_deploy_prefix, QT_INSTALL_BINS, QT_INSTALL_LIBS,
                     QT_INSTALL_PLUGINS, QT_INSTALL_IMPORTS, QT_INSTALL_QML,
                     plugins, imports)
    copy_translations(install_dir, QT_INSTALL_TRANSLATIONS)
    if "LLVM_INSTALL_DIR" in os.environ:
        deploy_libclang(install_dir, os.environ["LLVM_INSTALL_DIR"],
                        chrpath_bin)

    if args.elfutils_path:
        deploy_elfutils(install_dir, chrpath_bin, args)
    if not common.is_windows_platform():
        print("fixing rpaths...")
        common.fix_rpaths(install_dir, os.path.join(qt_deploy_prefix, 'lib'),
                          qt_install_info, chrpath_bin)
        add_qt_conf(os.path.join(install_dir, 'libexec', 'qtcreator'),
                    qt_deploy_prefix)  # e.g. for qml2puppet
        add_qt_conf(os.path.join(qt_deploy_prefix, 'bin'),
                    qt_deploy_prefix)  # e.g. qtdiag
    add_qt_conf(os.path.join(install_dir, 'bin'), qt_deploy_prefix)