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