Exemple #1
0
def archive_installerbase(options):
    print('--------------------------------------------------------------------')
    print('Archive Installerbase')
    cmd_args_archive = []
    cmd_args_clean = []
    bin_temp = ''
    if bldinstallercommon.is_linux_platform() or bldinstallercommon.is_mac_platform():
        bin_path = bldinstallercommon.locate_executable(options.installer_framework_build_dir, 'installerbase')
        bin_temp = ROOT_DIR + os.sep + '.tempSDKMaintenanceTool'
        shutil.copy(bin_path, bin_temp)
        cmd_args_archive = ['7z', 'a', options.installer_base_archive_name, bin_temp]
        cmd_args_clean = ['rm', bin_temp]
    if bldinstallercommon.is_win_platform():
        bin_path = bldinstallercommon.locate_executable(options.installer_framework_build_dir, 'installerbase.exe')
        bin_temp = ROOT_DIR + os.sep + 'tempSDKMaintenanceToolBase.exe'
        shutil.copy(bin_path, bin_temp)
        if options.signserver and options.signpwd:
            sign_windows_installerbase('tempSDKMaintenanceToolBase.exe', ROOT_DIR + os.sep, True, options)
        cmd_args_archive = ['7z', 'a', options.installer_base_archive_name, bin_temp]
        cmd_args_clean = ['del', bin_temp]
    bldinstallercommon.do_execute_sub_process(cmd_args_archive, ROOT_DIR)
    bldinstallercommon.do_execute_sub_process(cmd_args_clean, ROOT_DIR)
    if not os.path.isfile(options.installer_base_archive_name):
        print('*** Failed to generate archive: {0}'.format(options.installer_base_archive_name))
        sys.exit(-1)
    shutil.move(options.installer_base_archive_name, options.build_artifacts_dir)
Exemple #2
0
def replace_rpath():
    if not bldinstallercommon.is_linux_platform() or not DESKTOP_BUILD:
        print_wrap('*** Warning! RPath patching enabled only for Linux platforms and Desktop builds')
        return
    dest_path_lib = bldinstallercommon.locate_directory(os.path.join(MAKE_INSTALL_ROOT_DIR, ESSENTIALS_INSTALL_DIR_NAME), 'lib')
    component_root_path = os.path.dirname(dest_path_lib)
    bldinstallercommon.handle_component_rpath(component_root_path, '/lib')
Exemple #3
0
def bitness_flags(bitness):
    if bitness == 64:
        flags = ['-DLLVM_TARGETS_TO_BUILD=AArch64']
    else:
        flags = ['-DLLVM_TARGETS_TO_BUILD=X86']
        if bldinstallercommon.is_linux_platform():
            flags.extend(['-DLIBXML2_LIBRARIES=/usr/lib/libxml2.so', '-DLLVM_BUILD_32_BITS=ON'])
    return flags
Exemple #4
0
def get_static_qt_configure_options(openssl_dir):
    options = get_common_qt_configure_options() + '-static -no-sql-sqlite '
    if bldinstallercommon.is_mac_platform():
        options += '-no-securetransport '
    options += '-openssl-linked '
    if (bldinstallercommon.is_linux_platform() or bldinstallercommon.is_mac_platform()) and openssl_dir:
        options += '-I {0}/include -L {0}/lib '.format(openssl_dir)
    if platform.system().lower().startswith('win'):
        options += '-static-runtime '
        if openssl_dir:
            options += 'OPENSSL_LIBS="-lssleay32MT -llibeay32MT -lcrypt32 -lgdi32" '
            options += '-I {0}\\include -L {0}\\lib\\VC\\static '.format(openssl_dir)
    return options
Exemple #5
0
def add_common_commandline_arguments(parser):
    if bldinstallercommon.is_win_platform():
        parser.epilog = "example: " + os.linesep + "\tpython {0} --clean " \
            "--buildcommand C:\\bin\\ibjom.cmd --installcommand nmake " \
            "--qt-module http://it-dl241-hki.it.local/packages/qt/5.5.0-released/windows_vs2013_32/qt_all.7z " \
            "--sevenzippath \"C:\\Program Files\\7-Zip\" " \
            "--gitpath \"C:\\Program Files (x86)\\Git\\cmd\" "\
            "--d3dcompiler7z http://download.qt.io/development_releases/prebuilt/d3dcompiler/msvc2010/D3DCompiler_43-x86.dll.7z " \
            "--opengl32sw7z http://download.qt.io/development_releases/prebuilt/llvmpipe/windows/opengl32sw-32.7z " \
            "--environment_batch \"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat\" " \
            "--environment_batch_argument x86" \
            "".format(os.path.basename(sys.argv[0]))
    elif bldinstallercommon.is_mac_platform():
        parser.epilog = "example: " + os.linesep + "\tpython {0} --clean " \
            "--qt-module http://it-dl241-hki.it.local/packages/qt/5.0.1-released/mac_cocoa_10.7/qt_all.7z" \
            "".format(os.path.basename(sys.argv[0]))
    else:
        parser.epilog = "example: " + os.linesep + "\tpython {0} --clean " \
            "--qt-module http://it-dl241-hki.it.local/packages/qt/5.0.1-released/linux_gcc_64_ubuntu1110/qt_all.7z " \
            "--icu7z http://it-dl241-hki.it.local/packages/qt/5.0.1-released/linux_gcc_64_ubuntu1110/libicu_x86_64_ubuntu1110.7z" \
            "".format(os.path.basename(sys.argv[0]))

    # general arguments
    parser.add_argument('--clean', help="clean up everything from old builds", action='store_true', default=False)
    parser.add_argument('--buildcommand', help="this means usually make", default="make")
    parser.add_argument('--installcommand', help="this means usually make", default="make")
    parser.add_argument('--debug', help="use debug builds", action='store_true', default=False)
    parser.add_argument('--qt-module', help="Qt module package url (.7z) needed for building",
        action='append', dest='qt_modules')
    parser.add_argument('--add-qmake-argument', help='Adds an argument to the qmake command line',
        dest='additional_qmake_arguments', action='append')

    if bldinstallercommon.is_linux_platform():
        parser.add_argument('--icu7z', help="a file or url where it get icu libs as 7z", required=True)

    # if we are on windows, maybe we want some other arguments
    if bldinstallercommon.is_win_platform():
        parser.add_argument('--d3dcompiler7z', help="a file or url where it get d3dcompiler lib")
        parser.add_argument('--opengl32sw7z', help="a file or url where it get d3dcompiler lib")
        parser.add_argument('--openssl7z', help="a file or url where to get the openssl libs as 7z")
        parser.add_argument('--environment_batch', help="batch file that sets up environment")
        parser.add_argument('--environment_batch_argument', help="if the batch file needs an argument just add it with this argument")
        parser.add_argument('--sevenzippath', help="path where the 7zip binary is located")
        parser.add_argument('--gitpath', help="path where the git binary is located")
Exemple #6
0
def create_installer_package(options):
    print('--------------------------------------------------------------------')
    print('Creating installer for Qt Installer Framework')
    # Temporary dir for creating installer containing the Qt Installer Framework itself
    package_dir = options.installer_framework_pkg_dir
    os.makedirs(package_dir)
    # Final directory for the installer containing the Qt Installer Framework itself
    os.makedirs(options.installer_framework_target_dir)
    target_dir = os.path.join(options.installer_framework_target_dir, 'QtInstallerFramework' + '-' + options.plat_suffix + '-' + options.architecture)

    current_dir = os.getcwd()
    os.chdir(package_dir)
    shutil.copytree(os.path.join(options.installer_framework_build_dir, 'bin'), os.path.join(package_dir, 'bin'), ignore = shutil.ignore_patterns("*.exe.manifest","*.exp","*.lib"))
    if sys.platform == 'linux2':
        bldinstallercommon.do_execute_sub_process(args=('strip', os.path.join(package_dir, 'bin/archivegen')), execution_path=package_dir)
        bldinstallercommon.do_execute_sub_process(args=('strip', os.path.join(package_dir, 'bin/binarycreator')), execution_path=package_dir)
        bldinstallercommon.do_execute_sub_process(args=('strip', os.path.join(package_dir, 'bin/devtool')), execution_path=package_dir)
        bldinstallercommon.do_execute_sub_process(args=('strip', os.path.join(package_dir, 'bin/installerbase')), execution_path=package_dir)
        bldinstallercommon.do_execute_sub_process(args=('strip', os.path.join(package_dir, 'bin/repogen')), execution_path=package_dir)
    shutil.copytree(os.path.join(options.installer_framework_build_dir, 'doc'), os.path.join(package_dir, 'doc'))
    shutil.copytree(os.path.join(options.installer_framework_source_dir, 'examples'), os.path.join(package_dir, 'examples'))
    shutil.copy(os.path.join(options.installer_framework_source_dir, 'README'), package_dir)
    # pack payload into separate .7z archive for later usage
    cmd_args = ['7z', 'a', options.installer_framework_payload_arch, package_dir]
    bldinstallercommon.do_execute_sub_process(cmd_args, ROOT_DIR)
    shutil.move(os.path.join(ROOT_DIR, options.installer_framework_payload_arch), options.build_artifacts_dir)
    # create 7z
    archive_file = os.path.join(options.installer_framework_source_dir, 'dist', 'packages', 'org.qtproject.ifw.binaries', 'data', 'data.7z')
    if not os.path.exists(os.path.dirname(archive_file)):
        os.makedirs(os.path.dirname(archive_file))
    bldinstallercommon.do_execute_sub_process(args=(os.path.join(package_dir, 'bin', 'archivegen'), archive_file, '*'), execution_path=package_dir)
    # run installer
    binary_creator = os.path.join(options.installer_framework_build_dir, 'bin', 'binarycreator')
    config_file = os.path.join(options.installer_framework_source_dir, 'dist', 'config', 'config.xml')
    package_dir = os.path.join(options.installer_framework_source_dir, 'dist', 'packages')
    bldinstallercommon.do_execute_sub_process(args=(binary_creator, '--offline-only', '-c', config_file, '-p', package_dir, target_dir), execution_path=package_dir)
    print('Installer package is at: {0}'.format(target_dir))
    artifacts = os.listdir(options.installer_framework_target_dir)
    for artifact in artifacts:
        destFileName = os.path.join(options.build_artifacts_dir, artifact)
        if bldinstallercommon.is_linux_platform():
            destFileName += '.run'
        shutil.move(os.path.join(options.installer_framework_target_dir, artifact), destFileName)
    os.chdir(current_dir)
Exemple #7
0
def get_icu_env(icu_lib_path, icu_include_path):
    if not os.path.isdir(icu_lib_path) or not os.path.isdir(icu_include_path):
        return
    icu_environment = dict()
    if bldinstallercommon.is_linux_platform():
        icu_environment['LD_LIBRARY_PATH'] = icu_lib_path
        icu_environment['LIBRARY_PATH'] = icu_lib_path
        icu_environment['CPLUS_INCLUDE_PATH'] = icu_include_path
        icu_environment['CPATH'] = icu_include_path
    elif bldinstallercommon.is_mac_platform():
        print('*** ICU build for macOS not implemented yet!')
    elif bldinstallercommon.is_win_platform():
        icu_environment['PATH'] = icu_lib_path
        icu_environment['LIB'] = icu_lib_path
        icu_environment['INCLUDE'] = icu_include_path
    else:
        print('*** Unsupported platform')

    return icu_environment
Exemple #8
0
def get_common_environment(qt5_path, caller_arguments):
    # PATH
    path_list = []
    # -- Qt
    path_list.append(os.path.abspath(os.path.join(qt5_path, 'bin')))
    # -- python
    path_list.append(os.path.dirname(sys.executable))
    if hasattr(caller_arguments, 'sevenzippath') and caller_arguments.sevenzippath:
        path_list.append(caller_arguments.sevenzippath)
    if hasattr(caller_arguments, 'gitpath') and caller_arguments.gitpath:
        path_list.append(caller_arguments.gitpath)

    environment = {"PATH": os.pathsep.join(path_list)}
    if bldinstallercommon.is_linux_platform():
        environment["LD_LIBRARY_PATH"] = os.path.join(qt5_path, 'lib')
        environment["QMAKESPEC"] = "linux-g++"
    if bldinstallercommon.is_mac_platform():
        environment["DYLD_FRAMEWORK_PATH"] = os.path.join(qt5_path, 'lib')
    if not bldinstallercommon.is_win_platform():
        environment["MAKEFLAGS"] = "-j" + str(multiprocessing.cpu_count() + 1)
    return environment
Exemple #9
0
def init_build_icu(icu_src, icu_version = '', archive_icu = False, environment = dict(os.environ)):
    # clean up first
    cleanup_icu()
    icu_src_dir = os.path.join(SCRIPT_ROOT_DIR, ICU_SRC_DIR_NAME)
    # what to do
    if not icu_src:
        print('*** Error! You asked to build the ICU but did not tell from where to find the sources?')
        sys.exit(-1)
    if icu_src.endswith('git'):
        if not icu_version:
            print('*** Error! You asked to clone ICU sources from git repository but did not tell from which branch/tag/sha?')
            sys.exit(-1)
        bldinstallercommon.clone_repository(icu_src, icu_version, icu_src_dir)
    else:
        if not bldinstallercommon.is_content_url_valid(icu_src):
            print('*** Error! The given URL for ICU sources is not valid: {0}'.format(icu_src))
            sys.exit(-1)
        package_save_as_temp = os.path.join(SCRIPT_ROOT_DIR, os.path.basename(icu_src))
        bldinstallercommon.create_dirs(icu_src_dir)
        print('Downloading ICU src package: ' + icu_src)
        bldinstallercommon.retrieve_url(icu_src, package_save_as_temp)
        bldinstallercommon.extract_file(package_save_as_temp, icu_src_dir)
    # now build the icu
    icu_configuration = None
    if bldinstallercommon.is_linux_platform():
        icu_configuration = build_icu_linux(environment, os.path.join(SCRIPT_ROOT_DIR, icu_src_dir), archive_icu)
    elif bldinstallercommon.is_mac_platform():
        print('*** ICU build for macOS not implemented yet!')
    elif bldinstallercommon.is_win_platform():
        icu_configuration = build_icu_win(environment, os.path.join(SCRIPT_ROOT_DIR, icu_src_dir), archive_icu)
    else:
        print('*** Unsupported platform')
    # set options for Qt5 build
    extra_qt_configure_args = ' -L' + icu_configuration.icu_lib_path
    extra_qt_configure_args += ' -I' + icu_configuration.icu_include_path
    icu_configuration.qt_configure_extra_args = extra_qt_configure_args
    icu_configuration.environment = get_icu_env(icu_configuration.icu_lib_path, icu_configuration.icu_include_path)
    return icu_configuration
Exemple #10
0
def patch_build():
    # replace build directory paths in install_root locations
    replace_build_paths(MAKE_INSTALL_ROOT_DIR)
    # remove system specific paths from qconfig.pri
    if not ANDROID_BUILD and not QNX_BUILD:
        replace_system_paths()
    # fix qmake prl build fir references
    erase_qmake_prl_build_dir()
    if ANDROID_BUILD:
        if bldinstallercommon.is_win_platform():
            install_path = MAKE_INSTALL_ROOT_DIR + os.sep + SINGLE_INSTALL_DIR_NAME
            install_path = 'C' + install_path[1:]
            lib_path_essentials = os.path.normpath(install_path + os.sep + INSTALL_PREFIX + os.sep)
            bldinstallercommon.rename_android_soname_files(lib_path_essentials)
        patch_android_prl_files()
    if QNX_BUILD:
        patch_qnx6_files('lib', 'libQt5.*\.prl', 'QMAKE_PRL_LIBS', '-L[^ ]* ')
        patch_qnx6_files('lib', 'libQt5.*\.la', 'dependency_libs', '-L[^ ]* ')
        # QT-701: internal qnx bug report
        patch_qnx6_files('common', 'qcc-base-qnx\.conf', 'QMAKE_LFLAGS ', '\n', ' -Wl,-rpath-link,$$[QT_INSTALL_LIBS]')
        patch_qnx6_files('pkgconfig', 'Qt5.*\.pc', 'Libs.private', '-L[^ ]* ')
    # patch RPath if requested
    if QT_BUILD_OPTIONS.replace_rpath:
        replace_rpath()
    # patch icu_install paths from files
    if bldinstallercommon.is_linux_platform():
        bld_icu_tools.patch_icu_paths(MAKE_INSTALL_ROOT_DIR)
    # make sure the 'fixqt4headers.pl' ends up in final package if it does not exist there already
    fixqt4headers_filename = 'fixqt4headers.pl'
    fixqt4headers_file = bldinstallercommon.locate_file(MAKE_INSTALL_ROOT_DIR, fixqt4headers_filename)
    if not fixqt4headers_file:
        # copy it from the used src package
        fixqt4headers_file = bldinstallercommon.locate_file(QT_SOURCE_DIR, fixqt4headers_filename)
        target_dir = bldinstallercommon.locate_directory(os.path.join(MAKE_INSTALL_ROOT_DIR, ESSENTIALS_INSTALL_DIR_NAME), 'bin')
        if fixqt4headers_file and target_dir:
            shutil.copy(fixqt4headers_file, target_dir)
Exemple #11
0
def handle_module_doc_build(optionDict):
    if not bldinstallercommon.is_linux_platform():
        raise RuntimeError(
            '*** Only Linux platform supported currently to perform doc builds. Aborting'
        )
    if not 'MODULE_NAME' in optionDict:
        print(
            '*** MODULE_NAME environment variable not defined. Unable to generate doc for this package.'
        )
        return
    if not 'MODULE_SRC_PACKAGE_URI' in optionDict:
        print(
            '*** MODULE_SRC_PACKAGE_URI environment variable not defined. Unable to generate doc for this package.'
        )
        return
    if not 'MODULE_DOC_BUILD_QT_PACKAGE_URI' in optionDict:
        print(
            '*** MODULE_DOC_BUILD_QT_PACKAGE_URI environment variable not defined. Unable to generate doc for this package.'
        )
        return
    module_src_package_uri = optionDict['MODULE_SRC_PACKAGE_URI']
    module_doc_build_qt_package_uri = optionDict[
        'MODULE_DOC_BUILD_QT_PACKAGE_URI']
    module_doc_build_qt_dependency_package_uri = optionDict.get(
        'MODULE_DOC_BUILD_QT_DEPENDENCY_PACKAGE_URI', '')
    module_doc_build_qt_icu_package_uri = optionDict.get(
        'MODULE_DOC_BUILD_QT_ICU_PACKAGE_URI', '')
    # define some paths
    current_path = os.path.dirname(os.path.realpath(__file__))
    qt_package_path = os.path.join(current_path, 'doc_build_qt_package')
    qt_icu_path = os.path.join(current_path, 'doc_build_qt_icu_package')
    module_src_path = os.path.join(current_path, 'module_src_package')

    shutil.rmtree(qt_package_path, ignore_errors=True)
    shutil.rmtree(qt_icu_path, ignore_errors=True)
    shutil.rmtree(module_src_path, ignore_errors=True)

    bldinstallercommon.create_dirs(qt_package_path)
    bldinstallercommon.create_dirs(module_src_path)
    bldinstallercommon.create_dirs(qt_icu_path)

    # fetch module src package
    raw_name_module_src_package = module_src_package_uri.rsplit(
        '/', 1)[-1]  # get last item from array
    downloaded_module_archive = os.path.join(current_path,
                                             raw_name_module_src_package)
    os.remove(downloaded_module_archive) if os.path.isfile(
        downloaded_module_archive) else None
    print('Starting to download: {0}'.format(module_src_package_uri))
    bldinstallercommon.retrieve_url(module_src_package_uri,
                                    downloaded_module_archive)
    bldinstallercommon.extract_file(downloaded_module_archive, module_src_path)

    # fetch qt binary package
    raw_name_qt_bin_package = module_doc_build_qt_package_uri.rsplit(
        '/', 1)[-1]  # get last item from array
    downloaded_qt_bin_archive = os.path.join(current_path,
                                             raw_name_qt_bin_package)
    os.remove(downloaded_qt_bin_archive) if os.path.isfile(
        downloaded_qt_bin_archive) else None
    print('Starting to download: {0}'.format(module_doc_build_qt_package_uri))
    bldinstallercommon.retrieve_url(module_doc_build_qt_package_uri,
                                    downloaded_qt_bin_archive)
    bldinstallercommon.extract_file(downloaded_qt_bin_archive, qt_package_path)

    # fetch qt dependency package (optional)
    if bldinstallercommon.is_content_url_valid(
            module_doc_build_qt_dependency_package_uri):
        raw_name_qt_bin_dependency_package = module_doc_build_qt_dependency_package_uri.rsplit(
            '/', 1)[-1]  # get last item from array
        downloaded_qt_dependency_bin_archive = os.path.join(
            current_path, raw_name_qt_bin_dependency_package)
        if os.path.lexists(downloaded_qt_dependency_bin_archive):
            print(
                '*** Deleted existing qt binary dependency package: [{0}] before fetching the new one.'
                .format(downloaded_qt_dependency_bin_archive))
            os.remove(downloaded_qt_dependency_bin_archive)
        print('Starting to download: {0}'.format(
            module_doc_build_qt_dependency_package_uri))
        bldinstallercommon.retrieve_url(
            module_doc_build_qt_dependency_package_uri,
            downloaded_qt_dependency_bin_archive)
        bldinstallercommon.extract_file(downloaded_qt_dependency_bin_archive,
                                        qt_package_path)
    # fetch qt icu binary package if given
    if module_doc_build_qt_icu_package_uri:
        raw_name_qt_icu_package = module_doc_build_qt_icu_package_uri.rsplit(
            '/', 1)[-1]  # get last item from array
        downloaded_qt_icu_archive = os.path.join(current_path,
                                                 raw_name_qt_icu_package)
        if os.path.lexists(downloaded_qt_icu_archive):
            print(
                '*** Deleted existing qt icu package: [{0}] before fetching the new one.'
                .format(downloaded_qt_icu_archive))
            os.remove(downloaded_qt_icu_archive)
        print('Starting to download: {0} -> into {1}'.format(
            module_doc_build_qt_icu_package_uri, downloaded_qt_icu_archive))
        bldinstallercommon.retrieve_url(module_doc_build_qt_icu_package_uri,
                                        downloaded_qt_icu_archive)
        qt_lib_directory = bldinstallercommon.locate_directory(
            qt_package_path, 'lib')
        print('Extracting icu libs into: {0}'.format(qt_lib_directory))
        bldinstallercommon.extract_file(downloaded_qt_icu_archive,
                                        qt_lib_directory)
    # patch Qt package
    qt_bin_directory = bldinstallercommon.locate_directory(
        qt_package_path, 'bin')
    if not os.path.exists(qt_bin_directory):
        raise IOError('*** Unable to locate bin directory from: %s' %
                      qt_bin_directory)
    qtConfFile = open(os.path.join(qt_bin_directory, 'qt.conf'), "w")
    qtConfFile.write("[Paths]" + os.linesep)
    qtConfFile.write("Prefix=.." + os.linesep)
    qtConfFile.close()
    qt_directory = os.path.dirname(qt_bin_directory)
    #bldinstallercommon.handle_component_rpath(qt_directory, 'lib')
    # locate tools
    qmake_binary = bldinstallercommon.locate_executable(qt_directory, 'qmake')
    print('Using qmake from: {0}'.format(qmake_binary))
    # locate module .pro file
    module_pro_file = bldinstallercommon.locate_file(module_src_path, '*.pro')
    # build module
    module_build_environment = dict(os.environ)
    module_build_environment["LD_LIBRARY_PATH"] = os.pathsep.join(
        [os.path.join(qt_package_path, 'lib')] +
        optionDict.get("LD_LIBRARY_PATH", "").split(os.pathsep))
    module_build_environment["QMAKESPEC"] = "linux-g++"
    cpu_count = ["-j" + str(multiprocessing.cpu_count() + 1)]
    print('Using .pro file from: {0}'.format(module_pro_file))
    bld_args = [qmake_binary, module_pro_file]
    bldinstallercommon.do_execute_sub_process(
        args=bld_args,
        execution_path=os.path.dirname(module_pro_file),
        abort_on_fail=False,
        extra_env=module_build_environment)
    bld_args = ['make'] + cpu_count
    bldinstallercommon.do_execute_sub_process(
        args=bld_args,
        execution_path=os.path.dirname(module_pro_file),
        abort_on_fail=False,
        extra_env=module_build_environment)
    # make docs
    bld_args = ['make', '-j1', 'docs']
    bldinstallercommon.do_execute_sub_process(
        args=bld_args,
        execution_path=os.path.dirname(module_pro_file),
        abort_on_fail=False,
        extra_env=module_build_environment)
    # make install docs
    module_doc_install_dir = module_src_path = os.path.join(
        current_path, 'module_doc_install_dir')
    bld_args = [
        'make', '-j1', 'install_docs', 'INSTALL_ROOT=' + module_doc_install_dir
    ]
    bldinstallercommon.do_execute_sub_process(
        args=bld_args,
        execution_path=os.path.dirname(module_pro_file),
        abort_on_fail=False,
        extra_env=module_build_environment)
    # create archive
    doc_dir = bldinstallercommon.locate_directory(module_doc_install_dir,
                                                  'doc')
    if not os.path.exists(doc_dir):
        print('Warning! Doc archive not generated!')
        return
    archive_name = optionDict['MODULE_NAME'] + '-' + optionDict[
        'LICENSE'] + '-doc-' + optionDict['MODULE_VERSION'] + '.7z'
    archive_path = os.path.join(current_path, 'doc_archives', archive_name)
    bld_args = ['7z', 'a', archive_path, 'doc']
    bldinstallercommon.do_execute_sub_process(
        args=bld_args,
        execution_path=os.path.dirname(doc_dir),
        abort_on_fail=False)
    if os.path.exists(archive_path):
        print('Doc archive generated successfully: {0}'.format(archive_path))
Exemple #12
0
def bitness_flags(bitness):
    if bitness == 32 and bldinstallercommon.is_linux_platform():
        return ['-DLIBXML2_LIBRARIES=/usr/lib/libxml2.so', '-DLLVM_BUILD_32_BITS=ON']
    return []
    qtCreatorProFile = os.path.join(qtCreatorSourceDirectory, 'qtcreator.pro')

    qmakeCommand = [
        qmakeBinary, qtCreatorProFile,
        'QTC_PREFIX=' + qtCreatorInstallDirectory,
        'DEFINES+=IDE_REVISION=' + buildGitSHA,
        'DEFINES+=IDE_REVISION_URL=https://code.qt.io/cgit/qt-creator/qt-creator.git/log/?id='
        + buildGitSHA, 'CONFIG+=' + buildType, 'CONFIG+=force_debug_info',
        'CONFIG+=separate_debug_info'
    ]

    # perfparser for Qt Creator >= 4.9
    if callerArguments.elfutils_path:
        qmakeCommand.append('ELFUTILS_INSTALL_DIR=' +
                            callerArguments.elfutils_path)
        if bldinstallercommon.is_linux_platform():
            elfutils_install_path = qtCreatorInstallDirectory + '/lib/elfutils'
            qmakeCommand.append('PERFPARSER_ELFUTILS_INSTALLDIR=' +
                                elfutils_install_path)
            qmakeCommand.append('PERFPARSER_ELFUTILS_BACKENDS_INSTALLDIR=' +
                                elfutils_install_path)
        if bldinstallercommon.is_win_platform():
            qmakeCommand.append('PERFPARSER_ELFUTILS_INSTALLDIR=' +
                                qtCreatorInstallDirectory + '/bin')
            qmakeCommand.append('PERFPARSER_ELFUTILS_BACKENDS_INSTALLDIR=' +
                                qtCreatorInstallDirectory + '/lib/elfutils')

    if bldinstallercommon.is_mac_platform():
        qmakeCommand.append('QMAKE_MAC_SDK=macosx')  # work around QTBUG-41238

    if bldinstallercommon.is_win_platform():  # allow app to run on Windows XP
Exemple #14
0
def add_common_commandline_arguments(parser):
    if bldinstallercommon.is_win_platform():
        parser.epilog = "example: " + os.linesep + "\tpython {0} --clean " \
            "--buildcommand C:\\bin\\ibjom.cmd --installcommand nmake " \
            "--qt-module http://it-dl241-hki.it.local/packages/qt/5.5.0-released/windows_vs2013_32/qt_all.7z " \
            "--sevenzippath \"C:\\Program Files\\7-Zip\" " \
            "--gitpath \"C:\\Program Files (x86)\\Git\\cmd\" "\
            "--d3dcompiler7z http://download.qt.io/development_releases/prebuilt/d3dcompiler/msvc2010/D3DCompiler_43-x86.dll.7z " \
            "--opengl32sw7z http://download.qt.io/development_releases/prebuilt/llvmpipe/windows/opengl32sw-32.7z " \
            "--environment_batch \"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat\" " \
            "--environment_batch_argument x86" \
            "".format(os.path.basename(sys.argv[0]))
    elif bldinstallercommon.is_mac_platform():
        parser.epilog = "example: " + os.linesep + "\tpython {0} --clean " \
            "--qt-module http://it-dl241-hki.it.local/packages/qt/5.0.1-released/mac_cocoa_10.7/qt_all.7z" \
            "".format(os.path.basename(sys.argv[0]))
    else:
        parser.epilog = "example: " + os.linesep + "\tpython {0} --clean " \
            "--qt-module http://it-dl241-hki.it.local/packages/qt/5.0.1-released/linux_gcc_64_ubuntu1110/qt_all.7z " \
            "--icu7z http://it-dl241-hki.it.local/packages/qt/5.0.1-released/linux_gcc_64_ubuntu1110/libicu_x86_64_ubuntu1110.7z" \
            "".format(os.path.basename(sys.argv[0]))

    # general arguments
    parser.add_argument('--clean',
                        help="clean up everything from old builds",
                        action='store_true',
                        default=False)
    parser.add_argument('--buildcommand',
                        help="this means usually make",
                        default="make")
    parser.add_argument('--installcommand',
                        help="this means usually make",
                        default="make")
    parser.add_argument('--debug',
                        help="use debug builds",
                        action='store_true',
                        default=False)
    parser.add_argument('--qt-module',
                        help="Qt module package url (.7z) needed for building",
                        action='append',
                        dest='qt_modules')

    if bldinstallercommon.is_linux_platform():
        parser.add_argument('--icu7z',
                            help="a file or url where it get icu libs as 7z",
                            required=True)

    # if we are on windows, maybe we want some other arguments
    if bldinstallercommon.is_win_platform():
        parser.add_argument('--d3dcompiler7z',
                            help="a file or url where it get d3dcompiler lib")
        parser.add_argument('--opengl32sw7z',
                            help="a file or url where it get d3dcompiler lib")
        parser.add_argument(
            '--openssl7z',
            help="a file or url where to get the openssl libs as 7z")
        parser.add_argument('--environment_batch',
                            help="batch file that sets up environment")
        parser.add_argument(
            '--environment_batch_argument',
            help=
            "if the batch file needs an argument just add it with this argument"
        )
        parser.add_argument('--sevenzippath',
                            help="path where the 7zip binary is located")
        parser.add_argument('--gitpath',
                            help="path where the git binary is located")
Exemple #15
0
def create_installer_package(options):
    print(
        '--------------------------------------------------------------------')
    print('Creating installer for Qt Installer Framework')
    # Temporary dir for creating installer containing the Qt Installer Framework itself
    package_dir = options.installer_framework_pkg_dir
    os.makedirs(package_dir)
    # Final directory for the installer containing the Qt Installer Framework itself
    os.makedirs(options.installer_framework_target_dir)
    target_dir = os.path.join(
        options.installer_framework_target_dir, 'QtInstallerFramework' + '-' +
        options.plat_suffix + '-' + options.architecture)

    current_dir = os.getcwd()
    os.chdir(package_dir)
    shutil.copytree(os.path.join(options.installer_framework_build_dir, 'bin'),
                    os.path.join(package_dir, 'bin'),
                    ignore=shutil.ignore_patterns("*.exe.manifest", "*.exp",
                                                  "*.lib"))
    if sys.platform == 'linux2':
        bldinstallercommon.do_execute_sub_process(
            args=('strip', os.path.join(package_dir, 'bin/archivegen')),
            execution_path=package_dir)
        bldinstallercommon.do_execute_sub_process(
            args=('strip', os.path.join(package_dir, 'bin/binarycreator')),
            execution_path=package_dir)
        bldinstallercommon.do_execute_sub_process(
            args=('strip', os.path.join(package_dir, 'bin/devtool')),
            execution_path=package_dir)
        bldinstallercommon.do_execute_sub_process(
            args=('strip', os.path.join(package_dir, 'bin/installerbase')),
            execution_path=package_dir)
        bldinstallercommon.do_execute_sub_process(
            args=('strip', os.path.join(package_dir, 'bin/repogen')),
            execution_path=package_dir)
    shutil.copytree(os.path.join(options.installer_framework_build_dir, 'doc'),
                    os.path.join(package_dir, 'doc'))
    shutil.copytree(
        os.path.join(options.installer_framework_source_dir, 'examples'),
        os.path.join(package_dir, 'examples'))
    shutil.copy(os.path.join(options.installer_framework_source_dir, 'README'),
                package_dir)
    # pack payload into separate .7z archive for later usage
    cmd_args = [
        '7z', 'a', options.installer_framework_payload_arch, package_dir
    ]
    bldinstallercommon.do_execute_sub_process(cmd_args, ROOT_DIR)
    shutil.move(
        os.path.join(ROOT_DIR, options.installer_framework_payload_arch),
        options.build_artifacts_dir)
    # create 7z
    archive_file = os.path.join(options.installer_framework_source_dir, 'dist',
                                'packages', 'org.qtproject.ifw.binaries',
                                'data', 'data.7z')
    if not os.path.exists(os.path.dirname(archive_file)):
        os.makedirs(os.path.dirname(archive_file))
    bldinstallercommon.do_execute_sub_process(args=(os.path.join(
        package_dir, 'bin', 'archivegen'), archive_file, '*'),
                                              execution_path=package_dir)
    # run installer
    binary_creator = os.path.join(options.installer_framework_build_dir, 'bin',
                                  'binarycreator')
    config_file = os.path.join(options.installer_framework_source_dir, 'dist',
                               'config', 'config.xml')
    package_dir = os.path.join(options.installer_framework_source_dir, 'dist',
                               'packages')
    bldinstallercommon.do_execute_sub_process(
        args=(binary_creator, '--offline-only', '-c', config_file, '-p',
              package_dir, target_dir),
        execution_path=package_dir)
    print('Installer package is at: {0}'.format(target_dir))
    artifacts = os.listdir(options.installer_framework_target_dir)
    for artifact in artifacts:
        destFileName = os.path.join(options.build_artifacts_dir, artifact)
        if bldinstallercommon.is_linux_platform():
            destFileName += '.run'
        shutil.move(
            os.path.join(options.installer_framework_target_dir, artifact),
            destFileName)
    os.chdir(current_dir)
Exemple #16
0
def bitness_flags(bitness):
    if bitness == 32 and bldinstallercommon.is_linux_platform():
        return ['-DLIBXML2_LIBRARIES=/usr/lib/libxml2.so', '-DLLVM_BUILD_32_BITS=ON']
    return []
Exemple #17
0
def qt_static_platform_configure_options():
    if bldinstallercommon.is_win_platform():
        return ['-static-runtime', '-no-icu', '-mp']
    elif bldinstallercommon.is_linux_platform():
        return ['-no-icu', '-no-glib', '-qt-zlib', '-qt-pcre']
    return []
Exemple #18
0
    else:
        buildType = 'release'
    buildGitSHA = gitSHA(qtCreatorSourceDirectory, callerArguments)
    qtCreatorProFile = os.path.join(qtCreatorSourceDirectory, 'qtcreator.pro')

    qmakeCommand = [qmakeBinary, qtCreatorProFile,
        'QTC_PREFIX=' + qtCreatorInstallDirectory,
        'DEFINES+=IDE_REVISION=' + buildGitSHA,
        'CONFIG+=' + buildType,
        'CONFIG+=force_debug_info',
        'CONFIG+=separate_debug_info']

    # perfparser for Qt Creator >= 4.9
    if callerArguments.elfutils_path:
        qmakeCommand.append('ELFUTILS_INSTALL_DIR=' + callerArguments.elfutils_path)
        if bldinstallercommon.is_linux_platform():
            elfutils_install_path = qtCreatorInstallDirectory + '/lib/elfutils'
            qmakeCommand.append('PERFPARSER_ELFUTILS_INSTALLDIR=' + elfutils_install_path)
            qmakeCommand.append('PERFPARSER_ELFUTILS_BACKENDS_INSTALLDIR=' + elfutils_install_path)
        if bldinstallercommon.is_win_platform():
            qmakeCommand.append('PERFPARSER_ELFUTILS_INSTALLDIR=' + qtCreatorInstallDirectory + '/bin')
            qmakeCommand.append('PERFPARSER_ELFUTILS_BACKENDS_INSTALLDIR=' + qtCreatorInstallDirectory + '/lib/elfutils')

    if bldinstallercommon.is_mac_platform():
        qmakeCommand.append('QMAKE_MAC_SDK=macosx') # work around QTBUG-41238

    if bldinstallercommon.is_win_platform():  # allow app to run on Windows XP
        qmakeCommand.append('QMAKE_LFLAGS_WINDOWS=/SUBSYSTEM:WINDOWS,5.01')
        # skip compilation of cdbextension and wininterrupt, they are built separately below
        qmakeCommand.append('QTC_SKIP_CDBEXT=1')
        qmakeCommand.append('QTC_SKIP_WININTERRUPT=1')
Exemple #19
0
def qt_static_platform_configure_options():
    if bldinstallercommon.is_win_platform():
        return ['-static-runtime', '-no-icu', '-mp']
    elif bldinstallercommon.is_linux_platform():
        return ['-no-icu', '-no-glib', '-qt-zlib', '-qt-pcre']
    return []
Exemple #20
0
def handle_module_doc_build(optionDict):
    if not bldinstallercommon.is_linux_platform():
        raise RuntimeError('*** Only Linux platform supported currently to perform doc builds. Aborting')
    if not 'MODULE_NAME' in optionDict:
        print('*** MODULE_NAME environment variable not defined. Unable to generate doc for this package.')
        return
    if not 'MODULE_SRC_PACKAGE_URI' in optionDict:
        print('*** MODULE_SRC_PACKAGE_URI environment variable not defined. Unable to generate doc for this package.')
        return
    if not 'MODULE_DOC_BUILD_QT_PACKAGE_URI' in optionDict:
        print('*** MODULE_DOC_BUILD_QT_PACKAGE_URI environment variable not defined. Unable to generate doc for this package.')
        return
    module_src_package_uri = optionDict['MODULE_SRC_PACKAGE_URI']
    module_doc_build_qt_package_uri = optionDict['MODULE_DOC_BUILD_QT_PACKAGE_URI']
    module_doc_build_qt_dependency_package_uri = optionDict.get('MODULE_DOC_BUILD_QT_DEPENDENCY_PACKAGE_URI', '')
    module_doc_build_qt_icu_package_uri = optionDict.get('MODULE_DOC_BUILD_QT_ICU_PACKAGE_URI', '')
    # define some paths
    current_path = os.path.dirname(os.path.realpath(__file__))
    qt_package_path = os.path.join(current_path, 'doc_build_qt_package')
    qt_icu_path = os.path.join(current_path, 'doc_build_qt_icu_package')
    module_src_path = os.path.join(current_path, 'module_src_package')

    shutil.rmtree(qt_package_path, ignore_errors=True)
    shutil.rmtree(qt_icu_path, ignore_errors=True)
    shutil.rmtree(module_src_path, ignore_errors=True)

    bldinstallercommon.create_dirs(qt_package_path)
    bldinstallercommon.create_dirs(module_src_path)
    bldinstallercommon.create_dirs(qt_icu_path)

    # fetch module src package
    raw_name_module_src_package = module_src_package_uri.rsplit('/', 1)[-1] # get last item from array
    downloaded_module_archive = os.path.join(current_path, raw_name_module_src_package)
    os.remove(downloaded_module_archive) if os.path.isfile(downloaded_module_archive) else None
    print('Starting to download: {0}'.format(module_src_package_uri))
    bldinstallercommon.retrieve_url(module_src_package_uri, downloaded_module_archive)
    bldinstallercommon.extract_file(downloaded_module_archive, module_src_path)

    # fetch qt binary package
    raw_name_qt_bin_package = module_doc_build_qt_package_uri.rsplit('/', 1)[-1] # get last item from array
    downloaded_qt_bin_archive = os.path.join(current_path, raw_name_qt_bin_package)
    os.remove(downloaded_qt_bin_archive) if os.path.isfile(downloaded_qt_bin_archive) else None
    print('Starting to download: {0}'.format(module_doc_build_qt_package_uri))
    bldinstallercommon.retrieve_url(module_doc_build_qt_package_uri, downloaded_qt_bin_archive)
    bldinstallercommon.extract_file(downloaded_qt_bin_archive, qt_package_path)

    # fetch qt dependency package (optional)
    if bldinstallercommon.is_content_url_valid(module_doc_build_qt_dependency_package_uri):
        raw_name_qt_bin_dependency_package = module_doc_build_qt_dependency_package_uri.rsplit('/', 1)[-1] # get last item from array
        downloaded_qt_dependency_bin_archive = os.path.join(current_path, raw_name_qt_bin_dependency_package)
        if os.path.lexists(downloaded_qt_dependency_bin_archive):
            print('*** Deleted existing qt binary dependency package: [{0}] before fetching the new one.'.format(downloaded_qt_dependency_bin_archive))
            os.remove(downloaded_qt_dependency_bin_archive)
        print('Starting to download: {0}'.format(module_doc_build_qt_dependency_package_uri))
        bldinstallercommon.retrieve_url(module_doc_build_qt_dependency_package_uri, downloaded_qt_dependency_bin_archive)
        bldinstallercommon.extract_file(downloaded_qt_dependency_bin_archive, qt_package_path)
    # fetch qt icu binary package if given
    if module_doc_build_qt_icu_package_uri:
        raw_name_qt_icu_package = module_doc_build_qt_icu_package_uri.rsplit('/', 1)[-1] # get last item from array
        downloaded_qt_icu_archive = os.path.join(current_path, raw_name_qt_icu_package)
        if os.path.lexists(downloaded_qt_icu_archive):
            print('*** Deleted existing qt icu package: [{0}] before fetching the new one.'.format(downloaded_qt_icu_archive))
            os.remove(downloaded_qt_icu_archive)
        print('Starting to download: {0} -> into {1}'.format(module_doc_build_qt_icu_package_uri, downloaded_qt_icu_archive))
        bldinstallercommon.retrieve_url(module_doc_build_qt_icu_package_uri, downloaded_qt_icu_archive)
        qt_lib_directory = bldinstallercommon.locate_directory(qt_package_path, 'lib')
        print('Extracting icu libs into: {0}'.format(qt_lib_directory))
        bldinstallercommon.extract_file(downloaded_qt_icu_archive, qt_lib_directory)
    # patch Qt package
    qt_bin_directory = bldinstallercommon.locate_directory(qt_package_path, 'bin')
    if not os.path.exists(qt_bin_directory):
        raise IOError('*** Unable to locate bin directory from: %s' % qt_bin_directory)
    qtConfFile = open(os.path.join(qt_bin_directory, 'qt.conf'), "w")
    qtConfFile.write("[Paths]" + os.linesep)
    qtConfFile.write("Prefix=.." + os.linesep)
    qtConfFile.close()
    qt_directory = os.path.dirname(qt_bin_directory)
    #bldinstallercommon.handle_component_rpath(qt_directory, 'lib')
    # locate tools
    qmake_binary = bldinstallercommon.locate_executable(qt_directory, 'qmake')
    print('Using qmake from: {0}'.format(qmake_binary))
    # locate module .pro file
    module_pro_file = bldinstallercommon.locate_file(module_src_path, '*.pro')
    # build module
    module_build_environment = dict(os.environ)
    module_build_environment["LD_LIBRARY_PATH"] = os.pathsep.join([os.path.join(qt_package_path, 'lib')] +
                                                        optionDict.get("LD_LIBRARY_PATH", "").split(os.pathsep))
    module_build_environment["QMAKESPEC"] = "linux-g++"
    cpu_count = ["-j" + str(multiprocessing.cpu_count() + 1)]
    print('Using .pro file from: {0}'.format(module_pro_file))
    bld_args = [qmake_binary, module_pro_file]
    bldinstallercommon.do_execute_sub_process(args=bld_args, execution_path=os.path.dirname(module_pro_file),
                                              abort_on_fail=False, extra_env=module_build_environment)
    bld_args = ['make'] + cpu_count
    bldinstallercommon.do_execute_sub_process(args=bld_args, execution_path=os.path.dirname(module_pro_file),
                                              abort_on_fail=False, extra_env=module_build_environment)
    # make docs
    bld_args = ['make', '-j1', 'docs']
    bldinstallercommon.do_execute_sub_process(args=bld_args, execution_path=os.path.dirname(module_pro_file),
                                              abort_on_fail=False, extra_env=module_build_environment)
    # make install docs
    module_doc_install_dir = module_src_path = os.path.join(current_path, 'module_doc_install_dir')
    bld_args = ['make', '-j1', 'install_docs', 'INSTALL_ROOT=' + module_doc_install_dir]
    bldinstallercommon.do_execute_sub_process(args=bld_args, execution_path=os.path.dirname(module_pro_file),
                                              abort_on_fail=False, extra_env=module_build_environment)
    # create archive
    doc_dir = bldinstallercommon.locate_directory(module_doc_install_dir, 'doc')
    if not os.path.exists(doc_dir):
        print('Warning! Doc archive not generated!')
        return
    archive_name = optionDict['MODULE_NAME'] + '-' + optionDict['LICENSE'] + '-doc-' + optionDict['MODULE_VERSION'] + '.7z'
    archive_path = os.path.join(current_path, 'doc_archives', archive_name)
    bld_args = ['7z', 'a', archive_path, 'doc']
    bldinstallercommon.do_execute_sub_process(args=bld_args, execution_path=os.path.dirname(doc_dir), abort_on_fail=False)
    if os.path.exists(archive_path):
        print('Doc archive generated successfully: {0}'.format(archive_path))
Exemple #21
0
def bitness_flags(bitness):
    if bitness == 32 and bldinstallercommon.is_linux_platform():
        return ['-DLLVM_BUILD_32_BITS=ON']
    return []