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