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