Summary:	Google C++ testing framework
Summary(ja):	Google C++ テスティングフレームワーク
Name:		gtest
Version:	1.8.1
Release:	1%{?_dist_release}
License:	New BSD
Group:		Development/Tools
URL:		https://github.com/google/googletest

Vendor:		Project Vine
Distribution:	Vine Linux

Source0:	https://github.com/google/googletest/archive/release-%{version}.tar.gz

# https://github.com/google/googletest/pull/967
Patch0:         gtest-1.8.1-null-pointer.patch
# https://github.com/google/googletest/pull/1839
Patch1:         gtest-PR1839-Fix-Python3-support.patch
# Fedora-specific patches
## Set libversion for libraries to version of gtest
Patch100:       gtest-1.8.1-libversion.patch
## Add missing pkgconfig requires information to reflect reality
Patch101:       gtest-1.8.1-add-missing-pkgconfig-requires.patch
BuildRoot:	%{_tmppath}/%{name}-%{version}-root

BuildRequires:  cmake
BuildRequires:  python3-devel
BuildRequires:  python3-rpm-macros

%description
Google's 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 devel
Summary:	Development files for %{name}
Summary(ja):	%{name} の開発ファイル
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}

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


%package     -n gmock
Summary:        Google C++ Mocking Framework
Group:          Development/Tools
Requires:       %{name} = %{version}-%{release}

%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:          Development/Libraries
Requires:       gmock = %{version}-%{release}

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


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

# Set the version correctly
sed -e "s/set(GOOGLETEST_VERSION .*)/set(GOOGLETEST_VERSION %{version})/" -i CMakeLists.txt


%build
mkdir build && cd build
%cmake -DBUILD_SHARED_LIBS=ON \
       -DPYTHON_EXECUTABLE=%{__python3} \
       -Dgtest_build_tests=ON ..
%make_build


%install
cd build
%make_install


%check
cd build
make test


%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post -n gmock -p /sbin/ldconfig

%postun -n gmock -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%license googletest/LICENSE
%{_libdir}/libgtest.so.%{version}
%{_libdir}/libgtest_main.so.%{version}

%files devel
%defattr(-,root,root,-)
%doc googletest/{CHANGES,CONTRIBUTORS,README.md}
%doc googletest/docs/
%doc googletest/samples
%{_includedir}/gtest/
%{_libdir}/libgtest.so
%{_libdir}/libgtest_main.so
%{_libdir}/cmake/GTest/
%{_libdir}/pkgconfig/gtest.pc
%{_libdir}/pkgconfig/gtest_main.pc

%files -n gmock
%license googlemock/LICENSE
%{_libdir}/libgmock.so.%{version}
%{_libdir}/libgmock_main.so.%{version}

%files -n gmock-devel
%doc googlemock/{CHANGES,CONTRIBUTORS,README.md}
%doc googlemock/docs/
%{_includedir}/gmock/
%{_libdir}/libgmock.so
%{_libdir}/libgmock_main.so
%{_libdir}/pkgconfig/gmock.pc
%{_libdir}/pkgconfig/gmock_main.pc


%changelog
* Wed Sep 11 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.8.1-1
- new upstream release.
- dropped Patch0.
- imported patches from rawhide.

* Sat Jul  2 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.7.0-2
- rebuilt with new toolchain.

* Tue Jul 01 2014 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.7.0-1
- new upstream release

* Sun Apr 29 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.6.0-1
- new upstream release
- changed source archive type to xz
- added Patch0 from Mandriva

* Wed Sep 29 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.5.0-2
- rebuilt with rpm-4.8.1 for pkg-config

* Sun May 23 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.5.0-1
- initial build for VineSeed

* Sat Nov 14 2009 Debarshi Ray <rishi@fedoraproject.org> - 1.4.0-1
- Version bump to 1.4.0.
  * New feature: the event listener API.
  * New feature: test shuffling.
  * New feature: the XML report format is closer to junitreport and can
    be parsed by Hudson now.
  * New feature: elapsed time for the tests is printed by default.
  * New feature: comes with a TR1 tuple implementation such that Boost
    is no longer needed for Combine().
  * New feature: EXPECT_DEATH_IF_SUPPORTED macro and friends.
  * New feature: the Xcode project can now produce static gtest libraries in
    addition to a framework.
  * Compatibility fixes for gcc and minGW.
  * Bug fixes and implementation clean-ups.

* Fri Jul 24 2009 Release Engineering <rel-eng@fedoraproject.org> - 1.3.0-2.20090601svn257
- Autorebuild for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Mon Jun 01 2009 Tom "spot" Callaway <tcallawa@redhat.com> - 1.3.0-1
- Version bump to 1.3.0.
  * New feature: ability to use Google Test assertions in other testing
    frameworks.
  * New feature: ability to run disabled test via
    --gtest_also_run_disabled_tests.
  * New feature: the --help flag for printing the usage.
  * New feature: access to Google Test flag values in user code.
  * New feature: a script that packs Google Test into one .h and one .cc file
    for easy deployment.
  * New feature: support for distributing test functions to multiple machines
    (requires support from the test runner).
  * Bug fixes and implementation clean-ups.

* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sat Jul 05 2008 Debarshi Ray <rishi@fedoraproject.org> - 1.0.0-1
- Initial build.
