22. docbook

wget https://www.gnuwakes.org/depot/1.1/main/sources/docbook-4.5.tar.bz2

tar -xf docbook-4.5.tar.bz2

wget https://www.gnuwakes.org/depot/1.1/main/sources/docbook.patch
cd docbook-4.5
patch -p1 < ../docbook.patch 
cd ..

SOURCES_DIR=$PWD/docbook-4.5
INSTALL_DIR=$PWD/docbook-4.5-install
BUILD_DIR=$PWD/docbook-4.5-build

mkdir $INSTALL_DIR $BUILD_DIR
cd $BUILD_DIR

set -e
set -u

#
# sgml-common
#

cd $BUILD_DIR

cp -r $SOURCES_DIR/docbook-4.5/sgml-common-0.6.3 .
cd sgml-common-0.6.3

autoreconf -f -i
./configure --prefix=/usr --sysconfdir=/etc
make

make DESTDIR=$INSTALL_DIR docdir=/usr/share/doc install

# run the following and copy /etc/sgml in $INSTALL_DIR

# install-catalog --add /etc/sgml/sgml-ent.cat \
#  /usr/share/sgml/sgml-iso-entities-8879.1986/catalog

# install-catalog --add /etc/sgml/sgml-docbook.cat \
#  /etc/sgml/sgml-ent.cat

#
# docbook
#

cd $BUILD_DIR

cp -r $SOURCES_DIR/docbook-4.5/docbook-4.5 .
cd docbook-4.5

# removes the ENT definitions from the catalog file
sed -i -e '/ISO 8879/d' -e '/gml/d' docbook.cat

install -v -d $INSTALL_DIR/usr/share/sgml/docbook/sgml-dtd-4.5
chown -R root:root .

install -v docbook.cat \
  $INSTALL_DIR/usr/share/sgml/docbook/sgml-dtd-4.5/catalog
cp -v -af *.dtd *.mod *.dcl \
  $INSTALL_DIR/usr/share/sgml/docbook/sgml-dtd-4.5

cat >> $INSTALL_DIR/usr/share/sgml/docbook/sgml-dtd-4.5/catalog << "EOF"
-- Begin Single Major Version catalog changes --

PUBLIC "-//OASIS//DTD DocBook V4.4//EN" "docbook.dtd"
PUBLIC "-//OASIS//DTD DocBook V4.3//EN" "docbook.dtd"
PUBLIC "-//OASIS//DTD DocBook V4.2//EN" "docbook.dtd"
PUBLIC "-//OASIS//DTD DocBook V4.1//EN" "docbook.dtd"
PUBLIC "-//OASIS//DTD DocBook V4.0//EN" "docbook.dtd"

-- End Single Major Version catalog changes --
EOF

# run the following and copy /etc/sgml in $INSTALL_DIR

# install-catalog --add /etc/sgml/sgml-docbook-dtd-4.5.cat \
#   /usr/share/sgml/docbook/sgml-dtd-4.5/catalog &&

# install-catalog --add /etc/sgml/sgml-docbook-dtd-4.5.cat \
#  /etc/sgml/sgml-docbook.cat

#
# docbook-xml
#

cd $BUILD_DIR

cp -r $SOURCES_DIR/docbook-4.5/docbook-xml-4.5 .
cd docbook-xml-4.5

install -v -d -m755 $INSTALL_DIR/usr/share/xml/docbook/xml-dtd-4.5
install -v -d -m755 $INSTALL_DIR/etc/xml
chown -R root:root .
cp -v -af docbook.cat *.dtd ent/ *.mod \
  $INSTALL_DIR/usr/share/xml/docbook/xml-dtd-4.5

# run the xmlcatalog commands described here:
# http://www.linuxfromscratch.org/blfs/view/cvs/pst/docbook.html
# and copy the folder /etc/xml to $INSTALL_DIR

#
# docbook-xsl
#

cd $BUILD_DIR

cp -r $SOURCES_DIR/docbook-4.5/docbook-xsl-1.79.1 .
cd docbook-xsl-1.79.1

install -v -m755 -d \
  $INSTALL_DIR/usr/share/xml/docbook/xsl-stylesheets-1.79.1

cp -v -R 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                                          \
  $INSTALL_DIR/usr/share/xml/docbook/xsl-stylesheets-1.79.1

ln -s VERSION \
  $INSTALL_DIR/usr/share/xml/docbook/xsl-stylesheets-1.79.1/VERSION.xsl

install -v -m644 -D README \
  $INSTALL_DIR/usr/share/doc/docbook-xsl-1.79.1/README.txt
install -v -m644    RELEASE-NOTES* NEWS* \
  $INSTALL_DIR/usr/share/doc/docbook-xsl-1.79.1

# run the xmlcatalog commands described here:
# http://www.linuxfromscratch.org/blfs/view/svn/pst/docbook-xsl.html
# and copy the folder /etc/xml to $INSTALL_DIR