groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Optimize script for generating LinuxManBook.pdf


From: Alejandro Colomar
Subject: Optimize script for generating LinuxManBook.pdf
Date: Wed, 22 Nov 2023 15:58:56 +0100

Hi Deri,

I've optimized from 18.5 s down to 16.3 s the script, by splitting the
pipeline with this wrapper (and slightly reducing the perl script to
just print the pages to stdout).  BTW, now it can be run from any
directory.  And every step can be debugged by just introducing
| tee /dev/tty \
wherever you want to debug.  It's all pushed to master.

The PDF is now printed to stdout, to avoid hard-coding file names.

I still need to split a bit more and reduce the longest lines.  How does
this script look to you?

Cheers,
Alex :-)


$ cat scripts/LinuxManBook/build_linux_man_book.sh 
#!/bin/sh
# Copyright 2023, Alejandro Colomar <alx@kernel.org>
# SPDX-License-Identifier: GPL-3.0-or-later

(
        "$(dirname "$0")"/prepare_linux_man_book.pl "$1" \
        | groff -z -dPDF.EXPORT=1 -dLABEL.REFS=1 -dpaper=a4 -Tpdf -k -pet \
                -M"$(dirname "$0")" -mandoc -manmark \
                -F"$(dirname "$0")" -P-pa4 \-rC1 -rCHECKSTYLE=3 2>&1 \
        | LC_ALL=C grep '^\. *ds ';

        "$(dirname "$0")"/prepare_linux_man_book.pl "$1";
) \
| preconv \
| tbl \
| eqn -Tpdf \
| (
        troff -Tpdf -ms <"$(dirname "$0")"/LMBfront.ms;
        troff -Tpdf -M"$(dirname "$0")" -mandoc -manmark \
                -F"$(dirname "$0")" -dpaper=a4;
) \
| gropdf -F"$(dirname "$0")" -pa4;


-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]