File dwgrep.spec of Package dwgrep

#
# spec file for package dwgrep
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2015 Tony Jones <tonij@suse.com>
#
# 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/
#


%global htmldocdir %{_docdir}/dwgrep/html
Name:           dwgrep
Version:        0.3
Release:        0
Summary:        A tool for querying Dwarf (debuginfo) graphs
License:        GPL-3.0-or-later AND (GPL-2.0-or-later OR LGPL-3.0-or-later)
Group:          Development/Tools/Debuggers
URL:            http://pmachata.github.io/dwgrep/index.html
Source0:        https://github.com/pmachata/dwgrep/archive/%{version}/dwgrep-%{version}.tar.gz
Patch0:         8b58e81cb74b9f30522fa7b33e5f642f368b1e58.patch
Patch1:         find-pthreads.patch
BuildRequires:  bison
BuildRequires:  cmake
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  glibc-devel
BuildRequires:  googletest-devel
BuildRequires:  libdw-devel >= 0.160
BuildRequires:  libebl-devel >= 0.160
BuildRequires:  libelf-devel >= 0.160
BuildRequires:  python3-Sphinx

%description

Dwgrep is a tool, an associated language (called Zwerg) and a library
(libzwerg) for querying Dwarf (debuginfo) graphs.

You can think of dwgrep expressions as instructions describing a path
through a graph, with assertions about the type of nodes along the
way: that a node is of given type, that it has a given attribute,
etc. There are also means of expressing sub-conditions,
i.e. assertions that a given node is acceptable if a separate
expression matches (or does not match) a different path through the
graph.

%package -n libzwerg0_1
Summary:        Library for querying Dwarf (debuginfo) graphs
Group:          System/Libraries

%description -n libzwerg0_1

Libzwerg contains implementation of the Zwerg query engine as well as
individual words of both Core and Dwarf vocabularies.

%post -n libzwerg0_1 -p /sbin/ldconfig
%postun -n libzwerg0_1 -p /sbin/ldconfig

%package -n libzwerg-devel
Summary:        Headers and shared development libraries for libzwerg
Group:          Development/Libraries/C and C++
Requires:       elfutils-devel%{?_isa}
Requires:       libzwerg%{?_isa} = %{version}-%{release}

%description -n libzwerg-devel
Headers and shared object symbolic links for the Boost C++ libraries.

%package doc
Summary:        HTML documentation for dwgrep and libzwerg
Group:          Documentation/HTML
BuildArch:      noarch

%description doc

This package contains dwgrep-related documentation in the HTML
format. The documentation provides the same content as that on the
Boost web page (http://pmachata.github.io/dwgrep/).

%prep
%autosetup -p1 -n dwgrep-%{version}

%build
rpm -q libelf-devel
export SUSE_ASNEEDED=1
%cmake
make %{?_smp_mflags}
make doc %{?_smp_mflags}

%install
%cmake_install

# We carry HTML documentation in a separate -doc subpackage.  However,
# we would still like the documentation to be installed to
# /usr/share/dwgrep as opposed to /usr/shared/dwgrep-doc.  So install
# it here by hand, and below in %%files, have HTML be owned by the doc
# subpacke and exclude it from the main package.
mkdir -p %{buildroot}%{htmldocdir}
cp -Rp build/doc/html/* %{buildroot}%{htmldocdir}

%check
pushd build
LD_LIBRARY_PATH=`pwd`/libzwerg make test
popd

%files
%license COPYING
%doc NEWS README COPYING-LGPLV3
%exclude %{htmldocdir}
%{_bindir}/dwgrep
%{_mandir}/man1/dwgrep.1*

%files doc
# Both -doc subpackage and main package should own the documentation
# package, because both put files in there.
%dir %{_docdir}/dwgrep
%{htmldocdir}

%files -n libzwerg0_1
%license COPYING
%doc COPYING-LGPLV3
%{_libdir}/libzwerg.so.0.1

%files -n libzwerg-devel
# N.B.: COPYING* brought in by the libzwerg dependency.
%dir %{_includedir}/libzwerg
%{_includedir}/libzwerg/libzwerg.h
%{_includedir}/libzwerg/libzwerg-dw.h
%{_libdir}/libzwerg.so

%changelog
openSUSE Build Service is sponsored by