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