Ejemplo n.º 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
Ejemplo n.º 2
0
def build_installer_framework(options):
    if options.incremental_mode:
        file_to_check = os.path.join(options.installer_framework_build_dir,
                                     'bin', 'installerbase')
        if bldinstallercommon.is_win_platform():
            file_to_check += '.exe'
        if os.path.exists(file_to_check):
            return

    print(
        '--------------------------------------------------------------------')
    print('Building Installer Framework')
    qmake_bin = bldinstallercommon.locate_file(options.qt_build_dir,
                                               options.qt_qmake_bin)
    if not os.path.isfile(qmake_bin):
        print('*** Unable to find qmake, aborting!')
        print('qmake: {0}'.format(qmake_bin))
        sys.exit(-1)
    if not os.path.exists(options.installer_framework_build_dir):
        bldinstallercommon.create_dirs(options.installer_framework_build_dir)
    cmd_args = [qmake_bin]
    cmd_args += options.qt_installer_framework_qmake_args
    cmd_args += [options.installer_framework_source_dir]
    bldinstallercommon.do_execute_sub_process(
        cmd_args, options.installer_framework_build_dir)
    cmd_args = options.make_cmd
    bldinstallercommon.do_execute_sub_process(
        cmd_args.split(' '), options.installer_framework_build_dir)
Ejemplo n.º 3
0
def build_qt(options, qt_build_dir, qt_configure_options, qt_modules):
    if options.incremental_mode:
        qmake_bin = bldinstallercommon.locate_file(qt_build_dir,
                                                   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))
Ejemplo n.º 4
0
def replace_system_paths():
    qconfig_file_path = bldinstallercommon.locate_file(MAKE_INSTALL_ROOT_DIR, 'qconfig.pri')
    print_wrap('------------ Replacing system paths in ' + qconfig_file_path + ' ----------------')
    for line in fileinput.FileInput(qconfig_file_path, inplace=1):
        if 'QMAKE_DEFAULT_LIBDIRS' in line:
            libdirs = line.split('=')[0]
            print libdirs + ' = '
        elif 'QMAKE_DEFAULT_INCDIRS' in line:
            incdirs = line.split('=')[0]
            print incdirs + ' = '
        else:
            print line,
    print_wrap('--------------------------------------------------------------------')
Ejemplo n.º 5
0
def build_ifw_docs(options):
    print('--------------------------------------------------------------------')
    print('Building Qt Installer Framework Documentation')
    qmake_bin = bldinstallercommon.locate_file(options.qt_build_dir_dynamic, options.qt_qmake_bin)
    if not os.path.isfile(qmake_bin):
        print('*** Aborting doc build, unable to find qmake from: {0}'.format(options.qt_build_dir_dynamic))
        sys.exit(-1)
    cmd_args = qmake_bin + ' ' + options.installer_framework_source_dir
    bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), options.installer_framework_build_dir)
    cmd_args = options.make_doc_cmd + ' docs'
    env = dict(os.environ)
    env['LD_LIBRARY_PATH'] = os.path.normpath(os.path.join(os.path.dirname(qmake_bin), '..', 'lib'))
    bldinstallercommon.do_execute_sub_process(args=cmd_args.split(' '), execution_path=options.installer_framework_build_dir,
                                              abort_on_fail=True, get_output=False, extra_env=env)
Ejemplo n.º 6
0
def build_ifw_docs(options):
    print('--------------------------------------------------------------------')
    print('Building Qt Installer Framework Documentation')
    qmake_bin = bldinstallercommon.locate_file(options.qt_build_dir_dynamic, options.qt_qmake_bin)
    if not os.path.isfile(qmake_bin):
        print('*** Aborting doc build, unable to find qmake from: {0}'.format(options.qt_build_dir_dynamic))
        sys.exit(-1)
    cmd_args = qmake_bin + ' ' + options.installer_framework_source_dir
    bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), options.installer_framework_build_dir)
    cmd_args = options.make_doc_cmd + ' docs'
    env = dict(os.environ)
    env['LD_LIBRARY_PATH'] = os.path.normpath(os.path.join(os.path.dirname(qmake_bin), '..', 'lib'))
    bldinstallercommon.do_execute_sub_process(args=cmd_args.split(' '), execution_path=options.installer_framework_build_dir,
                                              abort_on_fail=True, get_output=False, extra_env=env)
Ejemplo n.º 7
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)
Ejemplo n.º 8
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
Ejemplo n.º 9
0
def build_qt(options, qt_build_dir, qt_configure_options, qt_modules):
    if options.incremental_mode:
        qmake_bin = bldinstallercommon.locate_file(qt_build_dir, 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))
Ejemplo n.º 10
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
Ejemplo n.º 11
0
def build_installer_framework(options):
    if options.incremental_mode:
        file_to_check = os.path.join(options.installer_framework_build_dir, 'bin', 'installerbase')
        if bldinstallercommon.is_win_platform():
            file_to_check += '.exe'
        if os.path.exists(file_to_check):
            return

    print('--------------------------------------------------------------------')
    print('Building Installer Framework')
    qmake_bin = bldinstallercommon.locate_file(options.qt_build_dir, options.qt_qmake_bin)
    if not os.path.isfile(qmake_bin):
        print('*** Unable to find qmake, aborting!')
        print('qmake: {0}'.format(qmake_bin))
        sys.exit(-1)
    if not os.path.exists(options.installer_framework_build_dir):
        bldinstallercommon.create_dirs(options.installer_framework_build_dir)
    cmd_args = [qmake_bin]
    cmd_args += options.qt_installer_framework_qmake_args
    cmd_args += [options.installer_framework_source_dir]
    bldinstallercommon.do_execute_sub_process(cmd_args, options.installer_framework_build_dir)
    cmd_args = options.make_cmd
    bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), options.installer_framework_build_dir)
Ejemplo n.º 12
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
Ejemplo n.º 13
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))
Ejemplo n.º 14
0
            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)

# if .tag file exists in the source package (sha1) then copy it into the binary archive
tag_file = bldinstallercommon.locate_file(qtModuleSourceDirectory, '.tag')
if tag_file:
    shutil.copy2(tag_file, dir_to_archive)

# Pre-patch the package for IFW to patch it correctly during installation
patch_archive(dir_to_archive, [callerArguments.qt5path, dir_to_archive],
              qt_install_prefix)

archive_cmd = [
    '7z', 'a',
    os.path.join('module_archives',
                 'qt5_' + callerArguments.module_name + '.7z')
]
if callerArguments.use_cmake:
    archive_cmd.append(os.path.join(dir_to_archive, '*'))
else:
Ejemplo n.º 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))
Ejemplo n.º 16
0
        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)

# if .tag file exists in the source package (sha1) then copy it into the binary archive
tag_file = bldinstallercommon.locate_file(qtModuleSourceDirectory, '.tag')
if tag_file:
    shutil.copy2(tag_file, dir_to_archive)

# Pre-patch the package for IFW to patch it correctly during installation
patch_archive(dir_to_archive, [callerArguments.qt5path, dir_to_archive], qt_install_prefix)

archive_cmd = ['7z', 'a', os.path.join('module_archives', 'qt5_' + callerArguments.module_name + '.7z')]
if callerArguments.use_cmake:
    archive_cmd.append(os.path.join(dir_to_archive, '*'))
else:
    archive_cmd.append(dir_to_archive)
ret = runCommand(archive_cmd, currentWorkingDirectory = os.path.dirname(os.path.realpath(__file__)))
if ret:
    raise RuntimeError('Failure running the last command: %i' % ret)