Beispiel #1
0
def default_python3():
    path_system = os.path.join('/usr', 'bin') if not common.is_windows_platform() else None
    path = os.environ.get('PYTHON3_PATH') or path_system
    postfix = '.exe' if common.is_windows_platform() else ''
    return (path if not path
            else (existing_path(os.path.join(path, 'python3' + postfix)) or
                  existing_path(os.path.join(path, 'python' + postfix))))
Beispiel #2
0
def copy_qt_libs(install_dir, qt_libs_dir, qt_plugin_dir, qt_import_dir, qt_qml_dir, plugins, imports):
    print "copying Qt libraries..."

    if common.is_windows_platform():
        libraries = glob(os.path.join(qt_libs_dir, '*.dll'))
    else:
        libraries = glob(os.path.join(qt_libs_dir, '*.so.*'))

    if common.is_windows_platform():
        dest = os.path.join(install_dir, 'bin')
    else:
        dest = os.path.join(install_dir, 'lib', 'qtcreator')

    if common.is_windows_platform():
        if debug_build:
            libraries = filter(lambda library: is_debug(library), libraries)
        else:
            libraries = filter(lambda library: not is_debug(library), libraries)

    for library in libraries:
        print library, '->', dest
        if os.path.islink(library):
            linkto = os.readlink(library)
            try:
                os.symlink(linkto, os.path.join(dest, os.path.basename(library)))
            except:
                op_failed("Link already exists!")
        else:
            shutil.copy(library, dest)

    copy_ignore_func = None
    if common.is_windows_platform():
        copy_ignore_func = copy_ignore_patterns_helper

    print "Copying plugins:", plugins
    for plugin in plugins:
        target = os.path.join(install_dir, 'bin', 'plugins', plugin)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        pluginPath = os.path.join(qt_plugin_dir, plugin)
        if (os.path.exists(pluginPath)):
            common.copytree(pluginPath, target, ignore=copy_ignore_func, symlinks=True)

    print "Copying imports:", imports
    for qtimport in imports:
        target = os.path.join(install_dir, 'bin', 'imports', qtimport)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        import_path = os.path.join(qt_import_dir, qtimport)
        if os.path.exists(import_path):
            common.copytree(import_path, target, ignore=copy_ignore_func, symlinks=True)

    if (os.path.exists(qt_qml_dir)):
        print "Copying qt quick 2 imports"
        target = os.path.join(install_dir, 'bin', 'qml')
        if (os.path.exists(target)):
            shutil.rmtree(target)
        common.copytree(qt_qml_dir, target, ignore=copy_ignore_func, symlinks=True)
Beispiel #3
0
def copy_qt_libs(target_qt_prefix_path, qt_libs_dir, qt_plugin_dir, qt_import_dir, qt_qml_dir, plugins, imports):
    print "copying Qt libraries..."

    if common.is_windows_platform():
        libraries = glob(os.path.join(qt_libs_dir, '*.dll'))
    else:
        libraries = glob(os.path.join(qt_libs_dir, '*.so.*'))

    if common.is_windows_platform():
        lib_dest = os.path.join(target_qt_prefix_path)
    else:
        lib_dest = os.path.join(target_qt_prefix_path, 'lib')

    if not os.path.exists(lib_dest):
        os.makedirs(lib_dest)

    if common.is_windows_platform():
        libraries = [lib for lib in libraries if not is_ignored_windows_file(debug_build, '', lib)]

    for library in libraries:
        print library, '->', lib_dest
        if os.path.islink(library):
            linkto = os.readlink(library)
            try:
                os.symlink(linkto, os.path.join(lib_dest, os.path.basename(library)))
            except OSError:
                op_failed("Link already exists!")
        else:
            shutil.copy(library, lib_dest)

    print "Copying plugins:", plugins
    for plugin in plugins:
        target = os.path.join(target_qt_prefix_path, 'plugins', plugin)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        pluginPath = os.path.join(qt_plugin_dir, plugin)
        if (os.path.exists(pluginPath)):
            print('{0} -> {1}'.format(pluginPath, target))
            common.copytree(pluginPath, target, ignore=ignored_qt_lib_files, symlinks=True)

    print "Copying imports:", imports
    for qtimport in imports:
        target = os.path.join(target_qt_prefix_path, 'imports', qtimport)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        import_path = os.path.join(qt_import_dir, qtimport)
        if os.path.exists(import_path):
            print('{0} -> {1}'.format(import_path, target))
            common.copytree(import_path, target, ignore=ignored_qt_lib_files, symlinks=True)

    if (os.path.exists(qt_qml_dir)):
        print "Copying qt quick 2 imports"
        target = os.path.join(target_qt_prefix_path, 'qml')
        if (os.path.exists(target)):
            shutil.rmtree(target)
        print('{0} -> {1}'.format(qt_qml_dir, target))
        common.copytree(qt_qml_dir, target, ignore=ignored_qt_lib_files, symlinks=True)
Beispiel #4
0
def copy_qt_libs(target_qt_prefix_path, qt_libs_dir, qt_plugin_dir, qt_import_dir, qt_qml_dir, plugins, imports):
    print "copying Qt libraries..."

    if common.is_windows_platform():
        libraries = glob(os.path.join(qt_libs_dir, '*.dll'))
    else:
        libraries = glob(os.path.join(qt_libs_dir, '*.so.*'))

    if common.is_windows_platform():
        lib_dest = os.path.join(target_qt_prefix_path)
    else:
        lib_dest = os.path.join(target_qt_prefix_path, 'lib')

    if not os.path.exists(lib_dest):
        os.makedirs(lib_dest)

    if common.is_windows_platform():
        libraries = [lib for lib in libraries if not is_ignored_windows_file(debug_build, '', lib)]

    for library in libraries:
        print library, '->', lib_dest
        if os.path.islink(library):
            linkto = os.readlink(library)
            try:
                os.symlink(linkto, os.path.join(lib_dest, os.path.basename(library)))
            except OSError:
                op_failed("Link already exists!")
        else:
            shutil.copy(library, lib_dest)

    print "Copying plugins:", plugins
    for plugin in plugins:
        target = os.path.join(target_qt_prefix_path, 'plugins', plugin)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        pluginPath = os.path.join(qt_plugin_dir, plugin)
        if (os.path.exists(pluginPath)):
            print('{0} -> {1}'.format(pluginPath, target))
            common.copytree(pluginPath, target, ignore=ignored_qt_lib_files, symlinks=True)

    print "Copying imports:", imports
    for qtimport in imports:
        target = os.path.join(target_qt_prefix_path, 'imports', qtimport)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        import_path = os.path.join(qt_import_dir, qtimport)
        if os.path.exists(import_path):
            print('{0} -> {1}'.format(import_path, target))
            common.copytree(import_path, target, ignore=ignored_qt_lib_files, symlinks=True)

    if (os.path.exists(qt_qml_dir)):
        print "Copying qt quick 2 imports"
        target = os.path.join(target_qt_prefix_path, 'qml')
        if (os.path.exists(target)):
            shutil.rmtree(target)
        print('{0} -> {1}'.format(qt_qml_dir, target))
        common.copytree(qt_qml_dir, target, ignore=ignored_qt_lib_files, symlinks=True)
Beispiel #5
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)
Beispiel #6
0
def copy_qt_libs(target_qt_prefix_path, qt_bin_dir, qt_libs_dir, qt_plugin_dir, qt_qml_dir, plugins):
    print("copying Qt libraries...")

    if common.is_windows_platform():
        libraries = glob(os.path.join(qt_libs_dir, '*.dll'))
    else:
        libraries = glob(os.path.join(qt_libs_dir, '*.so.*'))

    if common.is_windows_platform():
        lib_dest = os.path.join(target_qt_prefix_path)
    else:
        lib_dest = os.path.join(target_qt_prefix_path, 'lib')

    if not os.path.exists(lib_dest):
        os.makedirs(lib_dest)

    if common.is_windows_platform():
        libraries = [lib for lib in libraries if not is_ignored_windows_file(debug_build, '', lib)]

    for library in libraries:
        print(library, '->', lib_dest)
        if os.path.islink(library):
            linkto = os.readlink(library)
            try:
                os.symlink(linkto, os.path.join(lib_dest, os.path.basename(library)))
            except OSError:
                pass
        else:
            shutil.copy(library, lib_dest)

    print("Copying plugins:", plugins)
    for plugin in plugins:
        target = os.path.join(target_qt_prefix_path, 'plugins', plugin)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        pluginPath = os.path.join(qt_plugin_dir, plugin)
        if (os.path.exists(pluginPath)):
            print('{0} -> {1}'.format(pluginPath, target))
            common.copytree(pluginPath, target, ignore=ignored_qt_lib_files, symlinks=True)

    if (os.path.exists(qt_qml_dir)):
        print("Copying qt quick 2 imports")
        target = os.path.join(target_qt_prefix_path, 'qml')
        if (os.path.exists(target)):
            shutil.rmtree(target)
        print('{0} -> {1}'.format(qt_qml_dir, target))
        common.copytree(qt_qml_dir, target, ignore=ignored_qt_lib_files, symlinks=True)

    print("Copying qtdiag")
    bin_dest = target_qt_prefix_path if common.is_windows_platform() else os.path.join(target_qt_prefix_path, 'bin')
    qtdiag_src = os.path.join(qt_bin_dir, 'qtdiag.exe' if common.is_windows_platform() else 'qtdiag')
    if not os.path.exists(bin_dest):
        os.makedirs(bin_dest)
    shutil.copy(qtdiag_src, bin_dest)
Beispiel #7
0
def ignored_qt_lib_files(path, filenames):
    if not common.is_windows_platform():
        return [fn for fn in filenames if fn.lower().endswith(('.debug'))]
    return [
        fn for fn in filenames
        if is_ignored_windows_file(debug_build, path, fn)
    ]
Beispiel #8
0
def common_cmake_arguments(args):
    separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF'
    cmake_args = ['-DCMAKE_BUILD_TYPE=' + args.build_type,
                  '-DQTC_SEPARATE_DEBUG_INFO=' + separate_debug_info_option,
                  '-G', 'Ninja']

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

    if args.module_paths:
        module_paths = [common.to_posix_path(os.path.abspath(fp)) for fp in args.module_paths]
        cmake_args += ['-DCMAKE_MODULE_PATH=' + ';'.join(module_paths)]

    # 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():
        if not os.environ.get('CC') and not os.environ.get('CXX'):
            cmake_args += ['-DCMAKE_C_COMPILER=cl',
                           '-DCMAKE_CXX_COMPILER=cl']
        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')]
    return cmake_args
Beispiel #9
0
def get_args():
    parser = argparse.ArgumentParser(description='Deploy Qt Creator dependencies for packaging')
    parser.add_argument('-i', '--ignore-errors', help='For backward compatibility',
                        action='store_true', default=False)
    parser.add_argument('--elfutils-path',
                        help='Path to elfutils installation for use by perfprofiler (Windows, Linux)')
    # TODO remove defaulting to LLVM_INSTALL_DIR when we no longer build qmake based packages
    parser.add_argument('--llvm-path',
                        help='Path to LLVM installation',
                        default=os.environ.get('LLVM_INSTALL_DIR'))
    parser.add_argument('qtcreator_binary', help='Path to Qt Creator binary (or the app bundle on macOS)')
    parser.add_argument('qmake_binary', help='Path to qmake binary')

    args = parser.parse_args()

    args.qtcreator_binary = os.path.abspath(args.qtcreator_binary)
    if common.is_mac_platform():
        if not args.qtcreator_binary.lower().endswith(".app"):
            args.qtcreator_binary = args.qtcreator_binary + ".app"
        check = os.path.isdir
    else:
        check = os.path.isfile
        if common.is_windows_platform() and not args.qtcreator_binary.lower().endswith(".exe"):
            args.qtcreator_binary = args.qtcreator_binary + ".exe"

    if not check(args.qtcreator_binary):
        print('Cannot find Qt Creator binary.')
        sys.exit(1)

    args.qmake_binary = which(args.qmake_binary)
    if not args.qmake_binary:
        print('Cannot find qmake binary.')
        sys.exit(2)

    return args
def parse_arguments():
    parser = argparse.ArgumentParser(
        description=
        "Create Qt Creator package, filtering out debug information files.",
        epilog=
        "To sign the contents before packaging on macOS, set the SIGNING_IDENTITY and optionally the SIGNING_FLAGS environment variables."
    )
    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('--debug',
                        help='package only the files with debug information',
                        dest='debug',
                        action='store_true',
                        default=False)
    parser.add_argument(
        '--exclude-toplevel',
        help=
        'do not include the toplevel source directory itself in the resulting archive, only its contents',
        dest='exclude_toplevel',
        action='store_true',
        default=False)
    parser.add_argument('target_archive', help='output 7z file to create')
    parser.add_argument(
        'source_directory',
        help='source directory with the Qt Creator installation')
    return parser.parse_args()
Beispiel #11
0
def package_qtcreator(args, paths):
    if not args.no_zip:
        common.check_print_call([
            '7z', 'a', '-mmt2',
            os.path.join(paths.result, 'qtcreator.7z'), '*'
        ], paths.install)
        common.check_print_call([
            '7z', 'a', '-mmt2',
            os.path.join(paths.result, 'qtcreator_dev.7z'), '*'
        ], paths.dev_install)
        if common.is_windows_platform():
            common.check_print_call([
                '7z', 'a', '-mmt2',
                os.path.join(paths.result, 'wininterrupt.7z'), '*'
            ], paths.wininterrupt_install)
            if not args.no_cdb:
                common.check_print_call([
                    '7z', 'a', '-mmt2',
                    os.path.join(paths.result, 'qtcreatorcdbext.7z'), '*'
                ], paths.qtcreatorcdbext_install)

    if common.is_mac_platform():
        if args.keychain_unlock_script:
            common.check_print_call([args.keychain_unlock_script],
                                    paths.install)
        if not args.no_dmg:
            common.check_print_call([
                'python', '-u',
                os.path.join(paths.src, 'scripts', 'makedmg.py'),
                'qt-creator.dmg', 'Qt Creator', paths.src, paths.install
            ], paths.result)
Beispiel #12
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)
Beispiel #13
0
def get_args():
    parser = argparse.ArgumentParser(
        description='Deploy Qt Creator dependencies for packaging')
    parser.add_argument('-i',
                        '--ignore-errors',
                        help='For backward compatibility',
                        action='store_true',
                        default=False)
    parser.add_argument(
        '--elfutils-path',
        help=
        'Path to elfutils installation for use by perfprofiler (Windows, Linux)'
    )
    parser.add_argument('qtcreator_binary', help='Path to Qt Creator binary')
    parser.add_argument('qmake_binary', help='Path to qmake binary')

    args = parser.parse_args()

    args.qtcreator_binary = os.path.abspath(args.qtcreator_binary)
    if common.is_windows_platform(
    ) and not args.qtcreator_binary.lower().endswith(".exe"):
        args.qtcreator_binary = args.qtcreator_binary + ".exe"
    if not os.path.isfile(args.qtcreator_binary):
        print('Cannot find Qt Creator binary.')
        sys.exit(1)

    args.qmake_binary = which(args.qmake_binary)
    if not args.qmake_binary:
        print('Cannot find qmake binary.')
        sys.exit(2)

    return args
Beispiel #14
0
def ignored_qt_lib_files(path, filenames):
    if not common.is_windows_platform():
        return []
    return [
        fn for fn in filenames
        if is_ignored_windows_file(debug_build, path, fn)
    ]
Beispiel #15
0
def common_cmake_arguments(args):
    separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF'
    cmake_args = [
        '-DCMAKE_BUILD_TYPE=' + args.build_type,
        '-DQTC_SEPARATE_DEBUG_INFO=' + separate_debug_info_option, '-G',
        'Ninja'
    ]

    if args.python3:
        cmake_args += ['-DPython3_EXECUTABLE=' + args.python3]
    if args.python_path:
        cmake_args += ['-DPython3_ROOT_DIR=' + args.python_path]

    if args.module_paths:
        module_paths = [
            common.to_posix_path(os.path.abspath(fp))
            for fp in args.module_paths
        ]
        cmake_args += ['-DCMAKE_MODULE_PATH=' + ';'.join(module_paths)]

    # 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():
        if not os.environ.get('CC') and not os.environ.get('CXX'):
            cmake_args += ['-DCMAKE_C_COMPILER=cl', '-DCMAKE_CXX_COMPILER=cl']

    pch_option = 'ON' if args.with_pch else 'OFF'
    cmake_args += ['-DBUILD_WITH_PCH=' + pch_option]

    # work around QTBUG-89754
    # Qt otherwise adds dependencies on libGLX and libOpenGL
    cmake_args += ['-DOpenGL_GL_PREFERENCE=LEGACY']

    return cmake_args
Beispiel #16
0
def parse_arguments():
    parser = argparse.ArgumentParser(
        description=
        "Create Slaq package, filtering out debug information files.")
    parser.add_argument('--7z',
                        help='path to 7z binary',
                        default='c:/Program Files/7-Zip/7z.exe'
                        if common.is_windows_platform() else '7z',
                        metavar='<7z_binary>',
                        dest='sevenzip')
    parser.add_argument('--debug',
                        help='package only the files with debug information',
                        dest='debug',
                        action='store_true',
                        default=False)
    parser.add_argument(
        '--exclude-toplevel',
        help=
        'do not include the toplevel source directory itself in the resulting archive, only its contents',
        dest='exclude_toplevel',
        action='store_true',
        default=True)
    parser.add_argument('target_archive', help='output 7z file to create')
    parser.add_argument('source_directory',
                        help='source directory with the Slaq installation')
    return parser.parse_args()
Beispiel #17
0
def parse_arguments():
    parser = argparse.ArgumentParser(
        description="Create Qt Creator development package.")
    parser.add_argument('--source',
                        '-s',
                        help='path to the Qt Creator sources',
                        required=True,
                        metavar='<path>')
    parser.add_argument('--build',
                        '-b',
                        help='path to the Qt Creator build',
                        required=True,
                        metavar='<path>')
    parser.add_argument('--verbose',
                        '-v',
                        help='verbose output',
                        action='store_true',
                        default=False)
    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('--7z_out',
                        '-o',
                        help='output 7z file to create',
                        metavar='<filename>',
                        dest='sevenzip_target')
    parser.add_argument('target_directory')
    return parser.parse_args()
def parse_arguments():
    parser = argparse.ArgumentParser(description="Download third-party dependencies")
    parser.add_argument('--git', help='path to git binary',
        default='git.exe' if common.is_windows_platform() else 'git',
        metavar='<git_binary>', dest='gitpath')
    parser.add_argument('--library', help='Library to download. Type "all" for download all libraries',
		default='all', required=False)
    return parser.parse_args()
Beispiel #19
0
def get_arguments():
    parser = argparse.ArgumentParser(description='Build Qt Creator for packaging')
    parser.add_argument('--src', help='path to sources', required=True)
    parser.add_argument('--build', help='path that should be used for building', required=True)
    parser.add_argument('--qt-path', help='Path to Qt', required=True)

    parser.add_argument('--build-type', help='Build type to pass to CMake (defaults to RelWithDebInfo)',
                        default='RelWithDebInfo')

    # clang codemodel
    parser.add_argument('--llvm-path', help='Path to LLVM installation for Clang code model',
                        default=os.environ.get('LLVM_INSTALL_DIR'))

    # perfparser
    parser.add_argument('--elfutils-path',
                        help='Path to elfutils installation for use by perfprofiler (Windows, Linux)')

    # signing
    parser.add_argument('--keychain-unlock-script',
                        help='Path to script for unlocking the keychain used for signing (macOS)')

    # cdbextension
    parser.add_argument('--python-path',
                        help='Path to python libraries for use by cdbextension (Windows)')

    parser.add_argument('--app-target', help='File name of the executable / app bundle',
                        default=('Qt Creator.app' if common.is_mac_platform()
                                 else 'qtcreator'))
    parser.add_argument('--python3', help='File path to python3 executable for generating translations',
                        default=default_python3())

    parser.add_argument('--no-cdb',
                        help='Skip cdbextension and the python dependency packaging step (Windows)',
                        action='store_true', default=(not common.is_windows_platform()))
    parser.add_argument('--no-docs', help='Skip documentation generation',
                        action='store_true', default=False)
    parser.add_argument('--no-build-date', help='Does not show build date in about dialog, for reproducible builds',
                        action='store_true', default=False)
    parser.add_argument('--no-dmg', help='Skip disk image creation (macOS)',
                        action='store_true', default=False)
    parser.add_argument('--no-zip', help='Skip creation of 7zip files for install and developer package',
                        action='store_true', default=False)
    parser.add_argument('--with-tests', help='Enable building of tests',
                        action='store_true', default=False)
    parser.add_argument('--add-path', help='Prepends a CMAKE_PREFIX_PATH to the build',
                        action='append', dest='prefix_paths', default=[])
    parser.add_argument('--add-module-path', help='Prepends a CMAKE_MODULE_PATH to the build',
                        action='append', dest='module_paths', default=[])
    parser.add_argument('--add-make-arg', help='Passes the argument to the make tool.',
                        action='append', dest='make_args', default=[])
    parser.add_argument('--add-config', help=('Adds the argument to the CMake configuration call. '
                                              'Use "--add-config=-DSOMEVAR=SOMEVALUE" if the argument begins with a dash.'),
                        action='append', dest='config_args', default=[])
    parser.add_argument('--zip-infix', help='Adds an infix to generated zip files, use e.g. for a build number.',
                        default='')
    args = parser.parse_args()
    args.with_debug_info = args.build_type == 'RelWithDebInfo'
    return args
Beispiel #20
0
def get_arguments():
    parser = argparse.ArgumentParser(
        description='Build Qt Creator for packaging')
    parser.add_argument('--src', help='path to sources', required=True)
    parser.add_argument('--build',
                        help='path that should be used for building',
                        required=True)
    parser.add_argument('--qt-path', help='Path to Qt', required=True)

    parser.add_argument('--debug',
                        help='Enable debug builds',
                        action='store_true',
                        default=False)

    # clang codemodel
    parser.add_argument('--llvm-path',
                        help='Path to LLVM installation for Clang code model',
                        default=os.environ.get('LLVM_INSTALL_DIR'))

    # perfparser
    parser.add_argument(
        '--elfutils-path',
        help=
        'Path to elfutils installation for use by perfprofiler (Windows, Linux)'
    )

    # signing
    parser.add_argument(
        '--keychain-unlock-script',
        help=
        'Path to script for unlocking the keychain used for signing (macOS)')

    # cdbextension
    parser.add_argument(
        '--python-path',
        help='Path to python libraries for use by cdbextension (Windows)')

    parser.add_argument('--app-target',
                        help='File name of the executable / app bundle',
                        default=('Qt Creator.app'
                                 if common.is_mac_platform() else 'qtcreator'))
    parser.add_argument(
        '--python3',
        help='File path to python3 executable for generating translations',
        default=default_python3())

    parser.add_argument(
        '--no-cdb',
        help=
        'Skip cdbextension and the python dependency packaging step (Windows)',
        action='store_true',
        default=(not common.is_windows_platform()))
    parser.add_argument('--no-docs',
                        help='Skip documentation generation',
                        action='store_true',
                        default=False)
    return parser.parse_args()
def parse_arguments():
    parser = argparse.ArgumentParser(
        description="Clang-Tidy checks header file generator")
    parser.add_argument('--tidy-path',
                        help='path to clang-tidy binary',
                        default='clang-tidy.exe'
                        if common.is_windows_platform() else 'clang-tidy',
                        dest='tidypath')
    return parser.parse_args()
Beispiel #22
0
def build(args, paths):
    if not os.path.exists(paths.build):
        os.makedirs(paths.build)
    if not os.path.exists(paths.result):
        os.makedirs(paths.result)
    prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt_creator, paths.qt]
    prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths]
    cmake_args = ['cmake',
                  '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths),
                  '-DCMAKE_BUILD_TYPE=' + args.build_type,
                  '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install),
                  '-G', 'Ninja']

    # 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']

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

    if args.with_docs:
        cmake_args += ['-DWITH_DOCS=ON']

    ide_revision = common.get_commit_SHA(paths.src)
    if ide_revision:
        cmake_args += ['-DQTC_PLUGIN_REVISION=' + ide_revision]
        with open(os.path.join(paths.result, args.name + '.7z.git_sha'), 'w') as f:
            f.write(ide_revision)

    cmake_args += args.config_args
    common.check_print_call(cmake_args + [paths.src], paths.build)
    build_args = ['cmake', '--build', '.']
    if args.make_args:
        build_args += ['--'] + args.make_args
    common.check_print_call(build_args, paths.build)
    if args.with_docs:
        common.check_print_call(['cmake', '--build', '.', '--target', 'docs'], paths.build)
    common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install, '--strip'],
                            paths.build)
    if args.with_docs:
        common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install,
                                 '--component', 'qch_docs'],
                                paths.build)
        common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install,
                                 '--component', 'html_docs'],
                                paths.build)
    if args.deploy:
        common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install,
                                 '--component', 'Dependencies'],
                                paths.build)
    common.check_print_call(['cmake', '--install', '.', '--prefix', paths.dev_install,
                             '--component', 'Devel'],
                            paths.build)
Beispiel #23
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)
Beispiel #24
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()
Beispiel #25
0
def build_wininterrupt(args, paths):
    if not common.is_windows_platform():
        return
    # assumes existing Qt Creator build
    cmake_args = ['-DBUILD_EXECUTABLE_WIN32INTERRUPT=ON',
                  '-DBUILD_EXECUTABLE_WIN64INTERRUPT=ON',
                  '-DBUILD_LIBRARY_QTCREATORCDBEXT=OFF']
    common.check_print_call(['cmake'] + cmake_args + [paths.src], paths.build)
    common.check_print_call(['cmake', '--build', '.'], paths.build)
    common.check_print_call(['cmake', '--install', '.', '--prefix', paths.wininterrupt_install,
                             '--component', 'wininterrupt'],
                            paths.build)
Beispiel #26
0
def which(program):
    def is_exe(fpath):
        return os.path.exists(fpath) and os.access(fpath, os.X_OK)

    fpath = os.path.dirname(program)
    if fpath:
        if is_exe(program):
            return program
        if common.is_windows_platform():
            if is_exe(program + ".exe"):
                return program  + ".exe"
    else:
        for path in os.environ["PATH"].split(os.pathsep):
            exe_file = os.path.join(path, program)
            if is_exe(exe_file):
                return exe_file
            if common.is_windows_platform():
                if is_exe(exe_file + ".exe"):
                    return exe_file  + ".exe"

    return None
Beispiel #27
0
def which(program):
    def is_exe(fpath):
        return os.path.exists(fpath) and os.access(fpath, os.X_OK)

    fpath = os.path.dirname(program)
    if fpath:
        if is_exe(program):
            return program
        if common.is_windows_platform():
            if is_exe(program + ".exe"):
                return program  + ".exe"
    else:
        for path in os.environ["PATH"].split(os.pathsep):
            exe_file = os.path.join(path, program)
            if is_exe(exe_file):
                return exe_file
            if common.is_windows_platform():
                if is_exe(exe_file + ".exe"):
                    return exe_file  + ".exe"

    return None
def parse_arguments():
    parser = argparse.ArgumentParser(description="Create Qt Creator package, filtering out debug information files.",
        epilog="To sign the contents before packaging on macOS, set the SIGNING_IDENTITY and optionally the SIGNING_FLAGS environment variables.")
    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('--debug', help='package only the files with debug information',
                        dest='debug', action='store_true', default=False)
    parser.add_argument('--exclude-toplevel', help='do not include the toplevel source directory itself in the resulting archive, only its contents',
                        dest='exclude_toplevel', action='store_true', default=False)
    parser.add_argument('target_archive', help='output 7z file to create')
    parser.add_argument('source_directory', help='source directory with the Qt Creator installation')
    return parser.parse_args()
Beispiel #29
0
def parse_arguments():
    parser = argparse.ArgumentParser(description="Create Qt Creator development package.")
    parser.add_argument('--source', '-s', help='path to the Qt Creator sources', required=True,
        metavar='<path>')
    parser.add_argument('--build', '-b', help='path to the Qt Creator build', required=True,
        metavar='<path>')
    parser.add_argument('--verbose', '-v', help='verbose output', action='store_true', default=False)
    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('--7z_out', '-o', help='output 7z file to create', metavar='<filename>',
        dest='sevenzip_target')
    parser.add_argument('target_directory')
    return parser.parse_args()
Beispiel #30
0
def build_wininterrupt(args, paths):
    if not common.is_windows_platform():
        return
    if not os.path.exists(paths.wininterrupt_build):
        os.makedirs(paths.wininterrupt_build)
    prefix_paths = [common.to_posix_path(os.path.abspath(fp)) for fp in args.prefix_paths]
    cmake_args = ['-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths),
                  '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.wininterrupt_install)]
    cmake_args += common_cmake_arguments(args)
    common.check_print_call(['cmake'] + cmake_args + [os.path.join(paths.src, 'src', 'tools', 'wininterrupt')],
                            paths.wininterrupt_build)
    common.check_print_call(['cmake', '--build', '.'], paths.wininterrupt_build)
    common.check_print_call(['cmake', '--install', '.', '--prefix', paths.wininterrupt_install,
                             '--component', 'wininterrupt'],
                            paths.wininterrupt_build)
Beispiel #31
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)
Beispiel #32
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()
Beispiel #33
0
def package_qtcreator(args, paths):
    if not args.no_zip:
        if not args.no_qtcreator:
            common.check_print_call([
                '7z', 'a', '-mmt' + args.zip_threads,
                os.path.join(paths.result,
                             'qtcreator' + args.zip_infix + '.7z'),
                zipPatternForApp(paths)
            ], paths.install)
            common.check_print_call([
                '7z', 'a', '-mmt' + args.zip_threads,
                os.path.join(paths.result,
                             'qtcreator' + args.zip_infix + '_dev.7z'), '*'
            ], paths.dev_install)
            if args.with_debug_info:
                common.check_print_call([
                    '7z', 'a', '-mmt' + args.zip_threads,
                    os.path.join(paths.result, 'qtcreator' + args.zip_infix +
                                 '-debug.7z'), '*'
                ], paths.debug_install)
        if common.is_windows_platform():
            common.check_print_call([
                '7z', 'a', '-mmt' + args.zip_threads,
                os.path.join(paths.result,
                             'wininterrupt' + args.zip_infix + '.7z'), '*'
            ], paths.wininterrupt_install)
            if not args.no_cdb:
                common.check_print_call([
                    '7z', 'a', '-mmt' + args.zip_threads,
                    os.path.join(paths.result, 'qtcreatorcdbext' +
                                 args.zip_infix + '.7z'), '*'
                ], paths.qtcreatorcdbext_install)

    if common.is_mac_platform() and not args.no_dmg and not args.no_qtcreator:
        if args.keychain_unlock_script:
            common.check_print_call([args.keychain_unlock_script],
                                    paths.install)
        common.check_print_call([
            'python', '-u',
            os.path.join(paths.src, 'scripts', 'makedmg.py'), 'qt-creator' +
            args.zip_infix + '.dmg', 'Qt Creator', paths.src, paths.install
        ], paths.result)
Beispiel #34
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)
Beispiel #35
0
def copy_libs(target_qt_prefix_path, qt_plugin_dir, qt_import_dir, qt_qml_dir,
              plugins, imports, qmlimports, qtlibs):
    print("copying Qt libraries...")
    if common.is_windows_platform():
        lib_dest = os.path.join(target_qt_prefix_path)
    else:
        lib_dest = os.path.join(target_qt_prefix_path, 'lib')

    if not os.path.exists(lib_dest):
        os.makedirs(lib_dest)

    for library in qtlibs:
        print(library, '->', lib_dest)
        if os.path.islink(library):
            linkto = os.readlink(library)
            print("is link:", library, linkto, os.path.realpath(library))
            shutil.copy(os.path.realpath(library), lib_dest)
            try:
                os.symlink(linkto,
                           os.path.join(lib_dest, os.path.basename(library)))
            except OSError:
                op_failed("Link already exists!")
        else:
            shutil.copy(library, lib_dest)

    print("Copying plugins:", plugins)
    for plugin in plugins:
        target = os.path.join(target_qt_prefix_path, 'plugins', plugin)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        pluginPath = os.path.join(qt_plugin_dir, plugin)
        if (os.path.exists(pluginPath)):
            print('{0} -> {1}'.format(pluginPath, target))
            common.copytree(pluginPath,
                            target,
                            ignore=ignored_qt_lib_files,
                            symlinks=True)

    print("Copying imports:", imports)
    for qtimport in imports:
        target = os.path.join(target_qt_prefix_path, 'imports', qtimport)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        import_path = os.path.join(qt_import_dir, qtimport)
        if os.path.exists(import_path):
            print('{0} -> {1}'.format(import_path, target))
            common.copytree(import_path,
                            target,
                            ignore=ignored_qt_lib_files,
                            symlinks=True)

    if (os.path.exists(qt_qml_dir)):
        print("Copying qt quick 2 imports")
        for qmlimport in qmlimports:
            source = os.path.join(qt_qml_dir, qmlimport)
            target = os.path.join(target_qt_prefix_path, 'qml', qmlimport)
            if (os.path.exists(target)):
                shutil.rmtree(target)
            print('{0} -> {1}'.format(source, target))
            common.copytree(source,
                            target,
                            ignore=ignored_qt_lib_files,
                            symlinks=True)
Beispiel #36
0
def ignored_qt_lib_files(path, filenames):
    if not common.is_windows_platform():
        return []
    return [fn for fn in filenames if is_ignored_windows_file(debug_build, path, fn)]
Beispiel #37
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)
def parse_arguments():
    parser = argparse.ArgumentParser(description="Clang-Tidy checks header file generator")
    parser.add_argument('--tidy-path', help='path to clang-tidy binary',
        default='clang-tidy.exe' if common.is_windows_platform() else 'clang-tidy', dest='tidypath')
    return parser.parse_args()
Beispiel #39
0
def build_qtcreator(args, paths):
    if not os.path.exists(paths.build):
        os.makedirs(paths.build)
    prefix_paths = [os.path.abspath(fp)
                    for fp in args.prefix_paths] + [paths.qt]
    if paths.llvm:
        prefix_paths += [paths.llvm]
    if paths.elfutils:
        prefix_paths += [paths.elfutils]
    prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths]
    with_docs_str = 'OFF' if args.no_docs else 'ON'
    build_date_option = 'OFF' if args.no_build_date else 'ON'
    test_option = 'ON' if args.with_tests else 'OFF'
    cmake_args = [
        'cmake', '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths),
        '-DCMAKE_BUILD_TYPE=' + args.build_type,
        '-DSHOW_BUILD_DATE=' + build_date_option,
        '-DWITH_DOCS=' + with_docs_str,
        '-DBUILD_DEVELOPER_DOCS=' + with_docs_str,
        '-DBUILD_EXECUTABLE_SDKTOOL=OFF',
        '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install),
        '-DWITH_TESTS=' + test_option, '-G', 'Ninja'
    ]

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

    if args.module_paths:
        module_paths = [
            common.to_posix_path(os.path.abspath(fp))
            for fp in args.module_paths
        ]
        cmake_args += ['-DCMAKE_MODULE_PATH=' + ';'.join(module_paths)]

    # 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():
        if not os.environ.get('CC') and not os.environ.get('CXX'):
            cmake_args += ['-DCMAKE_C_COMPILER=cl', '-DCMAKE_CXX_COMPILER=cl']
        cmake_args += [
            '-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
    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=https://code.qt.io/cgit/qt-creator/qt-creator.git/log/?id='
            + ide_revision
        ]

    cmake_args += args.config_args

    common.check_print_call(cmake_args + [paths.src], paths.build)
    build_args = ['cmake', '--build', '.']
    if args.make_args:
        build_args += ['--'] + args.make_args
    common.check_print_call(build_args, 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.install, '--component',
        'Dependencies'
    ], paths.build)
    common.check_print_call([
        'cmake', '--install', '.', '--prefix', paths.dev_install,
        '--component', 'Devel'
    ], paths.build)
    if args.with_debug_info:
        common.check_print_call([
            'cmake', '--install', '.', '--prefix', paths.debug_install,
            '--component', 'DebugInfo'
        ], paths.build)
    if not args.no_docs:
        common.check_print_call([
            'cmake', '--install', '.', '--prefix', paths.install,
            '--component', 'qch_docs'
        ], paths.build)
        common.check_print_call([
            'cmake', '--install', '.', '--prefix', paths.install,
            '--component', 'html_docs'
        ], paths.build)
Beispiel #40
0
    r"^src/qtcreatorplugin.pri$",
    r"^src/qtcreatorlibrary.pri$",
    r"^src/qtcreatortool.pri$",
    r"^src/rpath.pri$",
    r"^.*\.h$",
    r"^.*_dependencies.pri$",
]

build_include_patterns = [
    # directories
    r"^src/$",
    r"^src/app/$",
    # files
    r"^src/app/app_version.h$"
]
if common.is_windows_platform():
    build_include_patterns.extend([
        r"^lib/(.*/)?$", # consider all directories under lib/
        r"^lib/.*\.lib$"
    ])

# =========================================

def copy_regexp(regexp, source_directory, target_directory, verbose):
    def ignore(directory, filenames):
        relative_dir = os.path.relpath(directory, source_directory)
        file_target_dir = os.path.join(target_directory, relative_dir)
        ignored = []
        for filename in filenames:
            relative_file_path = os.path.normpath(os.path.join(relative_dir, filename))
            relative_file_path = relative_file_path.replace(os.sep, '/')
Beispiel #41
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)
Beispiel #42
0
def build_qtcreator(args, paths):
    if args.no_qtcreator:
        return
    if not os.path.exists(paths.build):
        os.makedirs(paths.build)
    prefix_paths = [os.path.abspath(fp)
                    for fp in args.prefix_paths] + [paths.qt]
    if paths.llvm:
        prefix_paths += [paths.llvm]
    if paths.elfutils:
        prefix_paths += [paths.elfutils]
    prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths]
    with_docs_str = 'OFF' if args.no_docs else 'ON'
    build_date_option = 'OFF' if args.no_build_date else 'ON'
    test_option = 'ON' if args.with_tests else 'OFF'
    cmake_args = [
        'cmake', '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths),
        '-DSHOW_BUILD_DATE=' + build_date_option,
        '-DWITH_DOCS=' + with_docs_str,
        '-DBUILD_DEVELOPER_DOCS=' + with_docs_str,
        '-DBUILD_EXECUTABLE_SDKTOOL=OFF',
        '-DCMAKE_INSTALL_PREFIX=' + common.to_posix_path(paths.install),
        '-DWITH_TESTS=' + test_option
    ]
    cmake_args += common_cmake_arguments(args)

    if common.is_windows_platform():
        cmake_args += [
            '-DBUILD_EXECUTABLE_WIN32INTERRUPT=OFF',
            '-DBUILD_EXECUTABLE_WIN64INTERRUPT=OFF',
            '-DBUILD_LIBRARY_QTCREATORCDBEXT=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=https://code.qt.io/cgit/qt-creator/qt-creator.git/log/?id='
            + ide_revision
        ]

    cmake_args += args.config_args

    common.check_print_call(cmake_args + [paths.src], paths.build)
    build_args = ['cmake', '--build', '.']
    if args.make_args:
        build_args += ['--'] + args.make_args
    common.check_print_call(build_args, 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.install, '--component',
        'Dependencies'
    ], paths.build)
    common.check_print_call([
        'cmake', '--install', '.', '--prefix', paths.dev_install,
        '--component', 'Devel'
    ], paths.build)
    if args.with_debug_info:
        common.check_print_call([
            'cmake', '--install', '.', '--prefix', paths.debug_install,
            '--component', 'DebugInfo'
        ], paths.build)
    if not args.no_docs:
        common.check_print_call([
            'cmake', '--install', '.', '--prefix', paths.install,
            '--component', 'qch_docs'
        ], paths.build)
        common.check_print_call([
            'cmake', '--install', '.', '--prefix', paths.install,
            '--component', 'html_docs'
        ], paths.build)
Beispiel #43
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)