Blob Blame History Raw
Name:       cscppc
Version:    1.2.0
Release:    2%{?dist}
Summary:    A compiler wrapper that runs cppcheck in background

Group:      Development/Tools
License:    GPLv3+
URL:        https://git.fedorahosted.org/cgit/%{name}.git
Source0:    https://git.fedorahosted.org/cgit/%{name}.git/snapshot/%{name}-%{version}.tar.xz

BuildRequires: asciidoc
BuildRequires: cmake

%ifarch %{ix86} x86_64
BuildRequires: valgrind
%endif

# csmock copies the resulting cscppc binary into mock chroot, which may contain
# an older (e.g. RHEL-5) version of glibc, and it would not dynamically link
# against the old version of glibc if it was built against a newer one.
# Therefor we link glibc statically.
%if (0%{?fedora} >= 12 || 0%{?rhel} >= 6)
BuildRequires: glibc-static
%endif

# the --include option was introduced in 1.58
Requires: cppcheck >= 1.58

%description
This package contains the cscppc compiler wrapper that runs cppcheck in
background fully transparently.

%package -n csclng
Summary: A compiler wrapper that runs Clang in background
Requires: clang
Conflicts: csmock-plugin-clang < 1.5.0

%description -n csclng
This package contains the csclng compiler wrapper that runs the Clang analyzer
in background fully transparently.

%prep
%setup -q

%build
mkdir cscppc_build
cd cscppc_build
export CFLAGS="$RPM_OPT_FLAGS"' -DPATH_TO_CSCPPC=\"%{_libdir}/cscppc\" -DPATH_TO_CSCLNG=\"%{_libdir}/csclng\"'
export LDFLAGS="$RPM_OPT_FLAGS -static -pthread"
%cmake ..
make %{?_smp_mflags} VERBOSE=yes

%check
cd cscppc_build
ctest %{?_smp_mflags} --output-on-failure

%install
cd cscppc_build
make install DESTDIR="$RPM_BUILD_ROOT"

install -m0755 -d "$RPM_BUILD_ROOT%{_libdir}"{,/cscppc,/csclng}

for i in cc gcc %{_arch}-redhat-linux-gcc
do
    ln -s ../../bin/cscppc "$RPM_BUILD_ROOT%{_libdir}/cscppc/$i"
    ln -s ../../bin/csclng "$RPM_BUILD_ROOT%{_libdir}/csclng/$i"
done

for i in c++ g++ %{_arch}-redhat-linux-c++ %{_arch}-redhat-linux-g++
do
    ln -s ../../bin/cscppc   "$RPM_BUILD_ROOT%{_libdir}/cscppc/$i"
    ln -s ../../bin/csclng++ "$RPM_BUILD_ROOT%{_libdir}/csclng/$i"
done

%files
%{_bindir}/cscppc
%{_datadir}/cscppc
%{_datadir}/cscppc/default.supp
%{_libdir}/cscppc
%{_mandir}/man1/%{name}.1*
%doc COPYING README

%files -n csclng
%{_bindir}/csclng
%{_bindir}/csclng++
%{_libdir}/csclng
%{_mandir}/man1/csclng.1*
%doc COPYING README

%changelog
* Wed Jan 28 2015 Kamil Dudka <kdudka@redhat.com> 1.2.0-2
- add missing dependency of csclng on clang

* Fri Nov 07 2014 Kamil Dudka <kdudka@redhat.com> 1.2.0-1
- update to latest upstream

* Wed Sep 03 2014 Kamil Dudka <kdudka@redhat.com> 1.1.0-1
- update to latest upstream (introduces the csclng subpackage)

* Thu Jul 17 2014 Kamil Dudka <kdudka@redhat.com> 1.0.4-1
- update to latest upstream

* Thu Mar 27 2014 Kamil Dudka <kdudka@redhat.com> 1.0.3-1
- update to latest upstream

* Mon Mar 10 2014 Kamil Dudka <kdudka@redhat.com> 1.0.2-2
- abandon RHEL-5 compatibility (#1066026)

* Wed Feb 19 2014 Kamil Dudka <kdudka@redhat.com> 1.0.2-1
- packaged for Fedora