7deead
#! /bin/sh
7deead
7deead
# This script builds the PDF version of the PostgreSQL documentation.
7deead
#
7deead
# In principle we could do this as part of the RPM build, but there are
7deead
# good reasons not to:
7deead
# 1. The build would take longer and have a larger BuildRequires footprint.
7deead
# 2. The generated PDF has timestamps in it, which would inevitably result
7deead
#    in multilib conflicts due to slightly different timestamps.
7deead
# So instead, we run this manually when rebasing to a new upstream release,
7deead
# and treat the resulting PDF as a separate Source file.
7deead
#
7deead
# You will need to have the docbook packages installed to run this.
7deead
# Expect it to take about 20 minutes and use about 160MB of disk.
7deead
7deead
set -e
7deead
7deead
# Pass package version (e.g., 9.1.2) as argument
7deead
VERSION=$1
7deead
7deead
test -z "$VERSION" && VERSION=`awk '/^Version:/ { print $2; }' postgresql.spec`
7deead
7deead
TARGETFILE=postgresql-$VERSION-US.pdf
7deead
test -f "$TARGETFILE" && echo "$TARGETFILE exists" && exit 1
7deead
7deead
echo Building $TARGETFILE ...
7deead
7deead
# Unpack postgresql
7deead
7deead
rm -rf postgresql-$VERSION
7deead
7deead
tar xfj postgresql-$VERSION.tar.bz2
7deead
7deead
cd postgresql-$VERSION
7deead
7deead
# Apply any patches that affect the PDF documentation
7deead
7deead
# patch -p1 < ../xxx.patch
7deead
7deead
# Configure ...
7deead
7deead
./configure >/dev/null
7deead
7deead
# Build the PDF docs
7deead
7deead
cd doc/src/sgml
7deead
7deead
make postgres-US.pdf >make.log
7deead
7deead
mv -f postgres-US.pdf ../../../../$TARGETFILE
7deead
7deead
# Clean up
7deead
7deead
cd ../../../..
7deead
7deead
rm -rf postgresql-$VERSION
7deead
7deead
exit 0