[iwyu] Initial RPM release
Dave Johansen
daveisfera at fedoraproject.org
Sat Feb 14 15:02:36 UTC 2015
commit 0c758bd34eadd138bbab2eb00e1afde3ce0f5ae3
Author: Dave Johansen <davejohansen at gmail.com>
Date: Sat Feb 14 08:02:26 2015 -0700
Initial RPM release
.gitignore | 1 +
iwyu-link_dir.patch | 18 ++++++++++
iwyu.spec | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++
sources | 1 +
4 files changed, 112 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..87d35b3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/include-what-you-use-3.4.src.tar.gz
diff --git a/iwyu-link_dir.patch b/iwyu-link_dir.patch
new file mode 100644
index 0000000..4e495a4
--- /dev/null
+++ b/iwyu-link_dir.patch
@@ -0,0 +1,18 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,12 +5,11 @@
+ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
+ message(STATUS "IWYU out-of-tree configuration")
+
+- if( NOT DEFINED LLVM_PATH )
+- message(FATAL_ERROR "LLVM_PATH must be provided using -DLLVM_PATH=<path to llvm package root>")
++ if( NOT DEFINED LLVM_LIB_PATH )
++ message(FATAL_ERROR "LLVM_LIB_PATH must be provided using -DLLVM_LIB_PATH=<path to llvm package root>")
+ endif()
+
+- link_directories(${LLVM_PATH}/lib)
+- include_directories(${LLVM_PATH}/include)
++ link_directories(${LLVM_LIB_PATH})
+
+ add_definitions(
+ -D__STDC_LIMIT_MACROS
diff --git a/iwyu.spec b/iwyu.spec
new file mode 100644
index 0000000..7a02cf1
--- /dev/null
+++ b/iwyu.spec
@@ -0,0 +1,92 @@
+# The base version of clang being built against
+%global clang_base_version 3.4
+
+Name: iwyu
+Version: 0.2
+Release: 1%{?dist}
+Summary: C/C++ source files #include analyzer based on clang
+
+Group: Development/Languages
+License: NCSA
+URL: https://code.google.com/p/include-what-you-use/
+Source0: http://include-what-you-use.com/downloads/include-what-you-use-%{clang_base_version}.src.tar.gz
+
+Patch1: iwyu-link_dir.patch
+
+BuildRequires: cmake
+BuildRequires: clang-devel
+# NOTE: This should probably listed as a dependency for clang-devel but it's
+# not, so make it explicit here
+BuildRequires: llvm-devel
+# Some of the Clang libraries are only available statically and the use of the
+# static library was approved (see https://fedorahosted.org/fesco/ticket/1370 )
+BuildRequires: llvm-static
+BuildRequires: zlib-devel
+# Scripts are Python 2
+BuildRequires: python2-devel
+
+# Virtual provide the long name
+Provides: include-what-you-use = %{version}-%{release}
+Provides: include-what-you-use%{?_isa} = %{version}-%{release}
+
+# Make sure the python macro is available
+%if 0%{?rhel} && 0%{?rhel} <= 6
+%{!?__python2: %global __python2 /usr/bin/python2}
+%endif
+
+
+%description
+"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. The
+include-what-you-use tool is a program that can be built with the clang
+libraries in order to analyze #includes of source files to find
+include-what-you-use violations, and suggest fixes for them.
+
+
+%prep
+%setup -q -n include-what-you-use
+%patch1 -p1
+
+
+%build
+mkdir build
+cd build
+%cmake -DLLVM_LIB_PATH=%{_libdir}/llvm ..
+make %{?_smp_mflags}
+
+
+%install
+%make_install DESTDIR=%{buildroot} -C build
+grep -m 1 '^#!/usr/bin/python\b' fix_includes.py || exit -1
+sed -i '1 s|^#!/usr/bin/python\b|#!%{__python2}|' fix_includes.py
+install -pDm755 fix_includes.py %{buildroot}%{_bindir}/fix_includes
+cd %{buildroot}%{_bindir}
+ln -s include-what-you-use iwyu
+
+
+%check
+# Need to have the clang header's at the correct relative path (see https://code.google.com/p/include-what-you-use/issues/detail?id=100)
+%global clang_version %{clang_base_version}.2
+mkdir -p lib/clang/%{clang_version}/
+ln -s /usr/lib/clang/%{clang_version}/include lib/clang/%{clang_version}
+cd build
+PATH=$PWD:$PATH
+ln -s ../fix_includes.py
+ln -s ../fix_includes_test.py
+ln -s ../iwyu_test_util.py
+ln -s ../run_iwyu_tests.py
+ln -s ../tests
+%{__python2} run_iwyu_tests.py
+%{__python2} fix_includes_test.py
+
+
+%files
+%{_bindir}/include-what-you-use
+%{_bindir}/iwyu
+%{_bindir}/fix_includes
+
+
+%changelog
+* Fri Apr 25 2014 Dave Johansen <davejohansen at gmail.com> - 0.2-1
+- Initial RPM release
diff --git a/sources b/sources
index e69de29..9f6e7f8 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+50e4548862c4295fc971c9aa84a610e5 include-what-you-use-3.4.src.tar.gz
More information about the scm-commits
mailing list