#!/bin/bash

# Variable definitions for the rest of the script
#
# PHP_TARGET_DIR  - The directory where the PHP output files should reside.
# EXAMPLES_TAR    - The name (and path) to the tar to contain the examples.
# TEMP_EXPORT_DIR - A name for a temporary export of the CVS tree, needed in
#                   order create a tar of the examples, clean of CVS subdirs.

PHP_TARGET_DIR=""
EXAMPLES_TAR=""
TEMP_EXPORT_DIR=""

# Compile the XML file, and copy the PHP output from the local php dir
# to the final location.

./compile
cp php/*.php $PHP_TARGET_DIR
ln -sf $PHP_TARGET_DIR/book1.php $PHP_TARGET_DIR/index.php

# Copy the figures to the same dir as the PHP.

cp -Rf figures $PHP_TARGET_DIR

# Get an export of this CVS module, and tar the examples directory from
# it, using the temporary directory name.

rm -rf $TEMP_EXPORT_DIR
cvs -q export -D 'tomorrow' -d $TEMP_EXPORT_DIR ZendAPI > /dev/null
(cd $TEMP_EXPORT_DIR/source/; tar czf - Extending_PHP ) > $EXAMPLES_TAR
