The DocBook XSL Stylesheets (No Namespace) package contains XSL stylesheets. These are useful for performing transformations on XML DocBook files.
Create the PKGBUILD for the Docbook XLS Stylesheets (No Namespace) package with the following commands:
mkdir /sources/docbook-xsl-nons
cd /sources/docbook-xsl-nons
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>
pkgname="docbook-xsl-nons"
pkgver="1.79.2"
pkgrel="1"
pkgdesc="The DocBook XSL Stylesheets (No Namespace) package contains XSL stylesheets."
arch=('any')
url="https://github.com/docbook/"
license=(custom)
install=docbook-xsl-nons.install
groups=('core')
depends=('docbook-xml'
'libxml2'
'libxslt')
source=('https://github.com/docbook/xslt10-stylesheets/releases/download/release/1.79.2/docbook-xsl-nons-1.79.2.tar.bz2'
'https://www.linuxfromscratch.org/patches/lfs/development/docbook-xsl-nons-1.79.2-stack_fix-1.patch'
'https://github.com/docbook/xslt10-stylesheets/releases/download/release/1.79.2/docbook-xsl-doc-1.79.2.tar.bz2')
md5sums=('2666d1488d6ced1551d15f31d7ed8c38'
'8457bd6ee6b06fbc6dc540e1b096f766'
'62375ca864fc198cb2b17d98209d0b8c')
noextract=("docbook-xsl-doc-${pkgver}.tar.bz2")
prepare() {
cd "${pkgname}-${pkgver}"
# Fix a problem that causes stack overflows when doing recursion
patch -Np1 -i "${srcdir}/${pkgname}-${pkgver}-stack_fix-1.patch"
# Extract the documentation
tar -xf "${srcdir}/docbook-xsl-doc-${pkgver}.tar.bz2" --strip-components=1
}
package() {
cd "${pkgname}-${pkgver}"
install -vdm755 "${pkgdir}/usr/share/xml/docbook/${pkgname}-${pkgver}"
cp -Rv VERSION assembly common eclipse epub epub3 extensions fo \
highlighting html htmlhelp images javahelp lib manpages params \
profiling roundtrip slides template tests tools webhelp website \
xhtml xhtml-1_1 xhtml5 \
"${pkgdir}/usr/share/xml/docbook/${pkgname}-${pkgver}"
ln -sfv VERSION "${pkgdir}/usr/share/xml/docbook/${pkgname}-${pkgver}/VERSION.xls"
install -vdm755 "${pkgdir}/usr/share/doc/${pkgname}-${pkgver}"
install -vm644 README \
"${pkgdir}/usr/share/doc/${pkgname}-${pkgver}/README.txt"
install -vm644 RELEASE-NOTES* NEWS* \
"${pkgdir}/usr/share/doc/${pkgname}-${pkgver}"
cp -v -R doc/* "${pkgdir}/usr/share/doc/${pkgname}-${pkgver}"
}
REALEOF
Create the docbook-xsl-nons.install script which will handle post-install, upgrade, and removal tasks:
cat > docbook-xsl-nons.install << "REALEOF"
# docbook-xsl-nons.install
_xmlcatalog() {
xmlcatalog --noout "$@" etc/xml/catalog
}
post_install() {
[[ -f etc/xml/catalog ]] || _xmlcatalog --create
local new=${1%-*}
_xmlcatalog --add "rewriteSystem" \
"https://cdn.docbook.org/release/xsl-nons/$new" \
"/usr/share/xml/docbook/xsl-stylesheets-nons-$new"
_xmlcatalog --add "rewriteURI" \
"https://cdn.docbook.org/release/xsl-nons/$new" \
"/usr/share/xml/docbook/xsl-stylesheets-nons-$new"
_xmlcatalog --add "rewriteSystem" \
"https://cdn.docbook.org/release/xsl-nons/current" \
"/usr/share/xml/docbook/xsl-stylesheets-nons-$new"
_xmlcatalog --add "rewriteURI" \
"https://cdn.docbook.org/release/xsl-nons/current" \
"/usr/share/xml/docbook/xsl-stylesheets-nons-$new"
_xmlcatalog --add "rewriteSystem" \
"http://docbook.sourceforge.net/release/xsl/current" \
"/usr/share/xml/docbook/xsl-stylesheets-nons-$new"
_xmlcatalog --add "rewriteURI" \
"http://docbook.sourceforge.net/release/xsl/current" \
"/usr/share/xml/docbook/xsl-stylesheets-nons-$new"
}
post_upgrade() {
post_remove $2
post_install $1
}
post_remove() {
local old=${1%-*}
_xmlcatalog --del /usr/share/xml/docbook/xsl-stylesheets-nons-$old
}
REALEOF
Prepare the build directory for the pacman user and build the package:
chown -R root:pacman . chmod 2775 . chmod 664 PKGBUILD su pacman -c 'makepkg -L --nodeps'
Add the newly created package to the central package repository:
cp docbook-xsl-nons-1.79.2-1-any.pkg.tar.xz \
/srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
/srv/pacman/repos/LFS/docbook-xsl-nons-1.79.2-1-any.pkg.tar.xz
Update the local cache and install the Docbook XLS Stylesheets (No Namespace) package:
pacman -Syu pacman -S docbook-xsl-nons --overwrite \* -dd --noconfirm
Finally, copy the source files into the source repository and clean up the build directory:
mkdir /srv/pacman/source/LFS/docbook-xsl-nons cp PKGBUILD /srv/pacman/source/LFS/docbook-xsl-nons cd /sources rm -rf docbook-xsl-nons
As per other cases in this variant of LFS, let the package manager handle updates to the XML catalog files.