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