public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* Optimize script for generating LinuxManBook.pdf
@ 2023-11-22 14:58 Alejandro Colomar
  2023-11-22 17:33 ` Deri
  2023-11-23 18:41 ` Deri
  0 siblings, 2 replies; 10+ messages in thread
From: Alejandro Colomar @ 2023-11-22 14:58 UTC (permalink / raw)
  To: Deri James, linux-man; +Cc: groff

[-- Attachment #1: Type: text/plain, Size: 1304 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-12-01  0:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-22 14:58 Optimize script for generating LinuxManBook.pdf Alejandro Colomar
2023-11-22 17:33 ` Deri
2023-11-22 17:39   ` Alejandro Colomar
2023-11-23 18:41 ` Deri
2023-11-23 22:12   ` Alejandro Colomar
2023-11-24 11:46     ` Alejandro Colomar
2023-11-30 16:56       ` Deri
2023-11-30 22:38         ` Alejandro Colomar
2023-12-01  0:14           ` Alejandro Colomar
2023-12-01  0:37             ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox