cgal/Scripts/developer_scripts/create_modules

187 lines
5.2 KiB
Bash
Executable File

#!/bin/sh
#the next variables will be overwritten by the parameters
CVSDIR="/cygdrive/d/CGALCVS"
MODULES_DIRECTORY="Modules"
RELEASE_VERSION="CGAL-3.1-I-XX"
RELEASE_NUMBER="100060003"
UPDATING="y"
INSTALLATION_DIR="/cygdrive/d/CGALCVS/Modules"
CREATING_DOC="y"
#check the parameters
while [ ${#} -gt 0 ]; do
case ${*} in
-h*|-help*|--help*)
printf "usage: create_modules (-h|-help|--help)\n\t-d dir\tSets the CVSDIR directory. The default is /cygdrive/d/CGALCVS.\n\t-m mod\tSets the name of the Modules directory from the Installation package. The default name is Modules.\n\t-r ver\tSets the release version of CGAL which was used to build the modules (eg. CGAL-3.1-I-79).\n\t-n nr\tSets the release number of CGAL (eg. 1003004200).\n\t-u y|n\tSets the updating state. The default is y. If n is specified, the script will no longer update the packages involved.\n\t-i DIR\tSets the installation directory for the modules.\n\t-c y|n\tSets the state of the doc creation process. The default is y. If n is specified, the script will no longer create the doc of the modules.\n"
exit
;;
-d*)
CVSDIR="$2"
shift
;;
-m*)
MODULES_DIRECTORY="$2"
shift
;;
-r*)
RELEASE_VERSION="$2"
shift
;;
-n*)
RELEASE_NUMBER="$2"
shift
;;
-u*)
UPDATING="$2"
shift
;;
-i*)
INSTALLATION_DIR="$2"
shift
;;
-c*)
CREATING_DOC="$2"
shift
esac
shift
done
printf "Setting CVSDIR=${CVSDIR} ...\n"
printf "Setting MODULES_DIRECTORY=${MODULES_DIRECTORY} ...\n"
printf "Setting INSTALLATION_DIR=${INSTALLATION_DIR} ...\n"
printf "Setting RELEASE_VERSION=${RELEASE_VERSION} ...\n"
printf "Setting RELEASE_NUMBER=${RELEASE_NUMBER} ...\n"
if [ ! -r ${CVSDIR} ]; then
printf "Directory ${CVSDIR} does not exist ... EXITING\n"
exit
fi
#if [ ! -r create_internal_module ]; then
# printf "create_internal_module file could not be found ... EXITING\n"
# exit
#fi
cd ${CVSDIR} || return
if [ "${UPDATING}" = "y" ]; then
if [ -r "Installation" ]; then
printf "Updating package Installation to get the modules list ...\n"
cvs -q update -P Installation
else
printf "Checking out package Installation to get the modules list ...\n"
cvs co -P Installation
fi
if [ -r "Scripts" ]; then
printf "Updating package Scripts to get the right scripts ...\n"
cvs -q update -P Scripts
else
printf "Checking out package Scripts to get the right scripts ...\n"
cvs co -P Scripts
fi
fi
if [ ! -r "${INSTALLATION_DIR}" ]; then
mkdir "${INSTALLATION_DIR}"
fi
for i in `ls Installation/${MODULES_DIRECTORY}/*`
do
if [ -f "${i}" ]; then
MAIN_NAME="`basename ${i}`"
printf "\n\nCreating module ${MAIN_NAME}\n"
if [ -r "${MAIN_NAME}" ]; then
printf " Directory ${MAIN_NAME} exists, removing ...\n"
rm -rf ${MAIN_NAME}
fi
if [ "${UPDATING}" = "y" ]; then
for j in `cat ${i}`
do
if [ -r "${j}" ]; then
printf " Updating package ${j} ...\n"
cvs -q update ${j}
else
printf " Check out package ${j} ...\n"
cvs co -P ${j}
fi
done
fi
${CVSDIR}/Scripts/developer_scripts/create_internal_module -m ${MAIN_NAME} -r ${RELEASE_VERSION} -n ${RELEASE_NUMBER} -a ${CVSDIR} -p ${i} -s "${CVSDIR}/Scripts/scripts"
if [ "${CREATING_DOC}" = "y" ]; then
#creating the doc of the module
printf "Creating the cgal_manual.tex wrapper for the doc ...\n"
#1 creating the cgal_manual.tex wrapper the first part
cat <<EOF >${MAIN_NAME}/doc_tex/cgal_manual.tex
% +------------------------------------------------------------------------+
% | cgal_manual.tex
% | CGAL User and Reference Manual for all packages
% +------------------------------------------------------------------------+
\documentclass{book}
\usepackage{cgal_manual}
\begin{document}
\cgalchapters{
\entryleftright{\part{Basic Library User Manual}}
{\part{Reference Manual}}
\lcTex{\entryright{\listofrefpages}}
EOF
#2 creating the second part of the cgal_manual.tex wrapper
for k in `ls ${MAIN_NAME}/doc_tex/`
do
if [ -d ${MAIN_NAME}/doc_tex/${k} ]; then
_temp_var=`echo "${k}" | grep "_ref"`
if [ -z ${_temp_var} ]; then
printf "\t\\packageleftright{${k}}{${k}_ref}\n" >>${MAIN_NAME}/doc_tex/cgal_manual.tex
fi
fi
done
#3 creating the 3rd part of the cgal_manual.tex wrapper
cat <<EOF >>${MAIN_NAME}/doc_tex/cgal_manual.tex
}
\bibliographystyle{alpha}
\bibliography{cgal_manual,geom}
\printindex
\end{document}
EOF
#end creating the doc of the module
if [ -r ~/.autotest_manual_config ]; then
printf "running latex ...\n"
. ~/.autotest_manual_config
_temp_dir=`pwd`
cd ${MAIN_NAME}/doc_tex
latex cgal_manual.tex
bibtex cgal_manual
latex cgal_manual.tex
latex cgal_manual.tex
#xdvi cgal_manual.dvi
latex_to_html -o ../doc_html cgal_manual
cd ${_temp_dir}
else
printf "autotest_manual_config WAS NOT found in your HOME directory.\n"
fi
fi
tar -cf "${MAIN_NAME}.tar" ${MAIN_NAME}
gzip "${MAIN_NAME}.tar"
mv "${MAIN_NAME}.tar.gz" ${INSTALLATION_DIR}
rm -rf ${MAIN_NAME}
fi
done