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

Group:      Development/Tools
License:    GPLv3+
URL:        https://github.com/kdudka/%{name}
Source0:    https://github.com/kdudka/%{name}/releases/download/%{name}-%{version}/%{name}-%{version}.tar.xz

BuildRequires: asciidoc
BuildRequires: cmake

# The test-suite runs automatically trough valgrind if valgrind is available
# on the system.  By not installing valgrind into mock's chroot, we disable
# this feature for production builds on architectures where valgrind is known
# to be less reliable, in order to avoid unnecessary build failures (see RHBZ
# #810992, #816175, and #886891).  Nevertheless developers are free to install
# valgrind manually to improve test coverage on any architecture.
%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.

%package -n csmatch
Summary: A compiler wrapper that runs smatch in background
Requires: clang

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

%prep
%setup -q

%build
mkdir cscppc_build
cd cscppc_build
export CFLAGS="$RPM_OPT_FLAGS"
CFLAGS="$CFLAGS"' -DPATH_TO_CSCPPC=\"%{_libdir}/cscppc\"'
CFLAGS="$CFLAGS"' -DPATH_TO_CSCLNG=\"%{_libdir}/csclng\"'
CFLAGS="$CFLAGS"' -DPATH_TO_CSMATCH=\"%{_libdir}/csmatch\"'
%ifnarch aarch64
export LDFLAGS="$RPM_OPT_FLAGS -static -pthread"
%endif
%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}"{,/cs{cppc,clng,match}}

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"
    ln -s ../../bin/csmatch "$RPM_BUILD_ROOT%{_libdir}/csmatch/$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

%files -n csmatch
%{_bindir}/csmatch
%{_libdir}/csmatch
%doc COPYING

%changelog
* Wed Feb 05 2020 Kamil Dudka <kdudka@redhat.com> 1.6.0-1
- update to latest upstream release

* Thu Oct 18 2018 Kamil Dudka <kdudka@redhat.com> 1.5.0-1
- update to latest upstream release

* Mon Jan 15 2018 Kamil Dudka <kdudka@redhat.com> 1.3.4-1
- update to latest upstream release

* Thu Jul 20 2017 Kamil Dudka <kdudka@redhat.com> 1.3.3-1
- update to latest upstream release

* Wed Feb 15 2017 Kamil Dudka <kdudka@redhat.com> 1.3.2-1
- update to latest upstream release
- update project URL and source URL

* Fri Nov 27 2015 Kamil Dudka <kdudka@redhat.com> 1.3.1-1
- update to latest upstream

* Fri Aug 28 2015 Kamil Dudka <kdudka@redhat.com> 1.3.0-1
- update to latest upstream

* 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