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 docbook-4.5-dtd
tidy 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 The installation instructions for all these packages are available
in the BLFS book from one of the mirrors found at in the BLFS book from one of the mirrors found at
https://www.linuxfromscratch.org/blfs. https://www.linuxfromscratch.org/blfs.

106
Makefile
View File

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

View File

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

View File

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