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