Changed blfs mentions in Makefile to GLFS, changed filenames to follow suite, added pdf build option, and edited INSTALL to let users know pdf build option exists

This commit is contained in:
Zeckmathederg 2024-04-28 21:29:39 -06:00
parent fee3f83507
commit 746566a9f1
7 changed files with 102 additions and 43 deletions

View File

@ -10,6 +10,10 @@ docbook-xsl-nons-1.79.2
docbook-4.5-dtd
tidy
Furthermore, you can also generate a PDF file, but need an extra package:
fop (depends on apache-ant which depends on a JDK)
The installation instructions for all these packages are available
in the BLFS book from one of the mirrors found at
https://www.linuxfromscratch.org/blfs.

106
Makefile
View File

@ -1,5 +1,5 @@
# vim:ts=3
# Makefile for BLFS Book generation.
# Makefile for GLFS Book generation.
# By Tushar Teredesai <tushar@linuxfromscratch.org>
# 2004-01-31
@ -32,18 +32,20 @@ endif
ifeq ($(REV), sysv)
BASEDIR ?= $(HOME)/public_html/glfs
PDF_OUTPUT ?= glfs.pdf
NOCHUNKS_OUTPUT ?= glfs.html
DUMPDIR ?= ~/glfs-commands
BLFSHTML ?= glfs-html.xml
BLFSHTML2 ?= glfs-html2.xml
BLFSFULL ?= glfs-full.xml
GLFSHTML ?= glfs-html.xml
GLFSHTML2 ?= glfs-html2.xml
GLFSFULL ?= glfs-full.xml
else
BASEDIR ?= $(HOME)/public_html/glfs-systemd
PDF_OUTPUT ?= glfs-sysd.pdf
NOCHUNKS_OUTPUT ?= glfs-sysd.html
DUMPDIR ?= ~/glfs-sysd-commands
BLFSHTML ?= glfs-systemd-html.xml
BLFSHTML2 ?= glfs-systemd-html2.xml
BLFSFULL ?= glfs-systemd-full.xml
GLFSHTML ?= glfs-systemd-html.xml
GLFSHTML2 ?= glfs-systemd-html2.xml
GLFSFULL ?= glfs-systemd-full.xml
endif
@ -77,6 +79,8 @@ help:
@echo ""
@echo " html Builds the HTML pages of the book."
@echo ""
@echo " pdf Builds the book as a PDF file."
@echo ""
@echo " wget-list Produces a list of all packages to download."
@echo " Output is BASEDIR/wget-list"
@echo ""
@ -99,14 +103,14 @@ all: glfs nochunks
world: all glfs-patch-list dump-commands test-links
html: $(BASEDIR)/index.html
$(BASEDIR)/index.html: $(RENDERTMP)/$(BLFSHTML) version
$(BASEDIR)/index.html: $(RENDERTMP)/$(GLFSHTML) version
@echo "Generating chunked XHTML files..."
$(Q)xsltproc --nonet \
--stringparam chunk.quietly $(CHUNK_QUIET) \
--stringparam rootid "$(ROOT_ID)" \
--stringparam base.dir $(BASEDIR)/ \
stylesheets/blfs-chunked.xsl \
$(RENDERTMP)/$(BLFSHTML)
stylesheets/glfs-chunked.xsl \
$(RENDERTMP)/$(GLFSHTML)
@echo "Copying CSS code and images..."
$(Q)if [ ! -e $(BASEDIR)/stylesheets ]; then \
@ -132,14 +136,44 @@ $(BASEDIR)/index.html: $(RENDERTMP)/$(BLFSHTML) version
sed -i -e "1,20s@text/html@application/xhtml+xml@g" $$filename; \
done;
pdf: validate
@echo "Generating profiled XML for PDF..."
$(Q)xsltproc --nonet \
--stringparam profile.condition pdf \
--output $(RENDERTMP)/glfs-pdf.xml \
stylesheets/lfs-xsl/profile.xsl \
$(RENDERTMP)/glfs-full.xml
@echo "Generating FO file..."
$(Q)xsltproc --nonet \
--stringparam rootid "$(ROOT_ID)" \
--output $(RENDERTMP)/glfs-pdf.fo \
stylesheets/glfs-pdf.xsl \
$(RENDERTMP)/glfs-pdf.xml
$(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/glfs-pdf.fo
$(Q)bash pdf-fixups.sh $(RENDERTMP)/glfs-pdf.fo
@echo "Generating PDF file..."
$(Q)mkdir -p $(RENDERTMP)/images
$(Q)cp images/*.png $(RENDERTMP)/images
$(Q)mkdir -p $(BASEDIR)
$(Q)fop -q $(RENDERTMP)/glfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
@echo "$(BASEDIR)/$(PDF_OUTPUT) created"
@echo "fop.log created"
$(Q)rm fop.log
@echo "fop.log destroyed"
nochunks: $(BASEDIR)/$(NOCHUNKS_OUTPUT)
$(BASEDIR)/$(NOCHUNKS_OUTPUT): $(RENDERTMP)/$(BLFSHTML) version
$(BASEDIR)/$(NOCHUNKS_OUTPUT): $(RENDERTMP)/$(GLFSHTML) version
@echo "Generating non-chunked XHTML file..."
$(Q)xsltproc --nonet \
--stringparam rootid "$(ROOT_ID)" \
--output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
stylesheets/blfs-nochunks.xsl \
$(RENDERTMP)/$(BLFSHTML)
stylesheets/glfs-nochunks.xsl \
$(RENDERTMP)/$(GLFSHTML)
@echo "Running Tidy and obfuscate.sh on non-chunked XHTML..."
$(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
@ -153,16 +187,16 @@ $(RENDERTMP):
clean:
@echo "Cleaning $(RENDERTMP)"
$(Q)rm -f $(RENDERTMP)/blfs*
$(Q)rm -f $(RENDERTMP)/glfs*
validate: $(RENDERTMP)/$(BLFSFULL)
$(RENDERTMP)/$(BLFSFULL): general.ent packages.ent $(ALLXML) $(ALLXSL) version
validate: $(RENDERTMP)/$(GLFSFULL)
$(RENDERTMP)/$(GLFSFULL): general.ent packages.ent $(ALLXML) $(ALLXSL) version
$(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
@echo "Adjusting for revision $(REV)..."
$(Q)xsltproc --nonet \
--xinclude \
--output $(RENDERTMP)/$(BLFSHTML2) \
--output $(RENDERTMP)/$(GLFSHTML2) \
--stringparam profile.revision $(REV) \
stylesheets/lfs-xsl/profile.xsl \
index.xml
@ -171,48 +205,48 @@ $(RENDERTMP)/$(BLFSFULL): general.ent packages.ent $(ALLXML) $(ALLXSL) version
$(Q)xmllint --nonet \
--noent \
--postvalid \
--output $(RENDERTMP)/$(BLFSFULL) \
$(RENDERTMP)/$(BLFSHTML2)
--output $(RENDERTMP)/$(GLFSFULL) \
$(RENDERTMP)/$(GLFSHTML2)
profile-html: $(RENDERTMP)/$(BLFSHTML)
$(RENDERTMP)/$(BLFSHTML): $(RENDERTMP)/$(BLFSFULL) version
profile-html: $(RENDERTMP)/$(GLFSHTML)
$(RENDERTMP)/$(GLFSHTML): $(RENDERTMP)/$(GLFSFULL) version
@echo "Generating profiled XML for XHTML..."
$(Q)xsltproc --nonet \
--stringparam profile.condition html \
--output $(RENDERTMP)/$(BLFSHTML) \
--output $(RENDERTMP)/$(GLFSHTML) \
stylesheets/lfs-xsl/profile.xsl \
$(RENDERTMP)/$(BLFSFULL)
$(RENDERTMP)/$(GLFSFULL)
glfs-patch-list: blfs-patches.sh
glfs-patch-list: glfs-patches.sh
@echo "Generating glfs patch list..."
$(Q)awk '{if ($$1 == "copy") {sub(/.*\//, "", $$2); print $$2}}' \
blfs-patches.sh > glfs-patch-list
glfs-patches.sh > glfs-patch-list
blfs-patches.sh: $(RENDERTMP)/$(BLFSFULL) version
glfs-patches.sh: $(RENDERTMP)/$(GLFSFULL) version
@echo "Generating glfs patch script..."
$(Q)xsltproc --nonet \
--output blfs-patches.sh \
--output glfs-patches.sh \
stylesheets/patcheslist.xsl \
$(RENDERTMP)/$(BLFSFULL)
$(RENDERTMP)/$(GLFSFULL)
wget-list: $(BASEDIR)/wget-list
$(BASEDIR)/wget-list: $(RENDERTMP)/$(BLFSFULL) version
$(BASEDIR)/wget-list: $(RENDERTMP)/$(GLFSFULL) version
@echo "Generating wget list for $(REV) at $(BASEDIR)/wget-list ..."
$(Q)mkdir -p $(BASEDIR)
$(Q)xsltproc --nonet \
--output $(BASEDIR)/wget-list \
stylesheets/wget-list.xsl \
$(RENDERTMP)/$(BLFSFULL)
$(RENDERTMP)/$(GLFSFULL)
test-links: $(BASEDIR)/test-links
$(BASEDIR)/test-links: $(RENDERTMP)/$(BLFSFULL) version
$(BASEDIR)/test-links: $(RENDERTMP)/$(GLFSFULL) version
@echo "Generating test-links file..."
$(Q)mkdir -p $(BASEDIR)
$(Q)xsltproc --nonet \
--stringparam list_mode full \
--output $(BASEDIR)/test-links \
stylesheets/wget-list.xsl \
$(RENDERTMP)/$(BLFSFULL)
$(RENDERTMP)/$(GLFSFULL)
@echo "Checking URLs, first pass..."
$(Q)rm -f $(BASEDIR)/{good,bad,true_bad}_urls
@ -237,7 +271,7 @@ $(BASEDIR)/test-links: $(RENDERTMP)/$(BLFSFULL) version
bootscripts:
@VERSION=`grep "bootscripts-version " general.ent | cut -d\" -f2`; \
BOOTSCRIPTS="blfs-bootscripts-$$VERSION"; \
BOOTSCRIPTS="glfs-bootscripts-$$VERSION"; \
if [ ! -e $$BOOTSCRIPTS.tar.xz ]; then \
rm -rf $(RENDERTMP)/$$BOOTSCRIPTS; \
mkdir $(RENDERTMP)/$$BOOTSCRIPTS; \
@ -248,7 +282,7 @@ bootscripts:
systemd-units:
@VERSION=`grep "systemd-units-version " general.ent | cut -d\" -f2`; \
UNITS="blfs-systemd-units-$$VERSION"; \
UNITS="glfs-systemd-units-$$VERSION"; \
if [ ! -e $$UNITS.tar.xz ]; then \
rm -rf $(RENDERTMP)/$$UNITS; \
mkdir $(RENDERTMP)/$$UNITS; \
@ -260,11 +294,11 @@ test-options:
$(Q)xsltproc --xinclude --nonet stylesheets/test-options.xsl index.xml
dump-commands: $(DUMPDIR)
$(DUMPDIR): $(RENDERTMP)/$(BLFSFULL) version
$(DUMPDIR): $(RENDERTMP)/$(GLFSFULL) version
@echo "Dumping book commands..."
$(Q)xsltproc --output $(DUMPDIR)/ \
stylesheets/dump-commands.xsl \
$(RENDERTMP)/$(BLFSFULL)
$(RENDERTMP)/$(GLFSFULL)
$(Q)touch $(DUMPDIR)
.PHONY: glfs all world html nochunks tmpdir clean \

4
README
View File

@ -9,7 +9,9 @@ The default target builds the html in $(HOME)/public_html/glfs.
For all targets, setting the parameter REV=systemd is needed to build the
systemd version of the book.
Other Makefile targets are: nochunks, validate, and blfs-patch-list.
Other Makefile targets are: pdf, nochunks, validate, and blfs-patch-list.
pdf: builds GLFS as a PDF file.
nochunks: builds GLFS in one huge file.

19
pdf-fixups.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
if [ $# -lt 1 ] ; then
echo "This script needs the location of the fo file to update"
exit 1
fi
FILE=$1
LINE=$( grep -n "DO NOT EDIT" $FILE | cut -f1 -d: )
LINE=$(( LINE - 1 ))
# Not needed
#sed -i -e "$LINE s/monospace/&\" font-size=\"9pt/" $FILE
sed -i -e "s/monospace/&\" font-size=\"9pt/g" $FILE
# Break a block of code at the right place
sed -i -e 's@gcc --version@<fo:block page-break-before="always"></fo:block>&@' $FILE

View File

@ -7,8 +7,8 @@
<!-- LFS top-level chunk templates. -->
<xsl:import href="lfs-xsl/chunkfast.xsl"/>
<!-- The LFS book type to be processed (lfs, blfs, clfs, or hlfs) -->
<xsl:param name="book-type">blfs</xsl:param>
<!-- The LFS book type to be processed (lfs, glfs, clfs, or hlfs) -->
<xsl:param name="book-type">glfs</xsl:param>
<!-- Are sections enumerated? 1 = yes, 0 = no
Note: Activating this will increase a lot rendering time. -->

View File

@ -7,8 +7,8 @@
<!-- LFS top-level no-chunk templates. -->
<xsl:import href="lfs-xsl/nochunks.xsl"/>
<!-- The LFS book type to be processed (lfs, blfs, clfs, or hlfs) -->
<xsl:param name="book-type">blfs</xsl:param>
<!-- The LFS book type to be processed (lfs, glfs, clfs, or hlfs) -->
<xsl:param name="book-type">glfs</xsl:param>
<!-- Are sections enumerated? 1 = yes, 0 = no
Note: Activating this will increase a lot rendering time. -->

View File

@ -7,8 +7,8 @@
<!-- LFS top-level pdf templates. -->
<xsl:import href="lfs-xsl/pdf.xsl"/>
<!-- The LFS book type to be processed (lfs, blfs, clfs, or hlfs) -->
<xsl:param name="book-type">blfs</xsl:param>
<!-- The LFS book type to be processed (lfs, glfs, clfs, or hlfs) -->
<xsl:param name="book-type">glfs</xsl:param>
<!-- Are sections enumerated? 1 = yes, 0 = no
Note: Activating this will increase a lot rendering time. -->