File kernel-docs.spec of Package kernel-source.18093

#
# spec file for package kernel-docs
#
# Copyright (c) 2021 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 srcversion 4.4
%define patchversion 4.4.121
%define variant %{nil}

%include %_sourcedir/kernel-spec-macros

%define use_fop	1

%define linux_src linux-%srcversion

%(chmod +x %_sourcedir/{guards,apply-patches,check-for-config-changes,group-source-files.pl,find-provides,find-requires,split-modules,modversions,kabi.pl,mkspec,compute-PATCHVERSION.sh,arch-symbols,log.sh,try-disable-staging-driver,compress-vmlinux.sh})

Name:           kernel-docs
Summary:        Kernel Documentation (man pages)
License:        GPL-2.0
Group:          Documentation/Man
Version:        4.4.121
%if 0%{?is_kotd}
Release:        <RELEASE>.g1b4969e
%else
Release:        0
%endif
BuildRequires:  xmlto
%if %use_fop
BuildRequires:  fop
%else
BuildRequires:  docbook-toys
BuildRequires:  docbook-utils
BuildRequires:  texlive-courier
BuildRequires:  texlive-dvips
BuildRequires:  texlive-ec
BuildRequires:  texlive-helvetic
BuildRequires:  texlive-jadetex
BuildRequires:  texlive-times
%endif
Url:            http://www.kernel.org/
Provides:       %name = %version-%source_rel
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source0:        http://www.kernel.org/pub/linux/kernel/v4.x/linux-%srcversion.tar.xz
Source2:        source-post.sh
Source3:        kernel-source.rpmlintrc
Source8:        devel-pre.sh
Source9:        devel-post.sh
Source10:       preun.sh
Source11:       postun.sh
Source12:       pre.sh
Source13:       post.sh
Source14:       series.conf
Source16:       guards
Source17:       apply-patches
Source21:       config.conf
Source23:       supported.conf
Source33:       check-for-config-changes
Source35:       group-source-files.pl
Source36:       README.PATCH-POLICY.SUSE
Source37:       README.SUSE
Source38:       README.KSYMS
Source39:       config-options.changes.txt
Source40:       source-timestamp
Source44:       find-provides
Source45:       find-requires
Source46:       split-modules
Source47:       modversions
Source48:       macros.kernel-source
Source49:       kernel-module-subpackage
Source50:       kabi.pl
Source51:       mkspec
Source52:       kernel-source%variant.changes
Source53:       kernel-source.spec.in
Source54:       kernel-binary.spec.in
Source55:       kernel-syms.spec.in
Source56:       kernel-docs.spec.in
Source57:       kernel-cert-subpackage
Source58:       constraints.in
Source60:       config.sh
Source61:       compute-PATCHVERSION.sh
Source62:       old-flavors
Source63:       arch-symbols
Source64:       package-descriptions
Source65:       kernel-spec-macros
Source67:       log.sh
Source68:       host-memcpy-hack.h
Source69:       try-disable-staging-driver
Source70:       kernel-obs-build.spec.in
Source71:       kernel-obs-qa.spec.in
Source72:       compress-vmlinux.sh
Source90:       SLES-UEFI-SIGN-Certificate-2048.crt
Source100:      config.tar.bz2
Source101:      config.addon.tar.bz2
Source102:      patches.arch.tar.bz2
Source103:      patches.drivers.tar.bz2
Source104:      patches.fixes.tar.bz2
Source105:      patches.rpmify.tar.bz2
Source106:      patches.suse.tar.bz2
Source107:      patches.xen.tar.bz2
Source108:      patches.addon.tar.bz2
Source109:      patches.kernel.org.tar.bz2
Source110:      patches.apparmor.tar.bz2
Source111:      patches.rt.tar.bz2
Source112:      patches.trace.tar.bz2
Source113:      patches.kabi.tar.bz2
Source120:      kabi.tar.bz2
Source121:      sysctl.tar.bz2

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

%source_timestamp

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

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

%source_timestamp

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

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

%source_timestamp

%prep
%if !%use_fop
cp -av /etc/texmf/web2c/texmf.cnf .
cat << EOF >> texmf.cnf
main_memory.pdfjadetex = 5000000
hash_extra.pdfjadetex = 140000
max_strings.pdfjadetex = 240000
save_size.pdfjadetex = 20000
EOF
%endif
# Unpack all sources and patches
%setup -q -c -T -a 0 -a 100 -a 101 -a 102 -a 103 -a 104 -a 105 -a 106 -a 107 -a 108 -a 109 -a 110 -a 111 -a 112 -a 113 -a 120 -a 121
cd %linux_src
%_sourcedir/apply-patches %_sourcedir/series.conf ..

%build
%if !%use_fop
# use texmf.cnf from local source
export TEXMFCNF=$RPM_BUILD_DIR
%endif
export LANG=en_US
mkdir -p man
make -C %linux_src O=$PWD/man mandocs %{?jobs:-j%jobs}
mkdir -p html
make -C %linux_src O=$PWD/html htmldocs %{?jobs:-j%jobs}
mkdir -p pdf
make \
%if %use_fop
    XMLTOFLAGS="-m %linux_src/Documentation/DocBook/stylesheet.xsl --skip-validation --with-fop" \
%endif
  -C %linux_src O=$PWD/pdf pdfdocs %{?jobs:-j%jobs}

%install
install -d $RPM_BUILD_ROOT/%{_mandir}/man9
# filter out obscure device drivers - they clutter up the rpm and don't add any real value
find man/Documentation/DocBook/ -name '*.9.gz' | 
grep -E -v 'man/(sis[69]|rio|fsl|struct_rio|RIO|mpc85|set_rx_mode|mdio_(read|write)|mii_ioctl|mca_|z8530|nand|sppp|piix|(read|write)_zs)' |  
while read i ; do
	cp $i $RPM_BUILD_ROOT/%{_mandir}/man9
done
if [ -d man/Documentation/kdb ] ; then
    for i in man/Documentation/kdb/*.m* ; do
	k=`basename $i`
	k=${k/man/9}
	k=${k/mm/9}
	cp $i $RPM_BUILD_ROOT/%{_mandir}/man9/$k
    done
fi

ln -s %{_mandir}/man9/request_threaded_irq.9.gz $RPM_BUILD_ROOT%{_mandir}/man9/request_irq.9.gz

install -d $RPM_BUILD_ROOT%{_datadir}/doc/kernel/pdf
cp -a pdf/Documentation/DocBook/*.pdf $RPM_BUILD_ROOT%{_datadir}/doc/kernel/pdf || true

install -d $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html
cp -a html/Documentation/DocBook/* $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html || true
rm -f $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/*.xml
rm -f $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/*.{gif,png}
rm -f $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/*/*.proc

cp -a %linux_src/{COPYING,CREDITS,MAINTAINERS,README,REPORTING-BUGS} .

%files
%defattr(-,root,root)
%doc COPYING CREDITS MAINTAINERS README REPORTING-BUGS
%{_mandir}/man9/*

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

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

%changelog
openSUSE Build Service is sponsored by