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