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