summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-07-14 16:58:24 +0200
committerEike Ziller <eike.ziller@qt.io>2020-07-17 06:23:03 +0000
commitded5c64d5391185214f45f01e6661dff6cffdea5 (patch)
treec35ee2d071722e4cc695fe1d4ff9be0a5bc4a5be /scripts
parentcc7caee1339f94795b3d7057d6d1336a51572e86 (diff)
downloadqt-creator-ded5c64d5391185214f45f01e6661dff6cffdea5.tar.gz
Fix deployment of clazy-standalone
On Linux and macOS, clazy-standalone links against some dynamic libraries which we need to ship. Fixes: QTCREATORBUG-24344 Change-Id: I4946d2ae22fc9363445e6a3eecb8d9e40be5ef0e Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/deployqt.py41
-rwxr-xr-xscripts/deployqtHelper_mac.sh3
2 files changed, 28 insertions, 16 deletions
diff --git a/scripts/deployqt.py b/scripts/deployqt.py
index 5d7011e068..851a642633 100755
--- a/scripts/deployqt.py
+++ b/scripts/deployqt.py
@@ -253,25 +253,29 @@ def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin):
clangbindirtarget))
resourcetarget = os.path.join(clanglibdirtarget, 'clang')
else:
+ # libclang -> Qt Creator libraries
libsources = glob(os.path.join(llvm_install_dir, 'lib', 'libclang.so*'))
for libsource in libsources:
deployinfo.append((libsource, os.path.join(install_dir, 'lib', 'qtcreator')))
- clangbinary = os.path.join(llvm_install_dir, 'bin', 'clang')
- clangdbinary = os.path.join(llvm_install_dir, 'bin', 'clangd')
- clangtidybinary = os.path.join(llvm_install_dir, 'bin', 'clang-tidy')
- clazybinary = os.path.join(llvm_install_dir, 'bin', 'clazy-standalone')
+ # clang binaries -> clang libexec
clangbinary_targetdir = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'bin')
if not os.path.exists(clangbinary_targetdir):
os.makedirs(clangbinary_targetdir)
- deployinfo.append((clangbinary, clangbinary_targetdir))
- deployinfo.append((clangdbinary, clangbinary_targetdir))
- deployinfo.append((clangtidybinary, clangbinary_targetdir))
- deployinfo.append((clazybinary, clangbinary_targetdir))
- # copy link target if clang is actually a symlink
- if os.path.islink(clangbinary):
- linktarget = os.readlink(clangbinary)
- deployinfo.append((os.path.join(os.path.dirname(clangbinary), linktarget),
- os.path.join(clangbinary_targetdir, linktarget)))
+ for binary in ['clang', 'clangd', 'clang-tidy', 'clazy-standalone']:
+ binary_filepath = os.path.join(llvm_install_dir, 'bin', binary)
+ deployinfo.append((binary_filepath, clangbinary_targetdir))
+ # add link target if binary is actually a symlink (to a binary in the same directory)
+ if os.path.islink(binary_filepath):
+ linktarget = os.readlink(binary_filepath)
+ deployinfo.append((os.path.join(os.path.dirname(binary_filepath), linktarget),
+ os.path.join(clangbinary_targetdir, linktarget)))
+ clanglibs_targetdir = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'lib')
+ # support libraries (for clazy) -> clang libexec
+ if not os.path.exists(clanglibs_targetdir):
+ os.makedirs(clanglibs_targetdir)
+ for lib_pattern in ['ClazyPlugin.so', 'libclang-cpp.so*']:
+ for lib in glob(os.path.join(llvm_install_dir, 'lib', lib_pattern)):
+ deployinfo.append((lib, clanglibs_targetdir))
resourcetarget = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'lib', 'clang')
print("copying libclang...")
@@ -281,10 +285,15 @@ def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin):
if common.is_linux_platform():
# libclang was statically compiled, so there is no need for the RPATHs
- # and they are confusing when fixing RPATHs later in the process
- print("removing libclang RPATHs...")
+ # and they are confusing when fixing RPATHs later in the process.
+ # Also fix clazy-standalone RPATH.
+ print("fixing Clang RPATHs...")
for source, target in deployinfo:
- if not os.path.islink(target):
+ filename = os.path.basename(source)
+ targetfilepath = target if not os.path.isdir(target) else os.path.join(target, filename)
+ if filename == 'clazy-standalone':
+ subprocess.check_call([chrpath_bin, '-r', '$ORIGIN/../lib', targetfilepath])
+ elif not os.path.islink(target):
targetfilepath = target if not os.path.isdir(target) else os.path.join(target, os.path.basename(source))
subprocess.check_call([chrpath_bin, '-d', targetfilepath])
diff --git a/scripts/deployqtHelper_mac.sh b/scripts/deployqtHelper_mac.sh
index 8844f8502d..f91423accb 100755
--- a/scripts/deployqtHelper_mac.sh
+++ b/scripts/deployqtHelper_mac.sh
@@ -133,6 +133,8 @@ if [ $LLVM_INSTALL_DIR ]; then
mkdir -p "$libexec_path/clang/lib"
cp -Rf "$LLVM_INSTALL_DIR"/lib/libclang.*dylib "$app_path/Contents/Frameworks/" || exit 1
cp -Rf "$LLVM_INSTALL_DIR"/lib/clang "$libexec_path/clang/lib/" || exit 1
+ cp -Rf "$LLVM_INSTALL_DIR"/lib/libclang-cpp.dylib "$libexec_path/clang/lib/" || exit 1
+ cp -Rf "$LLVM_INSTALL_DIR"/lib/ClazyPlugin.dylib "$libexec_path/clang/lib/" || exit 1
clangsource="$LLVM_INSTALL_DIR"/bin/clang
clanglinktarget="$(readlink "$clangsource")"
cp -Rf "$clangsource" "$libexec_path/clang/bin/" || exit 1
@@ -145,6 +147,7 @@ if [ $LLVM_INSTALL_DIR ]; then
cp -Rf "$clangtidysource" "$libexec_path/clang/bin/" || exit 1
clazysource="$LLVM_INSTALL_DIR"/bin/clazy-standalone
cp -Rf "$clazysource" "$libexec_path/clang/bin/" || exit 1
+ install_name_tool -add_rpath "@executable_path/../lib" "$libexec_path/clang/bin/clazy-standalone" || exit 1
fi
clangbackendArgument="-executable=$libexec_path/clangbackend"
clangpchmanagerArgument="-executable=$libexec_path/clangpchmanagerbackend"