Name:           gtest
Version:        1.8.0
Release:        1%{?dist}
Summary:        Google C++ test framework

License:        BSD
URL:            https://github.com/google/googletest
Source0:        https://github.com/google/googletest/archive/release-%{version}.tar.gz
# Install into lib64 if needed
Patch0:         googletest-libdir.patch
# https://github.com/google/googletest/issues/845
Patch1:         gtest-null-pointer.patch

BuildRequires:  cmake
BuildRequires:  python-devel

%description
Framework for writing C++ tests on a variety of platforms (GNU/Linux,
Mac OS X, Windows, Windows CE, and Symbian). Based on the xUnit
architecture. Supports automatic test discovery, a rich set of
assertions, user-defined assertions, death tests, fatal and non-fatal
failures, various options for running the tests, and XML test report
generation.

%package     -n gtest-devel
Summary:        Development files for %{name}
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description -n gtest-devel
This package contains development files for %{name}.


%package     -n gmock
Summary:        Google C++ Mocking Framework

%description  -n gmock
Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
specifics in mind, Google C++ Mocking Framework (or Google Mock for
short) is a library for writing and using C++ mock classes.

Google Mock:

 o lets you create mock classes trivially using simple macros,
 o supports a rich set of matchers and actions,
 o handles unordered, partially ordered, or completely ordered
   expectations,
 o is extensible by users, and
 o works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
   Symbian.

%package     -n gmock-devel
Summary:        Development files for gmock
Group:          System Environment/Libraries
Requires:       gmock = %{version}-%{release}

%description  -n gmock-devel
This package contains development files for gmock.


%prep
%autosetup -p1 -n googletest-release-%{version}

%build
mkdir build && cd build
%cmake -DBUILD_SHARED_LIBS=ON \
       -DPYTHON_EXECUTABLE=%{__python2} \
       -Dgtest_build_tests=ON ..
make %{?_smp_mflags}


%install
cd build
%make_install

/sbin/ldconfig -n %{buildroot}%{_libdir}


%check
cd build
make test

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%doc googletest/{CHANGES,CONTRIBUTORS,README.md}
%doc googletest/docs/
%license googletest/LICENSE
%{_libdir}/libgtest.so
%{_libdir}/libgtest_main.so

%files -n gtest-devel
%doc googletest/samples
%{_includedir}/gtest/

%files -n gmock
%license googlemock/LICENSE
%doc googlemock/{CHANGES,CONTRIBUTORS,README.md}
%doc googlemock/docs/
%{_libdir}/libgmock.so
%{_libdir}/libgmock_main.so

%files -n gmock-devel
%{_includedir}/gmock/


%changelog