#!/bin/sh
# Create kernel PDF docs in Documentation/output/latex
# currently using linux-5.0.16
# requires sphinx_rtd_theme, this is the version I happen to have handy
# Only small parts of this use more than 1 core at the moment.

echo "checking that sphinx_rtd_theme has been installed"
test -d /usr/lib/python3.7/site-packages/sphinx_rtd_theme-0.4.3-py3.7.egg || exit 2

cd /tmp

rm -rf linux-5.0

echo "untar 5.0"
tar -xf /sources/linux-5.0.tar.xz
cd linux-5.0
echo "patch it"
xzcat /sources/kernel/patch-5.0.16.xz | patch -p1 -s

# not sure if .config and oldconfig are essential, but do them anyway
#zcat ~/repeat-tests/config-5.0.16.gz >.config
#echo "oldconfig"
#make oldconfig

export TIMEFORMAT='%R'
time PYTHON=python3 PATH=$PATH:/opt/texlive/2019/bin/x86_64-linux make -j8 pdfdocs


