def build_qt(layout, debug, profile):

    def qtmake(*args):
        try:
            sdk.sh('jom', '/VERSION')
        except:
            make(*args)
        else:
            sdk.sh('jom', '-j%s' % str(multiprocessing.cpu_count() + 1), *args)

    if os.path.isfile(QT_LICENSE_FILE):
        qt_license = '-commercial'

        shutil.copy(QT_LICENSE_FILE, os.path.join(HOME, ".qt-license"))
    else:
        qt_license = '-opensource'

    # Bootstrap configure.exe on Windows so that we can re-use the UNIX source
    # tarball which doesn't have configure.exe pre-built like the Win32
    # version. To do this, we 'touch' qtbase\.gitignore.
    if is_qt5():
        with open(os.path.join('qtbase', '.gitignore'), 'w'):
            pass

    # Configure
    qt_configure_args = [
        '-confirm-license',
        '-prefix', layout['root'],
        '-shared',
        qt_license
    ]

    # Load build profile
    qt_configure_args.extend(profile['qt']['common'])

    if sys.platform in profile['qt']:
        qt_configure_args.extend(profile['qt'][sys.platform])

    # Enable proper release + debug .pdb files on Windows
    if debug:
        if sys.platform == 'win32':
            mkspec_file_name = 'qt%s-msvc2008-release-with-debuginfo.conf' % profile[
                'qt']['version']

            shutil.copyfile(os.path.join(SUPPORT_DIR, mkspec_file_name), os.path.join(
                'mkspecs', 'win32-msvc2008', 'qmake.conf'))
            qt_configure_args.append('-release')
        else:
            qt_configure_args.append('-debug')
    else:
        qt_configure_args.append('-release')

    # Have the compiler find our local copy of ICU
    if sys.platform == 'darwin' or sys.platform == 'win32':
        qt_configure_args.extend(['-I', os.path.join(layout['root'], 'include')])
        qt_configure_args.extend(['-L', os.path.join(layout['root'], 'lib')])

    if sys.platform == 'win32':
        # VC++ doesn't have stdint.h (required by WebKit)
        shutil.copy(os.path.join(SUPPORT_DIR, 'stdint-msvc.h'),
                    os.path.join(layout['include'], 'stdint.h'))

        # Add gnuwin32 to the PATH (required by WebKit)
        qt_source_dir = os.path.abspath(os.getcwd())
        os.environ['PATH'] = os.pathsep.join([
            os.path.join(qt_source_dir, 'gnuwin32', 'bin'),
            os.environ['PATH']
        ])

        # Enable parallel build
        qt_configure_args.append('-mp')

    # Build Qt 4 with clang on OS X
    has_clang = sys.platform == 'darwin' \
        and os.path.isfile('/usr/bin/clang') \
        and os.path.isfile('/usr/bin/clang++')
    if has_clang and not is_qt5():
        qt_configure_args.extend(['-platform', 'unsupported/macx-clang'])

    # Build
    configure_qt(*qt_configure_args)
    qtmake()
    qtmake('install')

    # Delete all libtool's .la files
    for root, _, filenames in os.walk(layout['root']):
        for filename in fnmatch.filter(filenames, '*.la'):
            os.remove(os.path.join(root, filename))
dataset/ETHPy150Open develersrl/qt-pyqt-sdk-builder/build.py/build_qt/original