forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -253,25 +253,29 @@ def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin):
|
|||||||
clangbindirtarget))
|
clangbindirtarget))
|
||||||
resourcetarget = os.path.join(clanglibdirtarget, 'clang')
|
resourcetarget = os.path.join(clanglibdirtarget, 'clang')
|
||||||
else:
|
else:
|
||||||
|
# libclang -> Qt Creator libraries
|
||||||
libsources = glob(os.path.join(llvm_install_dir, 'lib', 'libclang.so*'))
|
libsources = glob(os.path.join(llvm_install_dir, 'lib', 'libclang.so*'))
|
||||||
for libsource in libsources:
|
for libsource in libsources:
|
||||||
deployinfo.append((libsource, os.path.join(install_dir, 'lib', 'qtcreator')))
|
deployinfo.append((libsource, os.path.join(install_dir, 'lib', 'qtcreator')))
|
||||||
clangbinary = os.path.join(llvm_install_dir, 'bin', 'clang')
|
# clang binaries -> clang libexec
|
||||||
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')
|
|
||||||
clangbinary_targetdir = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'bin')
|
clangbinary_targetdir = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'bin')
|
||||||
if not os.path.exists(clangbinary_targetdir):
|
if not os.path.exists(clangbinary_targetdir):
|
||||||
os.makedirs(clangbinary_targetdir)
|
os.makedirs(clangbinary_targetdir)
|
||||||
deployinfo.append((clangbinary, clangbinary_targetdir))
|
for binary in ['clang', 'clangd', 'clang-tidy', 'clazy-standalone']:
|
||||||
deployinfo.append((clangdbinary, clangbinary_targetdir))
|
binary_filepath = os.path.join(llvm_install_dir, 'bin', binary)
|
||||||
deployinfo.append((clangtidybinary, clangbinary_targetdir))
|
deployinfo.append((binary_filepath, clangbinary_targetdir))
|
||||||
deployinfo.append((clazybinary, clangbinary_targetdir))
|
# add link target if binary is actually a symlink (to a binary in the same directory)
|
||||||
# copy link target if clang is actually a symlink
|
if os.path.islink(binary_filepath):
|
||||||
if os.path.islink(clangbinary):
|
linktarget = os.readlink(binary_filepath)
|
||||||
linktarget = os.readlink(clangbinary)
|
deployinfo.append((os.path.join(os.path.dirname(binary_filepath), linktarget),
|
||||||
deployinfo.append((os.path.join(os.path.dirname(clangbinary), linktarget),
|
os.path.join(clangbinary_targetdir, 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')
|
resourcetarget = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'lib', 'clang')
|
||||||
|
|
||||||
print("copying libclang...")
|
print("copying libclang...")
|
||||||
@@ -281,10 +285,15 @@ def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin):
|
|||||||
|
|
||||||
if common.is_linux_platform():
|
if common.is_linux_platform():
|
||||||
# libclang was statically compiled, so there is no need for the RPATHs
|
# libclang was statically compiled, so there is no need for the RPATHs
|
||||||
# and they are confusing when fixing RPATHs later in the process
|
# and they are confusing when fixing RPATHs later in the process.
|
||||||
print("removing libclang RPATHs...")
|
# Also fix clazy-standalone RPATH.
|
||||||
|
print("fixing Clang RPATHs...")
|
||||||
for source, target in deployinfo:
|
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))
|
targetfilepath = target if not os.path.isdir(target) else os.path.join(target, os.path.basename(source))
|
||||||
subprocess.check_call([chrpath_bin, '-d', targetfilepath])
|
subprocess.check_call([chrpath_bin, '-d', targetfilepath])
|
||||||
|
|
||||||
|
@@ -133,6 +133,8 @@ if [ $LLVM_INSTALL_DIR ]; then
|
|||||||
mkdir -p "$libexec_path/clang/lib"
|
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/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/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
|
clangsource="$LLVM_INSTALL_DIR"/bin/clang
|
||||||
clanglinktarget="$(readlink "$clangsource")"
|
clanglinktarget="$(readlink "$clangsource")"
|
||||||
cp -Rf "$clangsource" "$libexec_path/clang/bin/" || exit 1
|
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
|
cp -Rf "$clangtidysource" "$libexec_path/clang/bin/" || exit 1
|
||||||
clazysource="$LLVM_INSTALL_DIR"/bin/clazy-standalone
|
clazysource="$LLVM_INSTALL_DIR"/bin/clazy-standalone
|
||||||
cp -Rf "$clazysource" "$libexec_path/clang/bin/" || exit 1
|
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
|
fi
|
||||||
clangbackendArgument="-executable=$libexec_path/clangbackend"
|
clangbackendArgument="-executable=$libexec_path/clangbackend"
|
||||||
clangpchmanagerArgument="-executable=$libexec_path/clangpchmanagerbackend"
|
clangpchmanagerArgument="-executable=$libexec_path/clangpchmanagerbackend"
|
||||||
|
Reference in New Issue
Block a user