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