summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/isodoc/inst
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/isodoc/inst')
-rw-r--r--Master/texmf-dist/doc/latex/isodoc/inst223
1 files changed, 122 insertions, 101 deletions
diff --git a/Master/texmf-dist/doc/latex/isodoc/inst b/Master/texmf-dist/doc/latex/isodoc/inst
index 44a3098fa88..a2d66124f91 100644
--- a/Master/texmf-dist/doc/latex/isodoc/inst
+++ b/Master/texmf-dist/doc/latex/isodoc/inst
@@ -1,112 +1,133 @@
#!/bin/bash
-NAME=isodoc
-# this script creates and installs the NAME class and its
-# documentation, and can make a zip for CTAN uploads
-
-# ./inst : create everything, install in local tree, make zip for CTAN
-# ./inst clean : remove all that can be restored
-# ./inst zip : make a zip file for CTAN
+ NAME=isodoc
+ DOCTYPE=class
+ EXT=cls
+ VERSION=`grep " v[0-9.]\+ $NAME $DOCTYPE" $NAME.dtx |sed 's/.* v\([0-9.]\+\) .*/\1/' `
+EXECUTABLES=(pdfseparate zip unzip getopt)
function die {
- echo "$@"
- exit 1
+ echo -e "$*"
+ exit 1
+}
+
+function help {
+ cat <<-EOD
+ This is inst - install the $NAME LaTeX $DOCTYPE
+ Options:
+ -h, --help print this help
+ -c, --clean remove all files created by the installation, except the zip file
+ -C, --Clean remove all files that can be regenerated
+ -z, --zip Create zip for CTAN (developer only)
+
+ Without any options, inst creates $NAME.{$EXT,ins,pdf} and installs these,
+ together with isodocsymbols.sty,
+ in the local TeX tree (\$TEXMFLOCAL) or, if that is not writable,
+ in the userĀ“s TeX tree (\$TEXMFHOME). Also, a zip file is created for upload to CTAN.
+ EOD
+ exit
+}
+
+function setdir { # create installation directory
+ TREE=$(kpsewhich --expand-var '$TEXMFLOCAL')
+ test -w $TREE || TREE=$(kpsewhich --expand-var '$TEXMFHOME')
+ test "$TREE" = "" && die Could not find value for $TREE
+ INSTDIR=${TREE}/tex/latex/$NAME
+ SOURCE=$TREE/source/latex/$NAME
+ mkdir -p $INSTDIR || die could not create $INSTDIR
+ mkdir -p $SOURCE || die could not create $SOURCE
}
-function clean() { # remove all that can be restored,
- # except NAME.{cls,pdf,ins,dtx}
- rm -f *.{txt,aux,glo,gls,idx,ilg,ind,out,log,toc}
- rm -f *.{ttf,png,jpg} # these are in binaries.m64
- rm -f logo?.pdf isodocsymbols.sty
- for i in *.tex; do rm -f ${i%tex}pdf; done
+function testexecs { # test presence of executables
+ for i in ${EXECUTABLES[*]}; do
+ type $i &> /dev/null || die executable $i not found
+ done
}
-# The script needs:
-# pdfseparate
-# unzip
-# uudecode (from sharutils)
+function readme { # generate the README file
+ sed -n "/^%<\*readme>/,/^%<\/readme>/p;/\\\\changes{v$VERSION}/,/^% }/p" $NAME.dtx |
+ sed "s/^%//;s/\\\\\\\\$//;/<.readme>/d;/^ }/d;s/ \\\\changes.*/Changes in version $VERSION:/" >README
+}
+
+function clean { # clean but keep what goes in the zip
+ rm -f $NAME.{aux,fls,glo,gls,idx,ilg,ind,log,out,toc}
+ rm -f examples/*/{$NAME*,*.{pdf,aux,log,out}}
+}
+
+function Clean {
+ clean
+ rm -f $NAME.{$EXT,pdf} README
+}
+
+function makeall {
+ echo y |tex $NAME.ins >/dev/null
+ # install any .ttf files
+ mkdir -p ~/.fonts
+ find examples -name '*.ttf' -exec cp {} ~/.fonts \;
+ fc-cache ~/.fonts
+
+ # compile all examples
+
+ cd examples
+ for i in *; do
+ cd $i
+ for j in ../../{$NAME.cls,isodocsymbols.sty,languages/isodoc*.ldf}; do ln -sf $j; done
+ read TEX <$i.tex
+ if [[ $TEX =~ ^%! ]]; then TEX=${TEX#%!}; else TEX=pdflatex;fi
+ $TEX --interaction=batchmode $i >/dev/null || die error compiling $i
+ $TEX --interaction=batchmode $i >/dev/null || die error compiling $i
+ test -e logoletter.pdf && pdfseparate -l 2 logoletter.pdf logo%d.pdf
+ cd ..
+ done
+ cd ..
+ # make $NAME.pdf
+ pdflatex --recorder --interaction=batchmode $NAME.dtx >/dev/null ||
+ die "`texlog_extract $NAME.log`"
+ test -f $NAME.glo && makeindex -q -s gglo.ist -o $NAME.gls $NAME.glo
+ test -f $NAME.idx && makeindex -q -s gind.ist -o $NAME.ind $NAME.idx
+ pdflatex --interaction=batchmode $NAME.dtx > /dev/null
+ pdflatex --interaction=batchmode $NAME.dtx > /dev/null
+}
+
+function installall {
+ # install and cleanup
+ echo installing in $INSTDIR
+ mv -f $NAME.{$EXT,pdf} $INSTDIR
+ cp -a isodocsymbols.sty languages $INSTDIR
+ cp -a $NAME.{ins,dtx} $SOURCE
+ mktexlsr $TREE 2>/dev/null
+ clean
+}
+
+function mkzip {
+ clean
+ readme
+ cd ..
+ zipfile=$NAME/$NAME-$VERSION.zip
+ rm -f $zipfile
+ zip -Drq $zipfile $NAME/* -x $NAME/test/*
+ cd $NAME
+ Clean
+}
+
+testexecs
+setdir
+
+if ! options=$(getopt -o hcz \
+ -l help,clean,zip -- "$@"); then exit 1; fi
+eval set -- "$options"
-for i in pdfseparate unzip uudecode; do
- type $i &> /dev/null || die executable $i not found
+while [ $# -gt 0 ]; do
+ case $1 in
+ -c|--clean) Clean; exit;;
+ -z|--zip) makeall; mkzip; exit;;
+ -h|--help) help;;
+ (--) shift; break;;
+ (*) break;;
+ esac
+ shift
done
+test "$1" = "" || die No arguments expected
-LOCAL=`kpsewhich --expand-var '$TEXMFLOCAL'` # local tex dir
-if [ "$LOCAL" = "" ]; then
- echo 'Could not find value for $TEXMFLOCAL'
- exit 1
-fi
-LOCAL=${LOCAL}/tex/latex/$NAME
-ln -sf ../$NAME.dtx
-ln -sf ../$NAME.ins
-ln -sf ../isodocsymbols.sty
-
-
-# binary files are stored cvs as a mime64-encoded zip file binaries.m64
-# pack binaries, if necessary, with:
-# zip -m binaries *.ttf *.jpg *.png
-# uuencode binaries.zip <binaries.zip > binaries.m64
-# rm binaries.zip
-# but don't forget to add the original $Id...$ line on top of the new encoded file
-
-case "$1" in
-clean)
- clean
- rm -f $NAME.{cls,pdf,ins,dtx} isodocsymbols.sty
- ;;
-zip)
- echo make zip
- mv $NAME.cls $NAME.pdf ..
- clean
- rm $NAME.dtx $NAME.ins
- cd ..
- version=`grep " v[0-9.]\+ $NAME class" $NAME.dtx |sed 's/.* v\([0-9.]\+\) .*/\1/' `
- zipfile=$NAME-$version.zip
- zip -Drq $zipfile * -x '*CVS*'
- rm $NAME.cls $NAME.pdf
- ;;
-"")
- echo unpack binaries
- uudecode binaries.m64
- unzip -q binaries
- rm binaries.zip
- fc-list |grep Chopin >/dev/null || (
- mkdir -p ~/.fonts
- cp ChopinScript.ttf ~/.fonts
- fc-cache -f
- )
-
- # make verbinput files without $Id-lines
- echo make example files
- for i in `grep -l '$\(Id\): ' *.{tex,sty}`; do
- grep -v '$\(Id\): ' $i >${i%.???}.txt
- done
-
- echo y |tex $NAME.ins >/dev/null
- for i in *.tex; do
- echo ___________ $i ___________
- LTX=pdflatex
- if [ $i = logoletter.tex ]; then LTX=xelatex; fi
- $LTX $i >/dev/null ||die error compiling $i
- $LTX $i >/dev/null
- done
- pdfseparate -l 2 logoletter.pdf logo%d.pdf
-
- echo make documentation
- pdflatex --interaction=batchmode $NAME.dtx > /dev/null
- test -f $NAME.glo && makeindex -q -s gglo.ist -o $NAME.gls $NAME.glo
- test -f $NAME.idx && makeindex -q -s gind.ist -o $NAME.ind $NAME.idx
- pdflatex --interaction=batchmode $NAME.dtx > /dev/null
- texlog_extract $NAME |uniq
-
- echo install in local tree
- rm -rf $LOCAL
- mkdir -p $LOCAL
- cp $NAME.{dtx,cls,pdf} isodocsymbols.sty $LOCAL # install in local tex tree
- mktexlsr $LOCAL
- ;;
-*)
- echo illegal argument
- exit 1
- ;;
-esac
-# $Id: inst,v 1.23 2012/09/26 13:44:37 wybo Exp $
+makeall
+installall