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