Example #1
0
def build_icu_linux(environment, icu_src_base_dir, archive_icu):
    bldinstallercommon.create_dirs(os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME))
    exec_path = icu_src_base_dir
    # configure
    environment['LFLAGS'] = '-Wl,-rpath,\$ORIGIN'
    cmd_args = ['./runConfigureICU', 'Linux', '--enable-rpath', '--prefix=' + os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME)]
    exec_path = os.path.dirname(bldinstallercommon.locate_file(os.path.join(SCRIPT_ROOT_DIR, ICU_SRC_DIR_NAME), 'configure'))
    bldinstallercommon.do_execute_sub_process(cmd_args, exec_path, extra_env=environment)
    # build
    cmd_args = ['make', '-j' + str(multiprocessing.cpu_count() + 1)]
    bldinstallercommon.do_execute_sub_process(cmd_args, exec_path, extra_env=environment)
    cmd_args = ['make', 'install']
    bldinstallercommon.do_execute_sub_process(cmd_args, exec_path, extra_env=environment)
    # patch RPath
    exec_path = os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME, 'lib')
    files = bldinstallercommon.make_files_list(exec_path, '.so$')
    for item in files:
        cmd_args = 'chrpath -r $ORIGIN ' + item
        bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), exec_path, extra_env=environment)
    icu_configuration = ICUConfiguration
    search_path = os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME)
    icu_configuration.icu_include_path = bldinstallercommon.locate_directory(search_path, 'include')
    icu_configuration.icu_lib_path = bldinstallercommon.locate_directory(search_path, 'lib')
    # archvive icu build artifacts if requested
    if archive_icu:
        archive_build_artifacts(search_path)
    return icu_configuration
Example #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')
Example #3
0
def build_qt(options, qt_build_dir, qt_configure_options, qt_modules):
    if options.incremental_mode:
        qmake_bin = os.path.join(options.qt_build_dir, 'qtbase', 'bin', options.qt_qmake_bin)
        qt_lib_dir = bldinstallercommon.locate_directory(qt_build_dir, 'lib')
        if os.path.isfile(qmake_bin) and os.path.isdir(qt_lib_dir):
            return

    bldinstallercommon.create_dirs(qt_build_dir)
    # configure first
    print('--------------------------------------------------------------------')
    print('Configuring Qt')
    configure_options = re.sub(' +', ' ', qt_configure_options)
    cmd_args = options.qt_configure_bin + ' ' + configure_options
    # shlex does not like backslashes
    cmd_args = cmd_args.replace('\\', '/')
    bldinstallercommon.do_execute_sub_process(shlex.split(cmd_args), options.qt_source_dir, True, False, get_build_env(options.openssl_dir))
    print('--------------------------------------------------------------------')
    print('Building Qt')
    cmd_args = options.make_cmd
    for module in qt_modules:
        cmd_args += " module-"+module
    bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), options.qt_source_dir, True, False, get_build_env(options.openssl_dir))
    print('--------------------------------------------------------------------')
    print('Installing Qt')
    cmd_args = options.make_install_cmd
    for module in qt_modules:
        moduleDir = os.path.join(options.qt_source_dir, module)
        bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), moduleDir)
Example #4
0
def archive_build_artifacts(base_path):
    # archive naming
    archive_name_base = 'icu'
    if os.environ.get('cfg'):
        archive_name_base += '-' + os.environ.get('cfg')
    elif os.environ.get('TARGET_ENV'):
        archive_name_base += '-' + os.environ.get('TARGET_ENV')
    # build artifacts output dir
    output_dir = os.path.join(SCRIPT_ROOT_DIR, ICU_BUILD_OUTPUT_DIR)
    if os.path.exists(output_dir):
        bldinstallercommon.remove_tree(output_dir)
    bldinstallercommon.create_dirs(output_dir)
    # devel package
    archive_name = archive_name_base + '-devel.7z'
    if os.path.isfile(archive_name):
        os.remove(archive_name)
    cmd_args = ['7z', 'a', archive_name, '*']
    bldinstallercommon.do_execute_sub_process(cmd_args, base_path)
    shutil.move(os.path.join(base_path, archive_name), output_dir)
    # lib package
    archive_name = archive_name_base + '.7z'
    if os.path.isfile(archive_name):
        os.remove(archive_name)
    lib_path = bldinstallercommon.locate_directory(base_path, 'lib')
    clean_icu_lib(lib_path)
    cmd_args = ['7z', 'a', archive_name, '*']
    bldinstallercommon.do_execute_sub_process(cmd_args, lib_path)
    shutil.move(os.path.join(lib_path, archive_name), output_dir)
Example #5
0
def archive_build_artifacts(base_path):
    # archive naming
    archive_name_base = 'icu'
    if os.environ.get('cfg'):
        archive_name_base += '-' + os.environ.get('cfg')
    elif os.environ.get('TARGET_ENV'):
        archive_name_base += '-' + os.environ.get('TARGET_ENV')
    # build artifacts output dir
    output_dir = os.path.join(SCRIPT_ROOT_DIR, ICU_BUILD_OUTPUT_DIR)
    if os.path.exists(output_dir):
        bldinstallercommon.remove_tree(output_dir)
    bldinstallercommon.create_dirs(output_dir)
    # devel package
    archive_name = archive_name_base + '-devel.7z'
    if os.path.isfile(archive_name):
        os.remove(archive_name)
    cmd_args = ['7z', 'a', archive_name, '*']
    bldinstallercommon.do_execute_sub_process(cmd_args, base_path)
    shutil.move(os.path.join(base_path, archive_name), output_dir)
    # lib package
    archive_name = archive_name_base + '.7z'
    if os.path.isfile(archive_name):
        os.remove(archive_name)
    lib_path = bldinstallercommon.locate_directory(base_path, 'lib')
    clean_icu_lib(lib_path)
    cmd_args = ['7z', 'a', archive_name, '*']
    bldinstallercommon.do_execute_sub_process(cmd_args, lib_path)
    shutil.move(os.path.join(lib_path, archive_name), output_dir)
Example #6
0
def build_qt(options, qt_build_dir, qt_configure_options, qt_modules):
    if options.incremental_mode:
        qmake_bin = os.path.join(options.qt_build_dir, 'qtbase', 'bin',
                                 options.qt_qmake_bin)
        qt_lib_dir = bldinstallercommon.locate_directory(qt_build_dir, 'lib')
        if os.path.isfile(qmake_bin) and os.path.isdir(qt_lib_dir):
            return

    bldinstallercommon.create_dirs(qt_build_dir)
    # configure first
    print(
        '--------------------------------------------------------------------')
    print('Configuring Qt')
    configure_options = re.sub(' +', ' ', qt_configure_options)
    cmd_args = options.qt_configure_bin + ' ' + configure_options
    # shlex does not like backslashes
    cmd_args = cmd_args.replace('\\', '/')
    bldinstallercommon.do_execute_sub_process(
        shlex.split(cmd_args), qt_build_dir, True, False,
        get_build_env(options.openssl_dir))
    print(
        '--------------------------------------------------------------------')
    print('Building Qt')
    cmd_args = options.make_cmd
    cmd_args += qt_modules
    bldinstallercommon.do_execute_sub_process(
        cmd_args.split(' '), qt_build_dir, True, False,
        get_build_env(options.openssl_dir))
Example #7
0
def build_icu_linux(environment, icu_src_base_dir, archive_icu):
    bldinstallercommon.create_dirs(
        os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME))
    exec_path = icu_src_base_dir
    # configure
    environment['LFLAGS'] = '-Wl,-rpath,\$ORIGIN'
    cmd_args = [
        './runConfigureICU', 'Linux', '--enable-rpath',
        '--prefix=' + os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME)
    ]
    exec_path = os.path.dirname(
        bldinstallercommon.locate_file(
            os.path.join(SCRIPT_ROOT_DIR, ICU_SRC_DIR_NAME), 'configure'))
    bldinstallercommon.do_execute_sub_process(cmd_args,
                                              exec_path,
                                              extra_env=environment)
    # build
    cmd_args = ['make', '-j' + str(multiprocessing.cpu_count() + 1)]
    bldinstallercommon.do_execute_sub_process(cmd_args,
                                              exec_path,
                                              extra_env=environment)
    cmd_args = ['make', 'install']
    bldinstallercommon.do_execute_sub_process(cmd_args,
                                              exec_path,
                                              extra_env=environment)
    # patch RPath
    exec_path = os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME, 'lib')
    files = bldinstallercommon.make_files_list(exec_path, '.so$')
    for item in files:
        cmd_args = 'chrpath -r $ORIGIN ' + item
        bldinstallercommon.do_execute_sub_process(cmd_args.split(' '),
                                                  exec_path,
                                                  extra_env=environment)
    icu_configuration = ICUConfiguration
    search_path = os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME)
    icu_configuration.icu_include_path = bldinstallercommon.locate_directory(
        search_path, 'include')
    icu_configuration.icu_lib_path = bldinstallercommon.locate_directory(
        search_path, 'lib')
    # archvive icu build artifacts if requested
    if archive_icu:
        archive_build_artifacts(search_path)
    return icu_configuration
Example #8
0
def build_icu_win(environment, icu_src_base_dir, archive_icu):
    bldinstallercommon.create_dirs(os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME))
    exec_path = icu_src_base_dir
    # configure
    cygpath = subprocess.check_output(['cygpath', os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME)])
    cmd_args = ['bash', 'runConfigureICU', 'Cygwin/MSVC', '--prefix=' + cygpath]
    exec_path = os.path.dirname(bldinstallercommon.locate_file(os.path.join(SCRIPT_ROOT_DIR, ICU_SRC_DIR_NAME), 'configure'))
    bldinstallercommon.do_execute_sub_process(cmd_args, exec_path, extra_env=environment)
    # build
    cmd_args = ['make']
    bldinstallercommon.do_execute_sub_process(cmd_args, exec_path, extra_env=environment)
    cmd_args = ['make', 'install']
    bldinstallercommon.do_execute_sub_process(cmd_args, exec_path, extra_env=environment)

    icu_configuration = ICUConfiguration
    search_path = os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME)
    icu_configuration.icu_include_path = bldinstallercommon.locate_directory(search_path, 'include')
    icu_configuration.icu_lib_path = bldinstallercommon.locate_directory(search_path, 'lib')
    # archive icu build artifacts if requested
    if archive_icu:
        archive_build_artifacts(search_path)
    return icu_configuration
Example #9
0
def build_icu_win(environment, icu_src_base_dir, archive_icu):
    bldinstallercommon.create_dirs(
        os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME))
    exec_path = icu_src_base_dir
    # configure
    cygpath = subprocess.check_output(
        ['cygpath',
         os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME)])
    cmd_args = [
        'bash', 'runConfigureICU', 'Cygwin/MSVC', '--prefix=' + cygpath
    ]
    exec_path = os.path.dirname(
        bldinstallercommon.locate_file(
            os.path.join(SCRIPT_ROOT_DIR, ICU_SRC_DIR_NAME), 'configure'))
    bldinstallercommon.do_execute_sub_process(cmd_args,
                                              exec_path,
                                              extra_env=environment)
    # build
    cmd_args = ['make']
    bldinstallercommon.do_execute_sub_process(cmd_args,
                                              exec_path,
                                              extra_env=environment)
    cmd_args = ['make', 'install']
    bldinstallercommon.do_execute_sub_process(cmd_args,
                                              exec_path,
                                              extra_env=environment)

    icu_configuration = ICUConfiguration
    search_path = os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME)
    icu_configuration.icu_include_path = bldinstallercommon.locate_directory(
        search_path, 'include')
    icu_configuration.icu_lib_path = bldinstallercommon.locate_directory(
        search_path, 'lib')
    # archive icu build artifacts if requested
    if archive_icu:
        archive_build_artifacts(search_path)
    return icu_configuration
Example #10
0
def extract_src_package():
    global QT_SOURCE_DIR
    global QT_BUILD_OPTIONS
    print_wrap('---------------- Extracting source package -------------------------')
    if os.path.exists(QT_SOURCE_DIR):
        print_wrap('Source dir ' + QT_SOURCE_DIR + ' already exists, using that (not re-extracting the archive!)')
    else:
        print_wrap('Extracting source package: ' + QT_PACKAGE_SAVE_AS_TEMP)
        print_wrap('Into:                      ' + QT_SOURCE_DIR)
        bldinstallercommon.create_dirs(QT_SOURCE_DIR)
        bldinstallercommon.extract_file(QT_PACKAGE_SAVE_AS_TEMP, QT_SOURCE_DIR)

    time.sleep(10)

    l = os.listdir(QT_SOURCE_DIR)
    items = len(l)
    if items == 1:
        print_wrap('    Replacing qt-everywhere-xxx-src-5.0.0 with shorter path names')
        shorter_dir_path = QT_SOURCE_DIR + os.sep + QT_PACKAGE_SHORT_NAME
        time.sleep(10)
        print_wrap(QT_SOURCE_DIR + os.sep + l[0] + ',' + shorter_dir_path)
        time.sleep(20)
        os.rename(QT_SOURCE_DIR + os.sep + l[0], shorter_dir_path)
        time.sleep(10)
        print_wrap('    Old source dir: ' + QT_SOURCE_DIR)
        QT_SOURCE_DIR = shorter_dir_path
        print_wrap('    New source dir: ' + QT_SOURCE_DIR)
        #CONFIGURE_CMD = QT_SOURCE_DIR + os.sep + CONFIGURE_CMD   #is this needed in shadow build?
    else:
        print_wrap('*** Unsupported directory structure!!!')
        sys.exit(-1)

    #Remove the modules to be ignored
    for ignore in QT_BUILD_OPTIONS.module_ignore_list:
        if os.path.exists(QT_SOURCE_DIR + os.sep + ignore):
            print_wrap('    Removing ' + ignore)
            bldinstallercommon.remove_tree(QT_SOURCE_DIR + os.sep + ignore)

    # Locate gnuwin32 tools
    if bldinstallercommon.is_win_platform():
        gnuwin32_path = bldinstallercommon.locate_directory(QT_SOURCE_DIR, 'gnuwin32')
        gnuwin32_path = os.path.join(gnuwin32_path, 'bin')
        QT_BUILD_OPTIONS.system_env['PATH'] = gnuwin32_path + ';' + QT_BUILD_OPTIONS.system_env['PATH']
    print_wrap('--------------------------------------------------------------------')
Example #11
0
def clean_up():
    print_wrap('---------------- Cleaning unnecessary files from ' + MAKE_INSTALL_ROOT_DIR + '----------')
    # remove examples from binary packages
    bldinstallercommon.remove_directories_by_type(MAKE_INSTALL_ROOT_DIR, 'examples')
    # all platforms
    for root, dummy, files in os.walk(MAKE_INSTALL_ROOT_DIR):
        for name in files:
            if (any(name.endswith(to_remove) for to_remove in FILES_TO_REMOVE_LIST)):
                path = os.path.join(root, name)
                print_wrap('    ---> Deleting file: ' + name)
                os.remove(path)
    # on windows remove redundant .dll files from \lib
    if bldinstallercommon.is_win_platform():
        for name in os.listdir(MAKE_INSTALL_ROOT_DIR):
            dir_name = os.path.join(MAKE_INSTALL_ROOT_DIR, name)
            lib_path = bldinstallercommon.locate_directory(dir_name, 'lib')
            if lib_path:
                bldinstallercommon.delete_files_by_type_recursive(lib_path, '\\.dll')
    print_wrap('--------------------------------------------------------------------')
Example #12
0
def use_custom_icu():
    if os.path.isdir(QT_BUILD_OPTIONS.icu_uri):
        return QT_BUILD_OPTIONS.icu_uri
    package_raw_name = os.path.basename(QT_BUILD_OPTIONS.icu_uri)
    icu_extract_path = os.path.join(SCRIPT_ROOT_DIR, 'icu_saveas')
    if os.path.isdir(icu_extract_path):
        bldinstallercommon.remove_tree(icu_extract_path)
    bldinstallercommon.create_dirs(icu_extract_path)
    icu_extract_saveas = os.path.join(icu_extract_path, package_raw_name)
    if os.path.isfile(QT_BUILD_OPTIONS.icu_uri):
        bldinstallercommon.extract_file(QT_BUILD_OPTIONS.icu_uri, icu_extract_path)
    if bldinstallercommon.is_content_url_valid(QT_BUILD_OPTIONS.icu_uri):
        bldinstallercommon.retrieve_url(QT_BUILD_OPTIONS.icu_uri, icu_extract_saveas)
        bldinstallercommon.extract_file(icu_extract_saveas, icu_extract_path)
    lib_path = bldinstallercommon.locate_directory(icu_extract_path, 'lib')
    if not lib_path:
        return icu_extract_path
    if (lib_path.endswith('/')):
        lib_path = lib_path[:len(lib_path) - 1]
    return os.path.dirname(lib_path)
Example #13
0
def patch_qnx6_files(dir_tofind, regex_filename, line_toreplace, regex_toreplace, replace_with=''):
    # remove references to absolute path of the SDP on the build machine
    if QNX_BUILD:
        install_path_final = MAKE_INSTALL_ROOT_DIR + os.sep + SINGLE_INSTALL_DIR_NAME
        if bldinstallercommon.is_win_platform():
            install_path_final = 'C' + install_path_final[1:]

        # find the 'dir_tofind' directory under the install directory
        path_final = bldinstallercommon.locate_directory(install_path_final, dir_tofind)

        # just list the files with a pattern matching 'expression'
        print_wrap('---------- Remove references to hard coded paths of the SDP under ' + path_final + ' ----------------')
        print_wrap('*** Replacing hard coded paths to SDP under : ' + path_final)
        files_to_patch = [f for f in os.listdir(path_final) if re.match(regex_filename, f)]
        # let's replace the 'regex_toreplace' string
        regex = re.compile(regex_toreplace)
        for name_to_patch in files_to_patch:
            # let's just replace the line containing the 'line_toreplace' string
            name_path = os.path.join(path_final, name_to_patch)
            for line in fileinput.FileInput(name_path, inplace=1):
                if line.startswith(line_toreplace):
                    line = regex.sub(replace_with, line)
                print line,
Example #14
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)
Example #15
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))
Example #16
0
    ret = runInstallCommand('docs',
                            currentWorkingDirectory=qtModuleBuildDirectory,
                            callerArguments=callerArguments,
                            init_environment=environment)
    if ret:
        raise RuntimeError('Failure running the last command: %i' % ret)
    # then make install those
    ret = runInstallCommand(
        ['install_docs', 'INSTALL_ROOT=' + qtModuleInstallDirectory],
        currentWorkingDirectory=qtModuleBuildDirectory,
        callerArguments=callerArguments,
        init_environment=environment)
    if ret:
        raise RuntimeError('Failure running the last command: %i' % ret)
    # make separate "doc.7z" for later use if needed
    doc_dir = bldinstallercommon.locate_directory(qtModuleInstallDirectory,
                                                  'doc')
    if doc_dir:
        archive_name = callerArguments.module_name + '-' + os.environ[
            'LICENSE'] + '-doc-' + os.environ['MODULE_VERSION'] + '.7z'
        ret = runCommand(
            ['7z', 'a',
             os.path.join('doc_archives', archive_name), doc_dir],
            currentWorkingDirectory=os.path.dirname(
                os.path.realpath(__file__)))
        if ret:
            raise RuntimeError('Failure running the last command: %i' % ret)

# try to figure out where the actual exported content is
qt5_install_basename = os.path.basename(callerArguments.qt5path)

if callerArguments.use_cmake:
Example #17
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))
Example #18
0
# enginio etc. docs creation
if callerArguments.makeDocs:
    # build docs first
    ret = runInstallCommand('docs',
                     currentWorkingDirectory = qtModuleBuildDirectory,
                     callerArguments = callerArguments, init_environment = environment)
    if ret:
        raise RuntimeError('Failure running the last command: %i' % ret)
    # then make install those
    ret = runInstallCommand(['install_docs', 'INSTALL_ROOT=' + qtModuleInstallDirectory],
                     currentWorkingDirectory = qtModuleBuildDirectory,
                     callerArguments = callerArguments, init_environment = environment)
    if ret:
        raise RuntimeError('Failure running the last command: %i' % ret)
    # make separate "doc.7z" for later use if needed
    doc_dir = bldinstallercommon.locate_directory(qtModuleInstallDirectory, 'doc')
    if doc_dir:
        archive_name = callerArguments.module_name + '-' + os.environ['LICENSE'] + '-doc-' + os.environ['MODULE_VERSION'] + '.7z'
        ret = runCommand(['7z', 'a', os.path.join('doc_archives', archive_name), doc_dir],
                         currentWorkingDirectory = os.path.dirname(os.path.realpath(__file__)))
        if ret:
            raise RuntimeError('Failure running the last command: %i' % ret)

# try to figure out where the actual exported content is
qt5_install_basename = os.path.basename(callerArguments.qt5path)

if callerArguments.use_cmake:
    dir_to_archive = qtModuleInstallDirectory
else:
    dir_to_archive = bldinstallercommon.locate_directory(qtModuleInstallDirectory, qt5_install_basename)