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