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