diff options
author | Eike Ziller <eike.ziller@qt.io> | 2020-06-05 11:56:19 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2020-06-05 17:34:51 +0000 |
commit | 0f362115c1b08124fb63a350a4475226c1354248 (patch) | |
tree | 14518675c21071aa91e2c8e41773334e157d4c1a /scripts | |
parent | e2e50f80fa1267bcbc69d321b351465e4ca6e799 (diff) | |
download | qt-creator-0f362115c1b08124fb63a350a4475226c1354248.tar.gz |
CMake build: Deploy elfutils
Fixes: QTCREATORBUG-24131
Change-Id: Ibfe829492e86ce1563882cf3be6469f9e553812d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build.py | 16 | ||||
-rwxr-xr-x | scripts/deployqt.py | 45 |
2 files changed, 55 insertions, 6 deletions
diff --git a/scripts/build.py b/scripts/build.py index 4547bf647c..27315f3b2c 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -97,8 +97,8 @@ def build_qtcreator(args, paths): prefix_paths = [paths.qt] if args.llvm_path: prefix_paths += [args.llvm_path] - if args.elfutils_path: - prefix_paths += [args.elfutils_path] + if paths.elfutils: + prefix_paths += [paths.elfutils] build_type = 'Debug' if args.debug else 'Release' with_docs_str = 'OFF' if args.no_docs else 'ON' cmake_args = ['cmake', @@ -200,9 +200,11 @@ def deploy_qt(args, paths): qt_imports, qt_qml], paths.build) else: + cmd_args = ['python', '-u', os.path.join(paths.src, 'scripts', 'deployqt.py'), '-i'] + if paths.elfutils: + cmd_args.extend(['--elfutils-path', paths.elfutils]) exe = os.path.join(paths.install, 'bin', args.app_target) - common.check_print_call(['python', '-u', os.path.join(paths.src, 'scripts', 'deployqt.py'), - '-i', exe, os.path.join(paths.qt, 'bin', 'qmake')], + common.check_print_call(cmd_args + [exe, os.path.join(paths.qt, 'bin', 'qmake')], paths.build) def package_qtcreator(args, paths): @@ -237,7 +239,8 @@ def get_paths(args): Paths = collections.namedtuple('Paths', ['qt', 'src', 'build', 'install', 'dev_install', 'wininterrupt_install', - 'qtcreatorcdbext_install', 'result']) + 'qtcreatorcdbext_install', 'result', + 'elfutils']) build_path = os.path.abspath(args.build) install_path = os.path.join(build_path, 'install') return Paths(qt=os.path.abspath(args.qt_path), @@ -247,7 +250,8 @@ def get_paths(args): dev_install=os.path.join(install_path, 'qt-creator-dev'), wininterrupt_install=os.path.join(install_path, 'wininterrupt'), qtcreatorcdbext_install=os.path.join(install_path, 'qtcreatorcdbext'), - result=build_path) + result=build_path, + elfutils=os.path.abspath(args.elfutils_path) if args.elfutils_path else None) def main(): args = get_arguments() diff --git a/scripts/deployqt.py b/scripts/deployqt.py index a54c07ecbe..4579c92cc3 100755 --- a/scripts/deployqt.py +++ b/scripts/deployqt.py @@ -45,6 +45,8 @@ def get_args(): parser = argparse.ArgumentParser(description='Deploy Qt Creator dependencies for packaging') parser.add_argument('-i', '--ignore-errors', help='For backward compatibility', action='store_true', default=False) + parser.add_argument('--elfutils-path', + help='Path to elfutils installation for use by perfprofiler (Windows, Linux)') parser.add_argument('qtcreator_binary', help='Path to Qt Creator binary') parser.add_argument('qmake_binary', help='Path to qmake binary') @@ -283,6 +285,47 @@ def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin): shutil.rmtree(resourcetarget) common.copytree(resourcesource, resourcetarget, symlinks=True) +def deploy_elfutils(qtc_install_dir, chrpath_bin, args): + if common.is_mac_platform(): + return + + def lib_name(name, version): + return ('lib' + name + '.so.' + version if common.is_linux_platform() + else name + '.dll') + + version = '1' + libs = ['elf', 'dw'] + elfutils_lib_path = os.path.join(args.elfutils_path, 'lib') + if common.is_linux_platform(): + install_path = os.path.join(qtc_install_dir, 'lib', 'elfutils') + backends_install_path = install_path + elif common.is_windows_platform(): + install_path = os.path.join(qtc_install_dir, 'bin') + backends_install_path = os.path.join(qtc_install_dir, 'lib', 'elfutils') + libs.append('eu_compat') + if not os.path.exists(install_path): + os.makedirs(install_path) + if not os.path.exists(backends_install_path): + os.makedirs(backends_install_path) + # copy main libs + libs = [os.path.join(elfutils_lib_path, lib_name(lib, version)) for lib in libs] + for lib in libs: + print(lib, '->', install_path) + shutil.copy(lib, install_path) + # fix rpath + if common.is_linux_platform(): + relative_path = os.path.relpath(backends_install_path, install_path) + subprocess.check_call([chrpath_bin, '-r', os.path.join('$ORIGIN', relative_path), + os.path.join(install_path, lib_name('dw', version))]) + # copy backend files + # only non-versioned, we never dlopen the versioned ones + files = glob(os.path.join(elfutils_lib_path, 'elfutils', '*ebl_*.*')) + versioned_files = glob(os.path.join(elfutils_lib_path, 'elfutils', '*ebl_*.*-*.*.*')) + unversioned_files = [file for file in files if file not in versioned_files] + for file in unversioned_files: + print(file, '->', backends_install_path) + shutil.copy(file, backends_install_path) + def main(): args = get_args() @@ -329,6 +372,8 @@ def main(): if "LLVM_INSTALL_DIR" in os.environ: deploy_libclang(install_dir, os.environ["LLVM_INSTALL_DIR"], chrpath_bin) + if args.elfutils_path: + deploy_elfutils(install_dir, chrpath_bin, args) if not common.is_windows_platform(): print("fixing rpaths...") common.fix_rpaths(install_dir, os.path.join(qt_deploy_prefix, 'lib'), qt_install_info, chrpath_bin) |