Ejemplo n.º 1
0
def init_mkqt5bld():
    global CONFIGURE_CMD
    global CONFIGURE_OPTIONS
    global MAKE_INSTALL_CMD
    global QT_BUILD_OPTIONS

    print_wrap('---------------- Initializing build --------------------------------')
    #do not edit configure options, if configure options are overridden from commandline options
    if bldinstallercommon.is_unix_platform():
        CONFIGURE_CMD = './'
    if QT_BUILD_OPTIONS.silent_build and not bldinstallercommon.is_win_platform():
        CONFIGURE_OPTIONS += ' -silent'
    # add required configuration arguments if Android build
    if ANDROID_BUILD:
        CONFIGURE_OPTIONS += ' -android-ndk ' + QT_BUILD_OPTIONS.android_ndk_home
        CONFIGURE_OPTIONS += ' -android-sdk ' + QT_BUILD_OPTIONS.android_sdk_home
        QT_BUILD_OPTIONS.system_env['ANDROID_NDK_HOST'] = QT_BUILD_OPTIONS.android_ndk_host
        QT_BUILD_OPTIONS.system_env['ANDROID_API_VERSION'] = QT_BUILD_OPTIONS.android_api_version

    CONFIGURE_CMD += 'configure'

    # make cmd
    if QT_BUILD_OPTIONS.make_cmd == '':  #if not given in commandline param, use nmake or make according to the os
        if bldinstallercommon.is_win_platform():        #win
            QT_BUILD_OPTIONS.make_cmd = 'nmake'
            MAKE_INSTALL_CMD = 'nmake'
            if QT_BUILD_OPTIONS.silent_build:
                QT_BUILD_OPTIONS.make_cmd += ' /s'
                MAKE_INSTALL_CMD += ' /s'
            MAKE_INSTALL_CMD += ' install'
        elif bldinstallercommon.is_unix_platform():    #linux & mac
            QT_BUILD_OPTIONS.make_cmd = 'make'
            MAKE_INSTALL_CMD = 'make'
            if QT_BUILD_OPTIONS.silent_build:
                QT_BUILD_OPTIONS.make_cmd += ' -s'
                MAKE_INSTALL_CMD += ' -s'
            MAKE_INSTALL_CMD += ' install'
    else:
        if QT_BUILD_OPTIONS.make_cmd == 'jom':
            MAKE_INSTALL_CMD = 'jom -j1 install'
            if QT_BUILD_OPTIONS.silent_build:
                QT_BUILD_OPTIONS.make_cmd += ' -s -nologo'
                MAKE_INSTALL_CMD += ' -s -nologo'
        ## QTBUG-38555: make install INSTALL_ROOT=\some\path does not work on Windows
        # always use 'make' for 'make install', 'mingw32-make install' does not work atm
        elif QT_BUILD_OPTIONS.make_cmd == 'mingw32-make' and bldinstallercommon.is_win_platform() and QNX_BUILD:
            MAKE_INSTALL_CMD = 'make install'

    #remove old working dirs
    if os.path.exists(WORK_DIR):
        print_wrap('    Removing old work dir ' + WORK_DIR)
        bldinstallercommon.remove_tree(WORK_DIR)
    if os.path.exists(MODULE_ARCHIVE_DIR):
        print_wrap('    Removing old module archive dir ' + MODULE_ARCHIVE_DIR)
        bldinstallercommon.remove_tree(MODULE_ARCHIVE_DIR)

    print_wrap('  Build    : ' + QT_BUILD_OPTIONS.make_cmd)
    print_wrap('  Install  : ' + MAKE_INSTALL_CMD)
    print_wrap('  Configure: ' + CONFIGURE_OPTIONS)
    print_wrap('--------------------------------------------------------------------')
Ejemplo n.º 2
0
def build_qt():
    print_wrap('---------------- Building Qt ---------------------------------------')
    #remove if old dir exists
    if os.path.exists(MAKE_INSTALL_ROOT_DIR):
        shutil.rmtree(MAKE_INSTALL_ROOT_DIR)
    #create install dirs
    bldinstallercommon.create_dirs(MAKE_INSTALL_ROOT_DIR)

    cmd_args = QT_BUILD_OPTIONS.make_cmd
    if bldinstallercommon.is_unix_platform():
        cmd_args += ' -j' + str(QT_BUILD_OPTIONS.make_thread_count)
    elif bldinstallercommon.is_win_platform() and 'mingw32-make' in QT_BUILD_OPTIONS.make_cmd:
        cmd_args += ' -j' + str(QT_BUILD_OPTIONS.make_thread_count)
    bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), QT_SOURCE_DIR, abort_on_fail=QT_BUILD_OPTIONS.strict_mode, extra_env=QT_BUILD_OPTIONS.system_env)
    print_wrap('--------------------------------------------------------------------')