summaryrefslogtreecommitdiffstats
path: root/share/mk/build/pdf/book
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--share/mk/build/pdf/book/_.mk51
-rw-r--r--share/mk/build/pdf/book/front.roff (renamed from scripts/LinuxManBook/LMBfront.roff)0
-rwxr-xr-xshare/mk/build/pdf/book/prepare.pl (renamed from scripts/LinuxManBook/prepare.pl)12
3 files changed, 59 insertions, 4 deletions
diff --git a/share/mk/build/pdf/book/_.mk b/share/mk/build/pdf/book/_.mk
new file mode 100644
index 0000000..03595f6
--- /dev/null
+++ b/share/mk/build/pdf/book/_.mk
@@ -0,0 +1,51 @@
+# Copyright 2023-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_BUILD_PDF_BOOK_INCLUDED
+MAKEFILE_BUILD_PDF_BOOK_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/_.mk
+include $(MAKEFILEDIR)/build/man/_.mk
+include $(MAKEFILEDIR)/build/fonts/_.mk
+include $(MAKEFILEDIR)/build/fonts/tinos/_.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils/cat.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff/gropdf.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/eqn.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/pic.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/preconv.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/tbl.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/troff.mk
+include $(MAKEFILEDIR)/configure/build-depends/moreutils/sponge.mk
+include $(MAKEFILEDIR)/configure/version.mk
+
+
+MKBOOKDIR := $(MAKEFILEDIR)/build/pdf/book
+MKBOOK := $(wildcard $(MKBOOKDIR)/*)
+
+
+PDF_BOOK := $(DISTNAME).pdf
+_PDFDIR := $(builddir)
+_PDF_BOOK := $(_PDFDIR)/$(PDF_BOOK)
+
+
+$(_PDF_BOOK): $(_MANPAGES) $(_DOWNLOAD) $(_TINOS) $(MKBOOK) $(MK) | $$(@D)/
+ $(info $(INFO_)GROPDF $@)
+ $(MKBOOKDIR)/prepare.pl $(_MANDIR) \
+ | $(CAT) $(MKBOOKDIR)/front.roff /dev/stdin \
+ | $(PRECONV) \
+ | $(PIC) \
+ | $(TBL) \
+ | $(EQN) -Tpdf \
+ | $(TROFF) -mandoc -Tpdf -F$(_FONTSDIR) -dpaper=a4 -rC1 \
+ -ran*bookmark-base-level=1 $(TROFFFLAGS) \
+ | $(GROPDF) -F$(_FONTSDIR) -pa4 $(GROPDFFLAGS) \
+ | $(SPONGE) $@
+
+
+.PHONY: build-pdf-book
+build-pdf-book: $(_PDF_BOOK);
+
+
+endif # include guard
diff --git a/scripts/LinuxManBook/LMBfront.roff b/share/mk/build/pdf/book/front.roff
index fdf1a98..fdf1a98 100644
--- a/scripts/LinuxManBook/LMBfront.roff
+++ b/share/mk/build/pdf/book/front.roff
diff --git a/scripts/LinuxManBook/prepare.pl b/share/mk/build/pdf/book/prepare.pl
index 735cfcf..a074082 100755
--- a/scripts/LinuxManBook/prepare.pl
+++ b/share/mk/build/pdf/book/prepare.pl
@@ -49,9 +49,10 @@ my $dir2=$dir;
$dir2=~tr[.][_];
my %files;
my %aliases;
-my %target;
-foreach my $al (`grep -E '^\\.so' $dir/man*/*`)
+foreach my $al (`find "$dir"/man*/ -type f \\
+ | grep "\\.[[:digit:]]\\([[:alpha:]][[:alnum:]]*\\)\\?\\>\$" \\
+ | xargs grep '^\\.so' /dev/null;`)
{
#$al=~tr[.][_];
$al=~m/^$dir\/man\d[a-z]*\/(.*):\.\s*so\s*man\d[a-z]*\/(.*)/o;
@@ -66,8 +67,11 @@ while (my ($k,$v)=each %aliases)
}
}
-foreach my $fn (glob "$dir/man*/*")
+foreach my $fn (`find "$dir"/man*/ -type f \\
+ | grep "\\.[[:digit:]]\\([[:alpha:]][[:alnum:]]*\\)\\?\\>\$";`)
{
+ $fn=~s/\n//;
+
my ($nm,$sec)=GetNmSec($fn,qr/\.\d[a-z]*/);
$files{"${nm}.$sec"}=[$fn,(exists($aliases{"${nm}.$sec"}))?$aliases{"${nm}.$sec"}:"${nm}.$sec"];
}
@@ -78,7 +82,7 @@ BuildBook();
sub BuildBook
{
- print ".pdfpagenumbering D . 1\n.nr PDFOUTLINE.FOLDLEVEL 0\n.defcolor pdf:href.colour rgb 0.00 0.25 0.75\n.pdfinfo /Title \"The Linux man-pages Book\"\n.special TINOR S\n";
+ print ".pdfpagenumbering D . 1\n.nr PDFOUTLINE.FOLDLEVEL 0\n.defcolor pdf:href.colour rgb 0.00 0.25 0.75\n.pdfinfo /Title \"The Linux man-pages Book\"\n.special TinosR S\n";
foreach my $bkmark (sort sortman keys %files) {
BuildPage($bkmark);