File gflags.spec of Package gflags

#
# spec file for package gflags
#
# Copyright (c) 2016 SUSE LINUX 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/
#


Name:           gflags
Version:        2.2.0
Release:        0
Summary:        Library for commandline flag processing
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Url:            https://github.com/gflags/gflags
Source0:        https://github.com/%{name}/%{name}/archive/v%{version}.tar.gz
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  pkg-config
Requires:       libgflags2 = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The gflags package contains a library that implements commandline
flags processing. As such it's a replacement for getopt(). It has
increased flexibility, including built-in support for C++ types like
string, and the ability to define flags in the source file in which
they're used.

%package -n libgflags2
Summary:        Library for commandline flag processing

%description -n libgflags2
The gflags package contains a library that implements commandline
flags processing. As such it's a replacement for getopt(). It has
increased flexibility, including built-in support for C++ types like
string, and the ability to define flags in the source file in which
they're used.

%package devel
Summary:        Include Files and Libraries mandatory for Development
Requires:       libgflags2 = %{version}

%description devel
This package contains all necessary include files and libraries needed
to develop applications that require the provided includes and
libraries.

%package devel-static
Summary:        Include Files and Libraries mandatory for Development
Requires:       %{name}-devel = %{version}

%description devel-static
This package contains all necessary include files and libraries needed
to develop applications that require the provided includes and
libraries.

%prep
%setup -q

%build
CFLAGS="%{optflags} -pthread"
CXXFLAGS="%{optflags} -pthread"
export CFLAGS CXXFLAGS

%cmake \
	-DBUILD_STATIC_LIBS:BOOL=ON \
	-DBUILD_TESTING:BOOL=ON \
	-DCMAKE_BUILD_TYPE=Release

make %{?_smp_mflags} VERBOSE=1

%install
%cmake_install

rm -rf %{buildroot}/home/

%check
cd build
export LD_LIBRARY_PATH=`pwd`/lib
ctest

%post -n libgflags2 -p /sbin/ldconfig

%postun -n libgflags2 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS.txt COPYING.txt ChangeLog.txt README.md
%{_bindir}/%{name}_completions.sh

%files -n libgflags2
%defattr(-,root,root)
%doc COPYING.txt
%{_libdir}/libgflags.so.*
%{_libdir}/libgflags_nothreads.so.*

%files devel
%defattr(-,root,root)
%{_includedir}/%{name}/
%{_libdir}/libgflags.so
%{_libdir}/libgflags_nothreads.so
%{_libdir}/cmake/%{name}/
%{_libdir}/pkgconfig/%{name}.pc

%files devel-static
%defattr(-,root,root)
%{_libdir}/libgflags.a
%{_libdir}/libgflags_nothreads.a

%changelog
openSUSE Build Service is sponsored by