A new user interface for you! Read more...

File kernel-docs.spec of Package kernel-source

#
# spec file for package kernel-docs
#
# Copyright (c) 2017 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/
#


%define patchversion 4.12.7
%define variant %{nil}

%include %_sourcedir/kernel-spec-macros

# rst2pdf is broken with Sphinx 1.3.x, so disabled for now
%define build_pdf 0

# copy the whole tree to generate some images (sigh...)
%define local_copy 1
%if %local_copy
%define linux_src .
%else
%define linux_src /usr/src/linux%variant
%define make_arg "-C %linux_src"
%endif

Name:           kernel-docs
Summary:        Kernel Documentation (man pages)
License:        GPL-2.0
Group:          Documentation/Man
Version:        4.12.7
%if 0%{?is_kotd}
Release:        <RELEASE>.ga8251af
%else
Release:        0
%endif
BuildRequires:  kernel-source%variant
# remaining stuff, to be fixed after 4.12
BuildRequires:  xmlto
# ReST handling
BuildRequires:  graphviz
BuildRequires:  python-Sphinx
%if %build_pdf
BuildRequires:  python-rst2pdf
%endif
Url:            http://www.kernel.org/
Provides:       %name = %version-%source_rel
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source:         kernel-spec-macros

%description
These are the man pages (section 9) built from the current kernel sources.

%source_timestamp

%if %build_pdf
%package pdf
Summary:        Kernel Documentation (PDF)
Group:          Documentation/Other

%description pdf
These are PDF documents built from the current kernel sources.

%source_timestamp
%endif

%package html
Summary:        Kernel Documentation (HTML)
Group:          Documentation/HTML

%description html
These are HTML documents built from the current kernel sources.

%source_timestamp

%prep
%setup -T -c
%if %local_copy
# FIXME: need to copy locally to generate some images...
cp -a /usr/src/linux%variant/* .
%endif

%build
export LANG=en_US
mkdir -p html
make %{?make_arg} O=$PWD/html htmldocs
%if %build_pdf
mkdir -p pdf
make %{?make_arg} O=$PWD/pdf pdfdocs
%endif

%install
install -d $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/rst
cp -a html/Documentation/output/* $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/rst || true

%if %build_pdf
install -d $RPM_BUILD_ROOT%{_datadir}/doc/kernel/pdf
# copy PDF files generated by sphinx (once when it really works...)
for i in pdf/Documentation/output/*.pdf; do
    test -s $i && cp -a $i $RPM_BUILD_ROOT%{_datadir}/doc/kernel/pdf
done
%endif

%if !%local_copy
cp -a %linux_src/{COPYING,CREDITS,MAINTAINERS,README} .
%endif

%files
%defattr(-,root,root)
%doc COPYING CREDITS MAINTAINERS README

%if %build_pdf
%files pdf
%defattr(-,root,root)
%dir %{_datadir}/doc/kernel
%docdir %{_datadir}/doc/kernel/pdf
%{_datadir}/doc/kernel/pdf
%endif

%files html
%defattr(-,root,root)
%dir %{_datadir}/doc/kernel
%docdir %{_datadir}/doc/kernel/html
%{_datadir}/doc/kernel/html

%changelog