cmake_install &&

ln -sfn /usr/share/clang/run-clang-tidy.py /usr/bin/run-clang-tidy &&

if [[ "$LLVM_WITH_ANALYZER" == "y" ]]
then
  target="$INSTALL_ROOT/usr/share/llvm" &&

  cd "$SOURCE_DIRECTORY/clang/tools" &&

  install -v -o root -g root -m 0755 -d "$target/scan-build" &&

  for i in ccc-analyzer c++-analyzer; do
    install -v -o root -g root -m 0755 -t "${INSTALL_ROOT}/usr/bin/" scan-build/libexec/${i}
  done &&

  for i in build view; do
    install -v -o root -g root -m 0755 -t "${INSTALL_ROOT}/usr/bin/" scan-${i}/bin/scan-${i}
  done &&

  ln -sf "/usr/bin/ccc-analyzer" "${INSTALL_ROOT}/usr/bin/c++-analyzer" &&

  for i in scanview.css sorttable.js; do
    install -v -o root -g root -m 0644 -t "$target/scan-build" scan-build/share/scan-build/${i}
  done &&

  install -v -o root -g root -m 0755 -d "$target/scan-view" &&

  for i in Reporter.py ScanView.py startfile.py; do
    install -v -o root -g root -m 0644 -t "$target/scan-view" scan-view/share/${i}
  done &&

  install -v -o root -g root -m 0644 -t "${INSTALL_ROOT}/usr/share/man/man1/" scan-build/man/scan-build.1
fi &&

if [[ "$LLVM_WITH_CLANG" == y ]] && spell_ok python3; then
  cp -Rv "${SOURCE_DIRECTORY}/clang/bindings/python/clang" "${INSTALL_ROOT}/usr/lib/python$(installed_version python3 | cut -f1,2 -d.)/"
fi
