def get_common_qmake_arguments(paths, caller_arguments): qtc_build_tree = paths.qtc_build if bldinstallercommon.is_mac_platform(): # add app bundle to path if this points to a binary installation app_bundles = glob.glob(os.path.join(qtc_build_tree, "*.app")) if len(app_bundles) == 1: qtc_build_tree = app_bundles[0] build_type = 'debug' if caller_arguments.debug else 'release' common_qmake_arguments = [ '-r', 'CONFIG+={0}'.format(build_type), 'CONFIG+=force_debug_info', 'CONFIG+=separate_debug_info', 'IDE_SOURCE_TREE="{0}"'.format(paths.qtc_dev), 'IDE_BUILD_TREE="{0}"'.format(qtc_build_tree), 'IDE_OUTPUT_PATH="{0}"'.format(paths.target) ] if caller_arguments.plugin_search_paths: common_qmake_arguments.append('QTC_PLUGIN_DIRS={0}'.format(' '.join( caller_arguments.plugin_search_paths))) if caller_arguments.additional_qmake_arguments: common_qmake_arguments.extend( caller_arguments.additional_qmake_arguments) if bldinstallercommon.is_mac_platform(): # work around QTBUG-41238 common_qmake_arguments.append('QMAKE_MAC_SDK=macosx') if sys.platform == 'win32': # allow app to run on Windows XP common_qmake_arguments.append('QMAKE_SUBSYSTEM_SUFFIX=,5.01') return common_qmake_arguments
def get_static_qt_configure_options(openssl_dir): options = get_common_qt_configure_options() + '-static ' 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
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
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)
def build_clazy(toolchain, src_path, build_path, install_path, bitness=64, environment=None): if build_path and not os.path.lexists(build_path): os.makedirs(build_path) cmake_cmd = [ 'cmake', '-G', cmake_generator(toolchain), '-DCMAKE_INSTALL_PREFIX=' + install_path, '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_PREFIX_PATH=' + install_path ] if is_msvc_toolchain(toolchain): cmake_cmd.append('-DCLANG_LIBRARY_IMPORT=' + build_path + '/../build/lib/clang.lib') if bldinstallercommon.is_mac_platform(): cmake_cmd.append('-DREADLINK_CMD=greadlink') cmake_cmd.extend(bitness_flags(bitness)) cmake_cmd.append(src_path) bldinstallercommon.do_execute_sub_process(cmake_cmd, build_path, extra_env=environment) install_targets = ['install/strip'] if is_msvc_toolchain(toolchain): install_targets = ['install'] # There is no 'install/strip' for nmake. build_and_install(toolchain, build_path, environment, [], install_targets)
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) 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)
def get_common_qmake_arguments(paths, caller_arguments): qtc_build_tree = paths.qtc_build qtc_build_app_bundle = os.path.join(qtc_build_tree, 'Qt Creator.app') if bldinstallercommon.is_mac_platform() and os.path.isdir(qtc_build_app_bundle): qtc_build_tree = qtc_build_app_bundle build_type = 'debug' if caller_arguments.debug else 'release' common_qmake_arguments = ['-r', 'CONFIG+={0}'.format(build_type), 'IDE_SOURCE_TREE="{0}"'.format(paths.qtc_dev), 'IDE_BUILD_TREE="{0}"'.format(qtc_build_tree), 'IDE_OUTPUT_PATH="{0}"'.format(paths.target)] if caller_arguments.plugin_search_paths: common_qmake_arguments.append('QTC_PLUGIN_DIRS={0}'.format(' '.join(caller_arguments.plugin_search_paths))) if caller_arguments.additional_qmake_arguments: common_qmake_arguments.extend(caller_arguments.additional_qmake_arguments) if bldinstallercommon.is_mac_platform(): # work around QTBUG-41238 common_qmake_arguments.append('QMAKE_MAC_SDK=macosx') if sys.platform == 'win32': # allow app to run on Windows XP common_qmake_arguments.append('QMAKE_SUBSYSTEM_SUFFIX=,5.01') return common_qmake_arguments
def add_commandline_arguments(parser): parser.add_argument('--qt5path', help="here it expects a compiled Qt5", required=True) parser.epilog += " --qt5path qtcreator_qt5" if bldinstallercommon.is_mac_platform(): parser.add_argument('--keychain_unlock_script', help="script for unlocking the keychain used for signing") parser.epilog += " --keychain_unlock_script $HOME/unlock-keychain.sh" if bldinstallercommon.is_win_platform(): parser.add_argument('--python_path', help="path to python libraries for use by cdbextension") parser.add_argument('--skip_cdb', help="skip cdbextension and the python dependency packaging step", action='store_true', default=False) parser.add_argument('--elfutils_path', help='elfutils installation path for use by perfprofiler')
def check_arguments(callerArguments): if bldinstallercommon.is_mac_platform(): if callerArguments.keychain_unlock_script: if not os.environ['SIGNING_IDENTITY']: print('error: Environment variable SIGNING_IDENTITY not set') sys.exit(1) if not os.path.lexists(callerArguments.qt5path) and not callerArguments.qt_modules: parser.print_help() print(("error: You have to pass the --qt-module argument if the {0} does not exist" + os.linesep + os.linesep).format(callerArguments.qt5path)) sys.exit(1)
def get_common_qmake_arguments(paths, caller_arguments): qtc_build_tree = paths.qtc_build if bldinstallercommon.is_mac_platform(): # add app bundle to path if this points to a binary installation app_bundles = glob.glob(os.path.join(qtc_build_tree, "*.app")) if len(app_bundles) == 1: qtc_build_tree = app_bundles[0] build_type = 'debug' if caller_arguments.debug else 'release' common_qmake_arguments = ['-r', 'CONFIG+={0}'.format(build_type), 'IDE_SOURCE_TREE="{0}"'.format(paths.qtc_dev), 'IDE_BUILD_TREE="{0}"'.format(qtc_build_tree), 'IDE_OUTPUT_PATH="{0}"'.format(paths.target)] if caller_arguments.plugin_search_paths: common_qmake_arguments.append('QTC_PLUGIN_DIRS={0}'.format(' '.join(caller_arguments.plugin_search_paths))) if caller_arguments.additional_qmake_arguments: common_qmake_arguments.extend(caller_arguments.additional_qmake_arguments) if bldinstallercommon.is_mac_platform(): # work around QTBUG-41238 common_qmake_arguments.append('QMAKE_MAC_SDK=macosx') if sys.platform == 'win32': # allow app to run on Windows XP common_qmake_arguments.append('QMAKE_SUBSYSTEM_SUFFIX=,5.01') return common_qmake_arguments
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
def check_arguments(callerArguments): if bldinstallercommon.is_mac_platform(): if callerArguments.keychain_unlock_script: if not os.environ['SIGNING_IDENTITY']: print('error: Environment variable SIGNING_IDENTITY not set') sys.exit(1) if not os.path.lexists( callerArguments.qt5path) and not callerArguments.qt_modules: parser.print_help() print(( "error: You have to pass the --qt-module argument if the {0} does not exist" + os.linesep + os.linesep).format(callerArguments.qt5path)) sys.exit(1)
def get_common_qmake_arguments(paths, caller_arguments): qtc_build_tree = paths.qtc_build qtc_build_app_bundle = os.path.join(qtc_build_tree, 'Qt Creator.app') if bldinstallercommon.is_mac_platform() and os.path.isdir( qtc_build_app_bundle): qtc_build_tree = qtc_build_app_bundle build_type = 'debug' if caller_arguments.debug else 'release' common_qmake_arguments = [ '-r', 'CONFIG+={0}'.format(build_type), 'IDE_SOURCE_TREE="{0}"'.format(paths.qtc_dev), 'IDE_BUILD_TREE="{0}"'.format(qtc_build_tree), 'IDE_OUTPUT_PATH="{0}"'.format(paths.target) ] if caller_arguments.plugin_search_paths: common_qmake_arguments.append('QTC_PLUGIN_DIRS={0}'.format(' '.join( caller_arguments.plugin_search_paths))) if caller_arguments.additional_qmake_arguments: common_qmake_arguments.extend( caller_arguments.additional_qmake_arguments) if bldinstallercommon.is_mac_platform(): # work around QTBUG-41238 common_qmake_arguments.append('QMAKE_MAC_SDK=macosx') if sys.platform == 'win32': # allow app to run on Windows XP common_qmake_arguments.append('QMAKE_SUBSYSTEM_SUFFIX=,5.01') return common_qmake_arguments
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")
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
def add_commandline_arguments(parser): parser.add_argument('--qt5path', help="here it expects a compiled Qt5", required=True) parser.epilog += " --qt5path qtcreator_qt5" if bldinstallercommon.is_mac_platform(): parser.add_argument( '--keychain_unlock_script', help="script for unlocking the keychain used for signing") parser.epilog += " --keychain_unlock_script $HOME/unlock-keychain.sh" if bldinstallercommon.is_win_platform(): parser.add_argument( '--python_path', help="path to python libraries for use by cdbextension") parser.add_argument( '--skip_cdb', help="skip cdbextension and the python dependency packaging step", action='store_true', default=False)
def check_arguments(callerArguments): if bldinstallercommon.is_mac_platform(): if callerArguments.keychain_unlock_script: # inherited by child processes os.environ["SIGNING_IDENTITY"] = get_pkg_value("SIGNING_IDENTITY") os.environ["SIGNING_FLAGS"] = get_pkg_value("SIGNING_FLAGS") if not os.environ.get('SIGNING_IDENTITY') or not os.environ.get( 'SIGNING_FLAGS'): print( 'error: Environment variable(s) SIGNING_IDENTITY/SIGNING_FLAGS not set' ) sys.exit(1) if not os.path.lexists( callerArguments.qt5path) and not callerArguments.qt_modules: parser.print_help() print(( "error: You have to pass the --qt-module argument if the {0} does not exist" + os.linesep + os.linesep).format(callerArguments.qt5path)) sys.exit(1)
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")
def get_common_qt_configure_options(): plat = platform.system().lower() # common options = get_common_allos_qt_configure_options() options += '-no-qml-debug ' # Windows if plat.startswith('win'): options += '-no-icu -mp ' # Unix else: # OSX and Linux options += get_common_unix_qt_configure_options() # Linux if plat.startswith('linux'): options += '-qt-xcb -no-opengl -no-icu -no-libudev ' options += '-qt-pcre -no-glib -no-egl ' options += '-no-xinput2 -no-sm ' if bldinstallercommon.is_mac_platform(): options += '-no-freetype ' return options
def get_common_qt_configure_options(): plat = platform.system().lower() # common options = get_common_allos_qt_configure_options() options += '-no-sql-sqlite -no-qml-debug ' # Windows if plat.startswith('win'): options += '-no-icu -mp ' # Unix else: # OSX and Linux options += get_common_unix_qt_configure_options() # Linux if plat.startswith('linux'): options += '-qt-xcb -no-opengl -no-icu -no-libudev ' options += '-qt-pcre -no-glib -no-egl ' options += '-no-xinput2 -no-sm ' if bldinstallercommon.is_mac_platform(): options += '-no-freetype ' return options
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
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
def get_build_env(openssl_dir): tmp = dict(os.environ) if bldinstallercommon.is_mac_platform() and os.path.isdir(openssl_dir): tmp['OPENSSL_LIBS'] = "-L{0}/lib -lssl -lcrypto".format(openssl_dir) return tmp
def __init__(self, qt_source_package_uri, qt_configure_options, qt_installer_framework_uri, qt_installer_framework_branch, qt_installer_framework_qmake_args, openssl_dir, product_key_checker_pri, incremental_build=False): self.incremental_mode = incremental_build self.qt_source_dir = os.path.join(ROOT_DIR, 'qt-src') self.qt_build_dir = os.path.join(ROOT_DIR, 'qt-bld') self.qt_build_dir_dynamic = os.path.join(ROOT_DIR, 'qt-bld-dynamic') self.installer_framework_source_dir = os.path.join(ROOT_DIR, 'ifw-src') self.installer_framework_build_dir = os.path.join(ROOT_DIR, 'ifw-bld') self.installer_framework_pkg_dir = os.path.join(ROOT_DIR, 'ifw-pkg') self.installer_framework_target_dir = os.path.join( ROOT_DIR, 'ifw-target') self.qt_installer_framework_uri = qt_installer_framework_uri self.qt_installer_framework_uri_saveas = os.path.join( ROOT_DIR, os.path.basename(self.qt_installer_framework_uri)) self.qt_installer_framework_branch = qt_installer_framework_branch self.qt_installer_framework_qmake_args = qt_installer_framework_qmake_args self.openssl_dir = openssl_dir self.qt_build_modules = " module-qtbase module-qtdeclarative module-qttools module-qttranslations" self.qt_build_modules_docs = " module-qttools" if bldinstallercommon.is_win_platform(): self.qt_build_modules += " module-qtwinextras" self.make_cmd = 'nmake' self.make_doc_cmd = 'nmake' self.make_install_cmd = 'nmake install' self.qt_qmake_bin = 'qmake.exe' self.qt_configure_bin = self.qt_source_dir + os.sep + 'configure.bat' else: self.make_cmd = 'make -j' + str(multiprocessing.cpu_count() + 1) self.make_doc_cmd = 'make' self.make_install_cmd = 'make install' self.qt_qmake_bin = 'qmake' self.qt_configure_bin = self.qt_source_dir + os.sep + 'configure' self.build_artifacts_dir = os.path.join( ROOT_DIR, pkg_constants.IFW_BUILD_ARTIFACTS_DIR) self.mac_deploy_qt_archive_name = 'macdeployqt.7z' self.mac_qt_menu_nib_archive_name = 'qt_menu.nib.7z' # determine filenames used later on self.architecture = '' # if this is cross-compilation attempt to parse the target architecture from the given -platform if '-platform' in qt_configure_options: temp = qt_configure_options.split(' ') plat = temp[temp.index('-platform') + 1] bits = ''.join(re.findall(r'\d+', plat)) if bits == '32': self.architecture = 'x86' else: self.architecture = 'x64' if not self.architecture: self.architecture = bldinstallercommon.get_architecture() self.plat_suffix = bldinstallercommon.get_platform_suffix() self.installer_framework_archive_name = 'installer-framework-build-' + self.plat_suffix + '-' + self.architecture + '.7z' self.installer_base_archive_name = 'installerbase-' + self.plat_suffix + '-' + self.architecture + '.7z' self.installer_framework_payload_arch = 'installer-framework-build-stripped-' + self.plat_suffix + '-' + self.architecture + '.7z' self.qt_source_package_uri = qt_source_package_uri self.qt_source_package_uri_saveas = os.path.join( ROOT_DIR, os.path.basename(self.qt_source_package_uri)) # Set Qt build prefix qt_prefix = ' -prefix ' + self.qt_build_dir + os.sep + 'qtbase' self.qt_configure_options = qt_configure_options + qt_prefix # Product key checker self.product_key_checker_pri = product_key_checker_pri if product_key_checker_pri: if os.path.isfile(product_key_checker_pri): self.qt_installer_framework_qmake_args += [ '-r', 'PRODUCTKEYCHECK_PRI_FILE=' + self.product_key_checker_pri ] # macOS specific if bldinstallercommon.is_mac_platform(): self.qt_installer_framework_qmake_args += [ '-r', '"LIBS+=-framework IOKit"' ] # sanity check self.sanity_check()
def __init__(self, qt_source_package_uri, qt_configure_options, qt_installer_framework_uri, qt_installer_framework_branch, qt_installer_framework_qmake_args, openssl_dir, product_key_checker_pri, qt_binaries_static, qt_binaries_dynamic, signserver, signpwd, incremental_build = False, squish_dir = "", squish_src = "" ): self.squish_dir = squish_dir self.squish_src = squish_src self.signserver = signserver self.signpwd = signpwd self.incremental_mode = incremental_build self.qt_source_dir = os.path.join(ROOT_DIR, 'qt-src') self.qt_build_dir = os.path.join(ROOT_DIR, 'qt-bld') self.qt_build_dir_dynamic = os.path.join(ROOT_DIR, 'qt-bld-dynamic') self.installer_framework_source_dir = os.path.join(ROOT_DIR, 'ifw-src') self.installer_framework_build_dir = os.path.join(ROOT_DIR, 'ifw-bld') self.installer_framework_build_dir_squish = os.path.join(ROOT_DIR, 'ifw-bld_squish') self.installer_framework_pkg_dir = os.path.join(ROOT_DIR, 'ifw-pkg') self.installer_framework_target_dir = os.path.join(ROOT_DIR, 'ifw-target') self.qt_installer_framework_uri = qt_installer_framework_uri self.qt_installer_framework_uri_saveas = os.path.join(ROOT_DIR, os.path.basename(self.qt_installer_framework_uri)) self.qt_installer_framework_branch = qt_installer_framework_branch self.qt_installer_framework_branch_pretty = qt_installer_framework_branch.replace("/", "_") self.qt_installer_framework_qmake_args = qt_installer_framework_qmake_args self.openssl_dir = openssl_dir self.qt_binaries_static = qt_binaries_static if self.qt_binaries_static: self.qt_binaries_static_saveas = os.path.join(ROOT_DIR, os.path.basename(self.qt_binaries_static)) self.qt_binaries_dynamic = qt_binaries_dynamic if self.qt_binaries_dynamic: self.qt_binaries_dynamic_saveas = os.path.join(ROOT_DIR, os.path.basename(self.qt_binaries_dynamic)) self.qt_build_modules = ["qtbase", "qtdeclarative", "qttools", "qttranslations"] self.qt_build_modules_docs = ["qtbase", "qttools"] if bldinstallercommon.is_win_platform(): self.qt_build_modules.append("qtwinextras") self.make_cmd = 'jom.exe' self.make_doc_cmd = 'jom.exe' self.make_install_cmd = 'jom.exe install' self.qt_qmake_bin = 'qmake.exe' self.qt_configure_bin = self.qt_source_dir + os.sep + 'configure.bat' else: self.make_cmd = 'make -j' + str(multiprocessing.cpu_count() + 1) self.make_doc_cmd = 'make' self.make_install_cmd = 'make install' self.qt_qmake_bin = 'qmake' self.qt_configure_bin = self.qt_source_dir + os.sep + 'configure' self.build_artifacts_dir = os.path.join(ROOT_DIR, pkg_constants.IFW_BUILD_ARTIFACTS_DIR) self.mac_deploy_qt_archive_name = 'macdeployqt.7z' self.mac_qt_menu_nib_archive_name = 'qt_menu.nib.7z' # determine filenames used later on self.architecture = '' # if this is cross-compilation attempt to parse the target architecture from the given -platform if '-platform' in qt_configure_options: temp = qt_configure_options.split(' ') plat = temp[temp.index('-platform') + 1] bits = ''.join(re.findall(r'\d+', plat)) if bits == '32': self.architecture = 'x86' else: self.architecture = 'x64' if not self.architecture: self.architecture = bldinstallercommon.get_architecture() self.plat_suffix = bldinstallercommon.get_platform_suffix() self.installer_framework_archive_name = 'installer-framework-build-' + self.qt_installer_framework_branch_pretty + "-" + self.plat_suffix + '-' + self.architecture + '.7z' self.installer_framework_with_squish_archive_name = 'installer-framework-build-squish-' + self.qt_installer_framework_branch_pretty + "-" + self.plat_suffix + '-' + self.architecture + '.7z' self.installer_base_archive_name = 'installerbase-' + self.qt_installer_framework_branch_pretty + "-" + self.plat_suffix + '-' + self.architecture + '.7z' self.installer_framework_payload_arch = 'installer-framework-build-stripped-' + self.qt_installer_framework_branch_pretty + "-" + self.plat_suffix + '-' + self.architecture + '.7z' self.qt_source_package_uri = qt_source_package_uri self.qt_source_package_uri_saveas = os.path.join(ROOT_DIR, os.path.basename(self.qt_source_package_uri)) # Set Qt build prefix qt_prefix = ' -prefix ' + self.qt_build_dir + os.sep + 'qtbase' self.qt_configure_options = qt_configure_options + qt_prefix # Product key checker self.product_key_checker_pri = product_key_checker_pri if product_key_checker_pri: if os.path.isfile(product_key_checker_pri): self.qt_installer_framework_qmake_args += ['PRODUCTKEYCHECK_PRI_FILE=' + self.product_key_checker_pri] # macOS specific if bldinstallercommon.is_mac_platform(): self.qt_installer_framework_qmake_args += ['"LIBS+=-framework IOKit"'] # sanity check self.sanity_check()
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') qmakeCommand.append('QTC_SKIP_SDKTOOL=1') if callerArguments.additional_qmake_arguments: qmakeCommand.extend(callerArguments.additional_qmake_arguments) runCommand(qmakeCommand, qtCreatorBuildDirectory,
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 if __name__ == "__main__": bldinstallercommon.init_common_module(os.path.dirname(os.path.realpath(__file__))) # install an argument parser parser = argparse.ArgumentParser(description="build Qt 5 based Qt Creator", formatter_class=argparse.RawTextHelpFormatter) add_common_commandline_arguments(parser) parser.add_argument('--qt5path', help="here it expects a compiled Qt5", required=True) parser.add_argument('--versiondescription', help="version description to be shown in the about dialog, e.g. 'pre-2.7.2") if bldinstallercommon.is_mac_platform(): parser.add_argument('--keychain_unlock_script', help="script for unlocking the keychain used for signing") parser.epilog += " --keychain_unlock_script $HOME/unlock-keychain.sh" parser.epilog += " --qt5path qtcreator_qt5" callerArguments = parser.parse_args() # cleanup some values inside the callerArguments object stripVars(callerArguments, "\"") if callerArguments.qt5path != os.path.abspath(callerArguments.qt5path): print("changing the value of --qt5path from {0} to {1}".format(callerArguments.qt5path, os.path.abspath(callerArguments.qt5path))) callerArguments.qt5path = os.path.abspath(callerArguments.qt5path) qtCreatorSourceDirectory = os.path.abspath('qt-creator') qtCreatorBuildDirectory = os.path.abspath(os.path.join(qtCreatorSourceDirectory,