From e989c05cd0e249be41cd7a4a24f2b126c3ce6f8d Mon Sep 17 00:00:00 2001 From: "Seth R. Johnson" Date: Thu, 26 Mar 2020 23:38:56 -0400 Subject: Add include-what-you-use (#15691) --- .../builtin/packages/iwyu/iwyu-013-cmake.patch | 34 ++++++++++++++++++++++ var/spack/repos/builtin/packages/iwyu/package.py | 27 +++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 var/spack/repos/builtin/packages/iwyu/iwyu-013-cmake.patch create mode 100644 var/spack/repos/builtin/packages/iwyu/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/iwyu/iwyu-013-cmake.patch b/var/spack/repos/builtin/packages/iwyu/iwyu-013-cmake.patch new file mode 100644 index 0000000000..78cb1a2d10 --- /dev/null +++ b/var/spack/repos/builtin/packages/iwyu/iwyu-013-cmake.patch @@ -0,0 +1,34 @@ +--- include-what-you-use/CMakeLists.txt 2019-10-24 15:47:52.000000000 -0400 ++++ spack-src/CMakeLists.txt 2020-03-26 07:16:53.284593661 -0400 +@@ -60,21 +60,22 @@ + # Use only major.minor.patch for the resource directory structure; some + # platforms include suffix in LLVM_VERSION. + set(llvm_ver ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}) +- set(clang_headers_src ${CMAKE_PREFIX_PATH}/lib/clang/${llvm_ver}/include) +- set(clang_headers_dst ${CMAKE_BINARY_DIR}/lib/clang/${llvm_ver}/include) ++ set(clang_headers_src "${LLVM_INSTALL_PREFIX}/lib/clang/${llvm_ver}/include") ++ set(clang_headers_dst "${CMAKE_BINARY_DIR}/lib/clang/${llvm_ver}/include") + +- file(GLOB_RECURSE in_files RELATIVE ${clang_headers_src} ${clang_headers_src}/*) ++ file(GLOB_RECURSE in_files RELATIVE "${clang_headers_src}" ++ "${clang_headers_src}/*") + + set(out_files) + foreach (file ${in_files}) +- set(src ${clang_headers_src}/${file}) +- set(dst ${clang_headers_dst}/${file}) ++ set(src "${clang_headers_src}/${file}") ++ set(dst "${clang_headers_dst}/${file}") + +- add_custom_command(OUTPUT ${dst} +- DEPENDS ${src} +- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} ++ add_custom_command(OUTPUT "${dst}" ++ DEPENDS "${src}" ++ COMMAND ${CMAKE_COMMAND} -E copy_if_different "${src}" "${dst}" + COMMENT "Copying clang's ${file}...") +- list(APPEND out_files ${dst}) ++ list(APPEND out_files "${dst}") + endforeach() + + add_custom_target(clang-resource-headers ALL DEPENDS ${out_files}) diff --git a/var/spack/repos/builtin/packages/iwyu/package.py b/var/spack/repos/builtin/packages/iwyu/package.py new file mode 100644 index 0000000000..a05ff073b7 --- /dev/null +++ b/var/spack/repos/builtin/packages/iwyu/package.py @@ -0,0 +1,27 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Iwyu(CMakePackage): + """include-what-you-use: A tool for use with clang to analyze #includes in + C and C++ source files + """ + + homepage = "https://include-what-you-use.org" + url = "https://include-what-you-use.org/downloads/include-what-you-use-0.13.src.tar.gz" + + maintainers = ['sethrj'] + + version('0.13', sha256='49294270aa64e8c04182369212cd919f3b3e0e47601b1f935f038c761c265bc9') + version('0.12', sha256='a5892fb0abccb820c394e4e245c00ef30fc94e4ae58a048b23f94047c0816025') + version('0.11', sha256='2d2877726c4aed9518cbb37673ffbc2b7da9c239bf8fe29432da35c1c0ec367a') + + patch('iwyu-013-cmake.patch', when='@0.13') + + depends_on('llvm+clang@9.0:9.999', when='@0.13') + depends_on('llvm+clang@8.0:8.999', when='@0.12') + depends_on('llvm+clang@7.0:7.999', when='@0.11') -- cgit v1.2.3-70-g09d2