File googletest.spec of Package googletest

#
# spec file for package googletest
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%if 0%{?sles_version}
%define build_shlib	0
%else
%define build_shlib	1
%endif

Name:           googletest
Version:        1.7.0
Release:        0
Summary:        Google C++ Testing Framework
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Url:            http://code.google.com/p/googletest/
Source0:        gtest-%{version}.zip
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  python
BuildRequires:  unzip
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Google\'s framework for writing C++ tests on a variety of platforms
(Linux, Mac OS X, Windows, Cygwin, 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, value- and type-parameterized tests,
various options for running the tests, and XML test report generation.

%package        devel
Summary:        Development files for googletest
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use googletest.

%prep
%setup -q -n gtest-%{version}

%build
mkdir build
cd build
cmake -DLIB_INSTALL_DIR=%{_libdir} ../
%if %build_shlib
cmake -DLIB_INSTALL_DIR=%{_libdir} -Dgtest_build_tests=ON -DBUILD_SHARED_LIBS=ON -Dgtest_force_shared_crt=ON ../
%endif
make %{?_smp_mflags}
cd ..

%install
install -m 755 -d %{buildroot}%{_libdir}/
%if %build_shlib
install -m 644 build/libgtest.so* %{buildroot}%{_libdir}/
install -m 644 build/libgtest_main.so* %{buildroot}%{_libdir}/
%else
install -m 644 build/libgtest.a %{buildroot}%{_libdir}/
install -m 644 build/libgtest_main.a %{buildroot}%{_libdir}/
%endif
install -m 755 -d %{buildroot}%{_includedir}/gtest/internal
install -m 644 include/gtest/*.h %{buildroot}%{_includedir}/gtest/
install -m 644 include/gtest/internal/*.h %{buildroot}%{_includedir}/gtest/internal/

%if %build_shlib
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%endif

%files
%defattr(-, root, root)
%doc README LICENSE CONTRIBUTORS CHANGES
%if %build_shlib
%{_libdir}/libgtest.so
%{_libdir}/libgtest_main.so
%endif

%files devel
%defattr(-, root, root)
%{_includedir}/gtest
%if %build_shlib
%else
%{_libdir}/libgtest*.a
%endif

%changelog
openSUSE Build Service is sponsored by