cgal/Packages/Manual/scripts/install_manual_files

165 lines
6.0 KiB
Bash
Executable File

#!/bin/sh
# Usage: install_manual_files <version_num>
# where <version_num> is something like 2.1-I-17
if [ $# -eq 0 ] ; then
echo "Usage $0 <version_num>"
echo " <version_num> should be something like 2.1-I-17"
exit 1
else
VERSION_NUM=$1
VERSION=CGAL-$1
fi
SOURCE_DIR="/KM/projects/CGAL/Work_in_Progress/CGAL_autotest/$VERSION"
if [ ! -d $SOURCE_DIR/doc_tex ] ; then
echo "source directory $SOURCE_DIR/doc_tex does not exist"
exit 1
fi
if [ ! -d doc_tex_skel ] ; then
echo "skeleton directory doc_tex_skel does not exist in this directory"
exit 1
fi
TARGET_DIR="${VERSION}_doc_tex"
if [ -d $TARGET_DIR ]; then
echo "directory $TARGET_DIR already exists"
exit 1
fi
mkdir $TARGET_DIR
# copy the "skeleton" directory
cp -r doc_tex_skel/* $TARGET_DIR
# put the right version number in the makefile
sed 's/VERSION_NUM=.*/VERSION_NUM='$VERSION_NUM'/' $TARGET_DIR/makefile > $TARGET_DIR/new_makefile
\mv $TARGET_DIR/new_makefile $TARGET_DIR/makefile
SRC_SUBDIRS=`ls $SOURCE_DIR/doc_tex`
if [ ! -f $TARGET_DIR/docdirs ]; then
echo "*** 'docdirs' file does not exist in $TARGET_DIR ***"
exit 1
fi
find_in_target_docdirs()
{
for TGT_SUBSUBDIR in $TGT_DOCDIRS; do
if [ $TGT_SUBSUBDIR = $SRC_SUBSUBDIR \
-o ${TGT_SUBSUBDIR}_ref = $SRC_SUBSUBDIR ]; then
echo "y"
return
fi
done
echo "n"
}
# for each subdirectory in the source
# see if there is a corresponding subdirectory in the target
# if so, see if there is a docdirs file in that target subdirectory
# if so, see if all the directories listed in this docdirs are
# also subdirectories of the source AND see if all the subdirectories
# of the source are listed in the docdirs file
for SUBDIR in $SRC_SUBDIRS; do
if [ ! -d $TARGET_DIR/$SUBDIR ]; then
echo
echo "+++ subdirectory $SUBDIR is new in source directory +++
echo "+++ update 'docdirs' file in $TARGET_DIR +++
echo
elif [ -f $TARGET_DIR/$SUBDIR/docdirs ]; then
TGT_DOCDIRS=`cat $TARGET_DIR/$SUBDIR/docdirs`
for TGT_SUBSUBDIR in $TGT_DOCDIRS; do
if [ $TGT_SUBSUBDIR != "Title" \
-a $TGT_SUBSUBDIR != "Preface" \
-a $TGT_SUBSUBDIR != "Introduction" \
-a ! -d $SOURCE_DIR/doc_tex/$SUBDIR/$TGT_SUBSUBDIR ]; then
echo "--- directory $TGT_SUBSUBDIR does not exist in $SOURCE_DIR/doc_tex/$SUBDIR"
fi
done
make_AllMains $TARGET_DIR/$SUBDIR
SRC_SUBSUBDIRS=`ls $SOURCE_DIR/doc_tex/$SUBDIR`
for SRC_SUBSUBDIR in $SRC_SUBSUBDIRS; do
RESULT=`find_in_target_docdirs`
if [ $RESULT = "n" ]; then
echo "+++ directory $SRC_SUBSUBDIR is not in $TARGET_DIR/$SUBDIR/docdirs"
fi
done
fi
done
cp -r $SOURCE_DIR/doc_tex/* $TARGET_DIR
# edit the cgalrelease command to correspond to this version
#
DOCDIRS=`cat $TARGET_DIR/docdirs`
for DIR in $DOCDIRS; do
if [ -f $TARGET_DIR/$DIR/wrapper.tex ]; then
sed 's/\\newcommand{\\cgalrelease}.*/\\newcommand{\\cgalrelease}{'$VERSION_NUM'}/' $TARGET_DIR/$DIR/wrapper.tex > temp_wrapper.tex
mv temp_wrapper.tex $TARGET_DIR/$DIR/wrapper.tex
else
echo "!!! directory $TARGET_DIR/$DIR has no wrapper.tex !!!"
fi
done
echo "***copying common_intro.tex to kernel and support ***"
\cp $TARGET_DIR/basic/Introduction/common_intro.tex $TARGET_DIR/support/Introduction
\cp $TARGET_DIR/basic/Introduction/common_intro.tex $TARGET_DIR/kernel/
echo "***copying Handle to Handles_and_Circs***"
\cp $TARGET_DIR/support/Handle/*.tex $TARGET_DIR/support/Handles_and_Circs
echo "***copying Circulator to Handles_and_Circs***"
\cp $TARGET_DIR/support/Circulator/*.tex $TARGET_DIR/support/Handles_and_Circs
echo "***recopying Handles_and_Circs/main.tex***"
\cp doc_tex_skel/support/Handles_and_Circs/main.tex $TARGET_DIR/support/Handles_and_Circs
echo "***creating Handles_and_Circs_ref***"
mkdir $TARGET_DIR/support/Handles_and_Circs_ref
echo "***copying Handle_ref to Handles_and_Circs_ref***"
\cp $TARGET_DIR/support/Handle_ref/*.tex $TARGET_DIR/support/Handles_and_Circs_ref
echo "***copying Circulator_ref to Handles_and_Circs_ref***"
\cp $TARGET_DIR/support/Circulator_ref/*.tex $TARGET_DIR/support/Handles_and_Circs_ref
echo "***editing Handles_and_Circs_ref/intro.tex to include Handle and pointer***"
sed 's/\\chapter{Circulators}/\\chapter{Handles and Circulators}/; s/\\ccc{Random_access_circulator}/&\\\\ \\ccRefConceptPage{Handle}/; s/\\ccRefIdfierPage{CGAL::Circulator_traits<C>}/&\\\\ \\ccRefIdfierPage{CGAL::Pointer<T>}/; s/\\section\*{Summary}/& \\input{handle_intro}/' $TARGET_DIR/support/Circulator_ref/intro.tex > $TARGET_DIR/support/Handles_and_Circs_ref/intro.tex
echo "***copying Timer to Miscellany***"
\cp $TARGET_DIR/support/Timer/* $TARGET_DIR/support/Miscellany
\cp $TARGET_DIR/support/Timer_ref/* $TARGET_DIR/support/Miscellany_ref
echo "***copying Hash_map to Miscellaney***"
\cp $TARGET_DIR/support/Hash_map/* $TARGET_DIR/support/Miscellany
\cp $TARGET_DIR/support/Hash_map_ref/* $TARGET_DIR/support/Miscellany_ref
echo "***copying Union_find to Miscellaney***"
\cp $TARGET_DIR/support/Union_find/* $TARGET_DIR/support/Miscellany
\cp $TARGET_DIR/support/Union_find_ref/* $TARGET_DIR/support/Miscellany_ref
echo "***copying Modifier to Miscellaney***"
\cp -r $TARGET_DIR/support/Modifier/* $TARGET_DIR/support/Miscellany
\cp -r $TARGET_DIR/support/Modifier_ref/*.tex $TARGET_DIR/support/Miscellany_ref
echo "***recopying Miscellany main.tex***"
\cp doc_tex_skel/support/Miscellany/main.tex $TARGET_DIR/support/Miscellany
echo "***recopying Miscellany_ref intro.tex***"
\cp doc_tex_skel/support/Miscellany_ref/intro.tex $TARGET_DIR/support/Miscellany_ref
cd $TARGET_DIR/support
echo "***creating Handles_and_Circs_ref main.tex***"
cc_make_ref_pages Handles_and_Circs_ref
echo "***creating Miscellany_ref main.tex***"
cc_make_ref_pages Miscellany_ref
cd ..
link_html_wrapper
cd ..
echo "making link to examples and demo directories"
\rm -f examples
\rm -f demo
ln -s $SOURCE_DIR/examples .
ln -s $SOURCE_DIR/demo .