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