%global _hardened_build 1
%global commit c42e68bb999d01da9ec71b67ff1a2cbd6ec1b6a6
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global commitdate 20130509
%global gitversion .%{commitdate}git%{shortcommit}
%global oldname UnitTest++
Name: unittest-cpp
# 1.4 is the last version of the old sf.net project.
Version: 1.4
# so we're postrelease.
Release: 11%{gitversion}%{?dist}
Summary: Lightweight unit testing framework for C++
License: MIT
Group: Development/Libraries
# old Url: http://sf.net/projects/unittest-cpp
URL: https://github.com/%{name}/%{name}
Source0: https://github.com/%{name}/%{name}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz
# unittest-cpp.pc file courtesy of Luke Benstead
Source1: %{name}.pc
# documentation from 1.4 tarball: docs/UnitTest++.html
Source2: %{name}.html
BuildRequires: autoconf
BuildRequires: libtool
%description
%{name} is a lightweight unit testing framework for C++.
Simplicity, portability, speed, and small footprint are all
very important aspects of %{name}.
%package devel
Summary: Object files for development using %{name}
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The %{name}-devel package contains the object files
necessary for developing test programs.
%package static
Summary: Static library for %{name}
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description static
The %{name}-static package contains the object files
necessary for statically linking test programs.
%prep
%setup -q -n %{name}-%{commit}
cp -p %SOURCE1 %SOURCE2 .
# autoreconf will complain about missing NEWS and README files
touch NEWS
ln README.md README
# autoreconf will add a GPLv3 license text in COPYING
ln LICENSE COPYING
autoreconf -i
%build
%configure
# rpmlint unused-direct-shlib-dependency
sed -i -e 's! -shared ! -Wl,--as-needed\0!g' libtool
# fill out our .pc template
sed -i -e "
s,^prefix=,prefix=%{_prefix},g
s,^exec_prefix=,exec_prefix=%{_exec_prefix},g
s,^libdir=,libdir=%{_libdir},g
s,^includedir=,includedir=%{_includedir},g
" %{name}.pc
make %{?_smp_mflags}
%check
make check
%install
mkdir -p %{buildroot}%{_includedir}/%{name}
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_datadir}/pkgconfig
make DESTDIR=%{buildroot} install
install -p -m 644 %{name}.pc %{buildroot}%{_datadir}/pkgconfig/
rm -f %{buildroot}%{_libdir}/lib%{oldname}.la
%files
%doc AUTHORS LICENSE README.md
%{_libdir}/lib%{oldname}.so.*
%files devel
%doc %{name}.html
%{_includedir}/%{oldname}
%{_libdir}/lib%{oldname}.so
%{_datadir}/pkgconfig/%{name}.pc
%files static
%{_libdir}/lib%{oldname}.a
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4-11.20130509gitc42e68b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Thu Jun 06 2013 François Cami <fcami@fedoraproject.org> - 1.4-10.20130509gitc42e68b
- Make -static depend on -devel. Suggested by Michael Schwendt.
* Fri May 31 2013 François Cami <fcami@fedoraproject.org> - 1.4-9.20130509gitc42e68b
- Use github directly for git tarball generation.
- Move autoreconf to %%build.
- Add %%check.
- Removed duplicate files.
- All changes suggested by Björn Esser.
* Thu May 30 2013 François Cami <fcami@fedoraproject.org> - 1.4-8.20130509gitc42e68bb
- Switch upstream from http://sf.net/projects/unittest-cpp
to https://github.com/unittest-cpp/unittest-cpp
- Rebase sources to c42e68bb999d01da9ec71b67ff1a2cbd6ec1b6a6
- Use consistent naming as much as possible.
- Use autotools to build both shared and static libraries.
- Most changes suggested by Michael Schwendt.
* Wed Mar 13 2013 François Cami <fcami@fedoraproject.org> - 1.4-7
- Fix linker flags breakage.
* Tue Mar 12 2013 François Cami <fcami@fedoraproject.org> - 1.4-6
- Replace %%define with %%global.
* Wed Mar 6 2013 François Cami <fcami@fedoraproject.org> - 1.4-5
- Remove unneeded space in sed expression.
* Wed Mar 6 2013 François Cami <fcami@fedoraproject.org> - 1.4-4
- Use consistent naming in .pc file (fix by Luke Benstead).
* Wed Feb 27 2013 François Cami <fcami@fedoraproject.org> - 1.4-3
- Use multi-line, single-instance sed, courtesy of Dennis Johnson.
* Sat Feb 23 2013 François Cami <fcami@fedoraproject.org> - 1.4-2
- Change package name. Add .pc file courtesy of Luke Benstead.
* Sat Feb 02 2013 François Cami <fcami@fedoraproject.org> - 1.4-1
- Initial Fedora RPM.