%global toolchain clang %global longname include-what-you-use Summary: A tool for use with clang to analyze #includes in C and C++ source files Name: iwyu License: NCSA Version: 0.19 Release: 2%{?dist} URL: https://include-what-you-use.org/ Source0: https://github.com/%{longname}/%{longname}/archive/refs/tags/%{version}.tar.gz BuildRequires: boost-devel BuildRequires: clang BuildRequires: clang-devel BuildRequires: clang-tools-extra-devel BuildRequires: cmake BuildRequires: libcxx-devel BuildRequires: libffi-devel BuildRequires: llvm-devel BuildRequires: ncurses-compat-libs BuildRequires: python3-devel BuildRequires: zlib-devel # Exclude i386 Failing tests # cxx.test_quoted_includes_first (Failed) # cxx.test_stl_container_provides_allocator (Failed) ExcludeArch: i386 # Virtual provide the long name Provides: include-what-you-use = %{version}-%{release} Provides: include-what-you-use%{?_isa} = %{version}-%{release} %global _description %{expand: "Include what you use" means this: for every symbol (type, function, variable, or macro) that you use in foo.cc (or foo.cpp), either foo.cc or foo.h should include a .h file that exports the declaration of that symbol. (Similarly, for foo_test.cc, either foo_test.cc or foo.h should do the including.) Obviously symbols defined in foo.cc itself are excluded from this requirement. This puts us in a state where every file includes the headers it needs to declare the symbols that it uses. When every file includes what it uses, then it is possible to edit any file and remove unused headers, without fear of accidentally breaking the upwards dependencies of that file. It also becomes easy to automatically track and update dependencies in the source code.} %description %_description %prep %autosetup -n %{longname}-%{version} # Disble failing test # https://github.com/include-what-you-use/include-what-you-use/issues/879 rm tests/cxx/badinc.cc # Disable inline assembly test for arches other than x86_64 %ifnarch x86_64 rm tests/cxx/ms_inline_asm.cc %endif %build # Fix shebangs %py3_shebang_fix fix_includes.py %py3_shebang_fix iwyu_tool.py LDFLAGS="${LDFLAGS} -pie" %cmake -G "Unix Makefiles" \ -DCMAKE_PREFIX_PATH=%{_libdir} %cmake_build %install %cmake_install %check # Enable finding of headers in tests failed_tests_add_include_argument=( "iterator.cc" "no_char_traits.cc" "scope_crash.cc" "std_size_t.cc" "stl_container_provides_allocator.cc") failed_tests_additional_include_argument=( "associated_h_file_heuristic.cc" "catch.cc" "check_also.cc" "computed_include.cc" "libbuiltins.cc" "macro_defined_by_includer.cc" "pch_in_code.cc" "precomputed_tpl_args.cc" "quoted_includes_first.cc" "sizeof_reference.cc" "uses_printf.cc") for test in ${failed_tests_add_include_argument[@]};do sed -i "/===\/\//a\/\/ IWYU_ARGS: -I %clang_resource_dir/include/" tests/cxx/$test done for test in ${failed_tests_additional_include_argument[@]};do sed -i "s|-I .|-I . -I %clang_resource_dir/include|g" tests/cxx/$test done %ctest %files %doc README.md %license LICENSE.TXT %{_bindir}/fix_includes.py %{_bindir}/include-what-you-use %{_bindir}/iwyu_tool.py %{_mandir}/man1/include-what-you-use.* %dir %{_datadir}/include-what-you-use %{_datadir}/include-what-you-use/*.imp %changelog * Fri Mar 03 2023 Benson Muite - 0.19-2 - Use clang_major_version macro - Remove files with tests that are not run * Thu Mar 02 2023 Benson Muite - 0.19-1 - Initial packaging for unretirement * Thu Jul 25 2019 Fedora Release Engineering - 0.9-0.5.20171001git576e80f - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild * Fri Feb 01 2019 Fedora Release Engineering - 0.9-0.4.20171001git576e80f - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild * Fri Jul 13 2018 Fedora Release Engineering - 0.9-0.3.20171001git576e80f - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild * Wed Feb 07 2018 Fedora Release Engineering - 0.9-0.2.20171001git576e80f - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild * Wed Oct 04 2017 Tom Stellard - 0.9-0.1.20171001git576e80f - Update to git snapshot that works with LLVM 5 * Wed Aug 02 2017 Dave Johansen - 0.8-4 - Official 0.8/LLVM 4.0 release * Wed Aug 02 2017 Fedora Release Engineering - 0.8-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild * Wed Jul 26 2017 Fedora Release Engineering - 0.8-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild * Sun Jul 02 2017 Dave Johansen - 0.8-1 - Use 0.8 to work with LLVM 4.0 * Thu Mar 30 2017 Tom Stellard - 0.7-3.20130330git.23253ec - Update to git snapshot that works with LLVM4 * Fri Feb 10 2017 Fedora Release Engineering - 0.7-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild * Mon Dec 05 2016 Dave Johansen - 0.7-1 - Upstream release * Thu May 12 2016 Dave Johansen - 0.6-1 - Upstream release * Wed Feb 24 2016 Dave Johansen - 0.6-0.2 - Remove use of rand() in badinc test * Wed Feb 24 2016 Dave Johansen - 0.6-0.1 - Test build against 3.8 * Thu Feb 04 2016 Dave Johansen - 0.5-3 - Changes for new llvm cmake build system * Thu Feb 04 2016 Fedora Release Engineering - 0.5-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild * Wed Sep 30 2015 Dave Johansen - 0.5-1 - Upstream release * Wed Jun 17 2015 Fedora Release Engineering - 0.4-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Thu Jun 04 2015 Dave Johansen - 0.4-2 - Added iwyu_tool * Mon Jun 01 2015 Dave Johansen - 0.4-1 - Update to 0.4 based on clang 3.6.0 * Tue Jan 27 2015 Dave Johansen - 0.3-1 - Update to 0.3 based on clang 3.5.0 * Fri Apr 25 2014 Dave Johansen - 0.2-1 - Initial RPM release