diff options
Diffstat (limited to 'Build/cdbuild/ctan2tds.pl')
-rwxr-xr-x | Build/cdbuild/ctan2tds.pl | 2415 |
1 files changed, 2415 insertions, 0 deletions
diff --git a/Build/cdbuild/ctan2tds.pl b/Build/cdbuild/ctan2tds.pl new file mode 100755 index 00000000000..28a472e0ffd --- /dev/null +++ b/Build/cdbuild/ctan2tds.pl @@ -0,0 +1,2415 @@ +#!/usr/bin/perl +# $Author: karl $ $Date: 2005/11/01 $ $Id: //depot/Build/cdbuild/ctan2tds.pl#236 $ +# +# A script to (theoretically) TL-install any package from CTAN. +# +# Its actions, given a directory, are +# 1. copy everything to texmf-dist/source/<format>/<package> +# 2. run any .ins files +# 3. run any .mf files through mktextfm +# 4. move .sty/.cls etc files to texmf-dist/tex/<format>/<package> +# 5. run LaTeX on .dtx/.tex and put the .dvi files in +# texmf-dist/doc/<format>/<package>. dtx files are run with just the +# description if this is set up properly in the source. +# 6. move .tex to texmf-dist/doc/<format>/<package> +# +# All the patterns for what to move or run can be overridden for each package. +# +# PROBLEMS +# 1. .tex files are used for lots of different purposes, so this is flaky +# 2. if there is no .dtx, the .sty files are *moved*, rather than copied, +# so the source directory is not complete. is this a bug or a feature? +# [feature --karl] +# 3. complex packages with subdirectories are not well catered for +# +# ENHANCEMENTS NEEDED +# 1. a notation for dependencies; actually surprisingly few +# 2. cleaner way of describing the various %special... hashes, so info +# about a given package is in one place. +# +# Sebastian Rahtz <sebastian.rahtz@oucs.ox.ac.uk> + +# License: PUBLIC DOMAIN + +use English; +use Getopt::Long; +use File::Basename; +use Cwd; +# +# programs used; must all be on the path +$MV="mv"; +$CP="cp -p"; + +$| = 1; +select ((select (STDERR), $| = 1)[0]); + +# the destination destination tree +$startdir=getcwd(); +chdir(dirname($0)); +chdir "cooked" || die "chdir(cooked) failed: $!"; +$TDS = getcwd(); +chdir $startdir || die "chdir($startdir) failed: $!"; + +# +#-------------------------------------------------------------- +# packages to treat entirely on their own, or not at all. +# the code here is evaluated by Perl, so special packages +# can have their own subroutine. +# +%special = ( + 'Catalogue', "&MAKEcatalog", + 'HA-prosper', '&MAKEhaprosper', + 'IEEEtran', "&MAKEIEEEtran", + 'MnSymbol', "&MAKEflatten", + 'SIstyle', '&MAKESIstyle', + 'aastex', "&MAKEflatten", + 'ae', "&MAKEae", + 'allrunes', "&MAKEflatten", + 'amslatex', "&MAKEflatten", + 'amsldoc-vn', "&MAKEflatten", + 'antomega', "&MAKEflatten", + 'antt', "&MAKEflatten", + 'arabtex', "&MAKEflatten", + 'archaic', "&MAKEwilson", + 'arev', "&MAKEcopy", # straight copy + 'augie', "&MAKEaugie", + 'babel', "&MAKEbabel", + 'bangtex', "&MAKEflatten", + 'bardiag', "&MAKEbardiag", + 'barr', "&MAKEbarr", + 'bbm', "&MAKEbbm", + 'beamer', "&MAKEbeamer", + 'beebe', "print \&MAKEbeebe needs work'", + 'bengali', '&MAKEflatten', + 'bera', "&MAKEunzipandflatten", + 'bookhands', "&MAKEwilson", + 'borceux', "&MAKEborceux", + 'burmese', "&MAKEflatten", + 'cb', "&MAKEflatten", + 'cbcoptic', "&MAKEcbcoptic", + 'changebar', "&MAKEchangebar", + 'circuit_macros', "print \"Not installing circuit_macros as it is m4\n\"", + 'cjhebrew', "&MAKEflatten", + 'clock', "&MAKEflatten", + 'cm-lgc', '&MAKEcmlgc', + 'cmbright', "&MAKEflatten", + 'cmcyr', "&MAKEflatten", + 'concmath', "&MAKEconcmath", + 'context', "&MAKEcontext", + 'coptic', "print \"Not installing coptic as it has been replaced by cbcoptic\n\"", + 'corridx', "print \"Not installing corridx as it is Pascal source\n\"", + 'ctib', "&MAKEflatten", + 'cweb', "print \"Not installing cweb as it is weird\n\"", + 'devanagr', "&MAKEdevanagr", + 'diagnose', "&MAKEflatten", + 'dictsym', "&MAKEunzipandflatten", + 'dmfonts', "print \"Not installing dmfonts as it has fonts\n\"", + 'dtk', "&MAKEflatten", + 'dtxtut', "&setup", # straight copy + 'easy', "&MAKEeasy", + 'ebib', "print \"Not installing ebib as it is Emacs\n\"", + 'ecc', "&MAKEecc", + 'eco', "&MAKEeco", + 'ednotes', "&MAKEnosymlinks", + 'elhyphen', "&MAKEelhyphen", + 'epiolmec', "&MAKEflatten", + 'epix', "print \"Not installing epix as it requires C++ compilation\n\"", + 'eplain', "&MAKEeplain", + 'eqnarray', "&MAKEeqnarray", + 'esvect', "&MAKEflatten", + 'ethiop', "&MAKEflatten", + 'euclide', "&MAKEpst", + 'eulervm', "&MAKEflatten", + 'eurosym', "&MAKEflatten", + 'expressgx', "&MAKEexpressg", + 'fancyvrb', "&MAKEfancyvrb", + 'fc', "&MAKEflatten", + 'featpost', "&MAKEfeatpost", + 'feynmf', "&MAKEfeynmf", + 'fontinst', "&MAKEfontinst", + 'footnpag', "&MAKEfootnpag", + 'fourier', "&MAKEflatten", + 'fp', "&MAKEfp", + 'fpl', "&MAKEflatten", + 'fragments', "print \"Not installing fragments (not a package) \n\"", + 'frankenstein',"print \"Not installing frankenstein, to be replaced\n\"", + 'frcursive', "&MAKEflatten", + 'germbib', "&MAKEflatten", + 'hfbright', "&MAKEflatten", + 'hfoldsty', "&MAKEflatten", + 'hyperref', "&MAKEhyperref", + 'ibycus-babel',"&MAKEibycusbabel", + 'ibygrk', "&MAKEflatten", + 'invoice', "&MAKEflatten", + 'kerkis', "&MAKEflatten", + 'koma-script', "&MAKEkoma", + 'kuvio', "&MAKEkuvio", + 'latexmp', "&MAKEflatten", + 'leawood', "&MAKEflatten", + 'lettre', "&MAKEflatten", + 'lettrine', "&MAKEflatten", + 'lexitex', "print \"Not installing lexitex (use camel) \n\"", + 'lfb', "&MAKElfb", + 'lh', "&MAKElh", + 'lifia-th', "print \"Not installing lifia-th (??) \n\"", + "lineno", "&MAKEnosymlinks", + 'listings', "&MAKElistings", + 'literat', "&MAKEliterat", + 'lm', "&MAKEcopy", + 'lshort-bulgarian', '&MAKElshort', + 'lshort-english', '&MAKElshort', + 'lshort-finnish', '&MAKElshort', + 'lshort-vietnamese', '&MAKElshort', + 'ltt', "&MAKEltt", + 'ltxbase', "&MAKEbase", + 'lucida', "&MAKElucida", + 'makor', "&MAKEbase", + 'manjutex', "&MAKEflatten", + 'mathmode', "&setup", + 'mathpazo', "&MAKEmathpazo", + 'metaobj', "&MAKEflatten", + 'mflogo', "&MAKEmflogo", + 'mfpic', "&MAKEflatten", + 'mh', "&MAKEflatten", + 'misc', "&MAKEmisc", + 'montex', "&MAKEflatten", + 'movie15', "&MAKEflatten", + 'mpattern', "&MAKEmpattern", + 'ms', "&MAKEms", + 'multido', "&MAKEpst", + 'mxd', "&MAKEflatten", + 'mxedruli', "&MAKEflatten", + 'ncctools', "&MAKEflatten", + 'ocherokee', "&MAKEflatten", + 'ofs', "&MAKEflatten", + 'omegajapanese',"&MAKEflatten", + 'ot2cyr', "&MAKEot2cyr", + 'otibet', "&MAKEflatten", + 'pandora', "&MAKEflatten", + 'pb-diagram', "&MAKEpbdiagram", + 'pclnfss', "&MAKEpclnfss", + 'perltex', "&MAKEperltex", + 'pgf', "&MAKEpgf", + 'phaistos', "&MAKEflatten", + 'pict2e', "&MAKEpict2e", + 'pictex', "&MAKEpictex", + 'pl-qx', "&MAKEplqx", + 'poster', "print \"Not installing poster, nonfree license\n\"", + 'powerdot', '&MAKEflatten', + 'prosper', '&MAKEflatten', + 'psfragx', "&MAKEflatten", + 'pslatex', "&MAKEpslatex", + 'psnfss', "&MAKEpsnfss", + 'psnfss-addons', "print \"Not installing psnfss-addons \n\"", + 'psnfssx', "&MAKEflatten", + 'pst-3dplot', "&MAKEpst", + 'pst-bar', "&MAKEpst", + 'pst-blur', "&MAKEpst", + 'pst-circ', "&MAKEpst", + 'pst-eucl', "&MAKEpst", + 'pst-fr3d', "&MAKEpst", + 'pst-func', "&MAKEpst", + 'pst-geo', "&MAKEpst", + 'pst-ghsb', "&MAKEpst", + 'pst-gr3d', "&MAKEpst", + 'pst-infixplot',"&MAKEpst", + 'pst-jftree', "&MAKEpst", + 'pst-lens', "&MAKEpst", + 'pst-light3d', "&MAKEpst", + 'pst-math', "&MAKEpst", + 'pst-optic', "&MAKEpst", + 'pst-osci', "&MAKEpst", + 'pst-poly', "&MAKEpst", + 'pst-slpe', "&MAKEpst", + 'pst-uml', "&MAKEpst", + 'pst-vue3d', "&MAKEpst", + 'pstricks', "&MAKEpstricks", + 'pstricks-add',"&MAKEpst", + 'pxfonts', "&MAKEflatten", + 'revtex', "&MAKEflatten", + 'seminar', "&MAKEseminar", + 'siam', "&MAKEsiam", + 'skak', "&MAKEflatten", + 'symbolindex', "print \"requires binary, skip\"", + 't2', "&MAKEt2", + 'tabvar', "&MAKEflatten", + 'tamethebeast', "&MAKEtamethebeast", + 'tex-refs', "print \"tex-refs not ready\n\"", + 'texdraw', "&MAKEtexdraw", + 'texsis', "&MAKEtexsis", + 'thumbpdf', "&MAKEthumbpdf", + 'ticket', "&MAKEflatten", + 'tipa', "&MAKEtipa", + 'tpcmfont', "print \"Not installing tpcmfont\n\"", + 'txfonts', "&MAKEflatten", + 'ucs', "&MAKEucs", + 'ukrhyph', "&MAKEukrhyph", + 'velthuis', "&MAKEflatten", + 'vhistory', "&MAKEflatten", + 'vntex', "&MAKEcopy", + 'voss-de', "&MAKEvossde", + 'wasy2', "&MAKEflatten", + 'xfrac', "&MAKEflatten", + 'xkeyval', "&MAKEflatten", + 'xmltex', "&MAKExmltex", + 'xymtex', "&MAKExymtex", + 'xypic', "&MAKExypic", + 'zefonts', "&MAKEflatten", +); + + +# needs special TeX program to run the doc. +%specialTEX = ( + 'arabtex', 'tex', + 'barr', 'latex', + 'beamer', 'pdflatex', + 'bytefield', 'pdflatex', + 'esint-type1', 'pdftex', + 'euro-ce', 'tex', + 'floatrow', 'latex', + 'genealogy', 'tex', + 'insbox', 'tex', + 'iso10303', 'pdflatex', + 'mfpic', 'tex', + 'mpattern', 'true', # requires running mpp, but it's not executable and + # anyway it's just a test file. ignore it. + 'ofs', 'csplain', + 'pdfpages', 'pdflatex', + 'pdfscreen', 'pdflatex', + 'pdfslide', 'pdflatex', + 'pl-qx', 'platex', + 'semaphor', 'tex', + 'subfig', 'pdflatex', + 'texsis', 'tex', + 'typespec', 'tex', + 'wasy2', 'tex', + 'webeq', 'pdflatex', +); + + +%specialsource= ( + 'amsldoc-vn', 'NULL', + 'blacklettert1', '\.dtx|\.ins|\.pl|Makefile', + 'carlisle', '\.dtx|\.ins|ltxtable\.tex', + 'epsf', NULL, +); +$standardsource='\.fdd|\.dtx|\.ins|\.c$|Makefile|\.drv'; + +%specialfoundry = ( + 'fc', 'jknappen', +); +$standardfoundry='public'; + + +%specialdest = ( + 'Type1fonts', 'texmf-doc', + 'amsldoc-vn', 'texmf-doc', + 'catalogue', 'texmf-doc', + 'comprehensive', 'texmf-doc', + 'dtxtut', 'texmf-doc', + 'elhyphen', 'texmf', + 'lshort-bulgarian', 'texmf-doc', + 'lshort-english', 'texmf-doc', + 'lshort-finnish', 'texmf-doc', + 'lshort-vietnamese', 'texmf-doc', + 'mathmode', 'texmf-doc', + 'tamethebeast', 'texmf-doc', + 'tex-refs', 'texmf-doc', + 'voss-de', 'texmf-doc', + 'wp-conv', 'texmf-doc', +); + +# +%specialsourcefmt = ( + 'antomega', 'omega', + 'archaic', 'fonts', + 'arev', 'fonts', + 'arrayjob', 'generic', + 'babel', 'generic', + 'blacklettert1','fonts', + 'cb', 'fonts', + 'cirth', 'fonts', + 'cirth', 'generic', + 'cjhebrew', 'fonts', + 'cmpica', 'fonts', + 'cryst', 'fonts', + 'eplain', 'eplain', + 'epsf', 'generic', + 'eurosym', 'fonts', + 'fc', 'fonts', + 'fourier', 'fonts', + 'fpl', 'fonts', + 'frcursive', 'fonts', + 'genmisc', 'generic', + 'gost', 'bibtex', + 'greenpoint', 'fonts', + 'hfoldsty', 'fonts', + 'kixfont', 'fonts', + 'latexmp', 'metapost', + 'leawood', 'fonts', + 'lfb', 'fonts', + 'multido', 'generic', + 'ofs', 'generic', + 'pictex', 'generic', + 'pstricks', 'generic', + 'ruhyphen', 'generic', + 'skaknew', 'metapost', + 'thumbpdf', 'generic', + 'trajan', 'fonts', + 'velthuis', 'fonts', + 'wasy2', 'fonts', +); +$standardsourcefmt='latex'; + + +%specialfmt = ( + 'abbr', 'generic', + 'antomega', 'omega', + 'arrayjob', 'generic', + 'babel', 'generic', + 'cirth', 'generic', + 'edmac', 'generic', + 'eplain', 'eplain', + 'epsf', 'generic', + 'esint-type1', 'plain', + 'fltpoint', 'generic', + 'genmisc', "generic", + 'jadetex', 'jadetex', + 'metatex', 'plain', + 'ocherokee', 'lambda', + 'ofs', 'generic', + 'passivetex', 'xmltex', + 'pdf-trans', 'generic', + 'pictex', 'generic', + 'plnfss', 'plain', + 'pstricks', 'generic', + 'ruhyphen', 'generic', + 'texsis', 'texsis', + 'thumbpdf', 'generic', + 'wasy2', 'plain', + 'xmlplay', 'xmltex', +); +$standardfmt='latex'; + +# +%specialdocfmt = ( + 'abbr', 'generic', + 'amsldoc-vn', 'vietnamese', + 'antomega', 'omega', + 'archaic', 'fonts', + 'arev', 'fonts', + 'arrayjob', 'generic', + 'babel', 'generic', + 'bera', 'fonts', + 'blacklettert1','fonts', + 'cb', 'fonts', + 'cirth', 'fonts', + 'cjhebrew', 'fonts', + 'devanagr', 'fonts', + 'dictsym', 'fonts', + 'edmac', 'generic', + 'elhyphen', 'generic', + 'eplain', 'eplain', + 'epsf', 'generic', + 'eulervm', 'fonts', + 'eurosym', 'fonts', + 'exteps', 'metapost', + 'fc', 'fonts', + 'featpost', 'metapost', + 'fourier', 'fonts', + 'frcursive', 'fonts', + 'genmisc', "generic", + 'gost', 'bibtex', + 'greepoint', 'fonts', + 'hfoldsty', 'fonts', + 'hieroglf', 'fonts', + 'kixfont', 'fonts', + 'latexmp', 'metapost', + 'leawood', 'fonts', + 'lfb', 'fonts', + 'metatex', 'plain', + 'mpattern', 'metapost', + 'ofs', 'generic', + 'pacioli', 'fonts', + 'pdf-trans', 'generic', + 'phaistos', 'fonts', + 'pictex', 'generic', + 'plnfss', 'plain', + 'pxfonts', 'fonts', + 'texsis', 'texsis', + 'thumbpdf', 'generic', + 'trajan', 'fonts', + 'txfonts', 'fonts', + 'velthuis', 'fonts', + 'voss-de', 'german', + 'wasy2', 'fonts', +); +$standarddocfmt='latex'; + + +# special cases of which .ins files to run; used to remove +# normal choices, and get the most general. +%specialins = ( + 'aastex', 'NULL', # everything is pregenerated + 'babel', 'babel.ins', + 'base', 'NULL', + 'blacklettert1','NULL', # don't try to do fontinst + 'bosisio', '.*\.dtx', + 'carlisle', '\.ins|ltxtable.tex', + 'ccfonts', 'ccfonts.ins', + 'dotseqn', 'dotseqn.dtx', + 'feynmf', 'feynmf.ins', + 'floatrow', 'floatrow.ins', + 'iso', 'alliso.ins', + 'lettre', 'NULL', + 'localloc', 'localloc.dtx', + 'makecell', 'makecell.dtx', + 'paper', 'install.02', + 'parrun', 'parrun.ins', + 'stmaryrd', 'stmaryrd.dtx', + 'thesis', 'install.01|install.ndx', + 'tugboat', 'tugboat.ins', +); +$standardins='\.ins'; + +%specialinsrunner = ( +); +$standardinsrunner="latex"; + +%specialmakeindex= ( +); +$standardmakeindex='\.ist'; + + +# packages which need special .tex/.sty files installed +$standardtex='\.cfg|\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$'; +%specialtex= ( + 'abbr', '\.tex', + 'ae', '\.fd$|\.sty', + 'arabtex', '\.clo|\.cls|\.sty|\.tex', + 'babel', 'b.*plain.tex|\.ldf|\.ltx|\.cfg|\.sty|\.clo|\.cls|\.def|\.fd$', + 'babelbib', '\.bdf|\.sty', + 'bardiag', '\.bar|\.sty|\.cfg', + 'barr', 'diagram.tex', + 'base', 'idx.tex|lablst.tex|latexbug.tex|lablst.tex|docstrip.tex|nfssfont.tex|sample2e.tex|small2e.tex|testpage.tex|ltxcheck.tex|\.cfg|\.fd$|\.cls|\.clo|\.ltx|\.sty|\.def|^\.', + 'breqn', '\.sty|\.sym', + 'calxxxx', 'cal.*\.tex', + 'carlisle', '\.sty|\.ltx', + 'cirth', 'num\.tex', + 'cmap', '\.sty|\.cmap', + 'codepage', '\.sty|\.tex', + 'contour', '\.cfg|\.sty|\.cnt', + 'ctib', '\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$|ctib\.tex', + 'custbib', '\.mbs|\.tex', + 'custom-bib', '\.mbs|\.tex', + 'cyrillic', '\.tex|\.sty|\.fd$|\.def', + 'dialogl', '\.sty|listouti\.tex', + 'ean', 'ean[0-9]*\.tex', + 'edmac', 'edmac.tex|edstanza.tex|\.sty', + 'epsf', 'epsf.(tex|sty)', + 'esint-type1', 'esint.tex', + 'europecv', 'EuropeFlag|europasslogo|\.cls|\.def', + 'fltpoint', '\.sty|\.tex', + 'footnpag', 'footnpag\.sty', + 'genmisc', '\.sty|\.tex', + 'ginpenc', '\.gie|\.sty', + 'hfoldsty', '\.sty|\.fd|\.cpa', + 'hyper', '\.sty|\.hyp', + 'insbox', 'insbox.tex', + 'iso10303', 'a.*tex|b.*tex|e.*tex|stp.*tex|\.sty|\.4ht', + 'isodate', '\.idf|\.sty', + 'jadetex', '\.ltx|\.def|\.tex|\.ini|\.sty', + 'karnaugh', 'kvmacros.tex', + 'keystroke', 'keystroke_.*|\.sty', + 'kuvio', '\.tex|\.sty', + 'lettre', '\.ins|\.cls', + 'lettrine', '\.sty|\.cfl|\.cfg', + 'manjutex', '\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$|manju.tex', + 'metatex', 'metatex.tex', + 'mff', '\.sty|mf[^f].*\.tex', + 'mfpic', 'mfpic.tex', + 'mh', '\.sty|\.cls|\.fix', + 'minitoc', '\.sty|\.mld', + 'misc', '\.sty|\.ltx|\.cls', + 'nag', '\.nag', + 'ntheorem', '\.sty|\.std', + 'ofs', '^ofs\.tex|ofsdef\.tex|ofs-.*\.tex|\.sty|a.*\.tex|.*fn\.tex', + 'patch', '\.tex', + 'pdf-trans', 'pdf-trans.tex', + 'pdfcprot', '\.cpa|\.sty', + 'pdfscreen', 'overlay.*pdf|but.*pdf|left.*pdf|right\.pdf|pdfscreen.sty', + 'pdfslide', '\.jpg|\.sty|\.clo|\.cfg|meta.*\.pdf', + 'petri-nets', 'pnets\.tex|pntext\.tex|\.sty|pndraw\.tex|pnversion\.tex|\.sty|pndraw\.tex', + 'pictex', '\.sty|\.tex', + 'plgraph', '\.tex', + 'plnfss', '\.tex|\.pfd', + 'powerdot', "$standardtex|\.ps", + 'ppchtex', 'm.*tex|m.*sty', + 'prosper', '\.ps|\.eps|\.sty|\.cls', + 'pstricks', 'pst-*\.tex', + 'qobitree', 'qobitree.tex', + 'realcalc', 'realcalc.tex', + 'revtex', '\.sty|\.cls|\.rtx', + 'rlepsf', 'rlepsf.tex', + 'seminar', '\.bug|\.bg2|\.cls|\.sty|2up.tex', + 'startex', '\.tex', + 'syntax', 'syntax\.tex', + 'tabvar', '\.sty|\.cfg|\.[0-9]', + 'taylor', 'diagrams.tex', + 'texsis', '\.txs|TXS.*tex|texsis.tex', + 'thumbpdf', '\.tex|\.sty', + 'ticket', '\.tex|\.tdf', + 'titlesec', '\.tss|\.sty|ttlhref.tex|\.def', + 'tools', '\.cfg|\.sty|\.clo|\.cls|\.def|\.fd$|.?\.tex|^\.tex$', + 'vhistory', '\.sty', # not hyperref.cfg + 'wasy2', 'wasyfont\.tex', + 'wordcount', '\.tex', + 'xkeyval', '\.sty|\.def|\.tex', + 'zefonts', '\.sty|\.fd', +); + + +# packages which need special documentation files run +%specialdvi= ( + 'aastex', 'NULL', + 'abstyles', 'NULL', + 'abbr', 'NULL', + 'aguplus', 'NULL', + 'antomega', 'NULL', + 'apl', 'NULL', + 'arabtex', 'NULL', + 'archaic', 'NULL', + 'arev', 'NULL', + 'autotab', 'NULL', + 'babel', 'babel\.drv', + 'barcode2', 'eandoc.tex', + 'bardiag', 'bar.*tex', + 'barr', 'diagdoc.tex', + 'base', '.*info.tex|.*guide.*tex|.*news.*tex', + 'bbding', 'NULL', + 'blacklettert1','\.dtx', + 'calendar', 'demo.*\.tex|calguide\.tex', + 'calxxxx', 'NULL', + 'caption', 'NULL', + 'carlisle', '\.dtx|ltxtable.tex', + 'cbcoptic', 'NULL', # needs coptic fonts + hyphenation + 'changebar', 'NULL', + 'chess', '\.ltx', + 'circ', '\.dtx', + 'cirth', 'cirth\.tex', + 'cjw', 'NULL', + 'clock', 'NULL', + 'cmcyralt', 'NULL', + 'computational-complexity', 'NULL', + 'codepage', 'codepage\.drv', + 'crop', 'crop.dtx', + 'crosswrd', 'NULL', + 'ctib', 'ctib4tex.tex', + 'curve', 'cv.tex', + 'custbib', '\.dtx', + 'custom-bib', '\.dtx', + 'cyrillic', 'NULL', + 'dates', 'NULL', + 'dialogl', 'dia-driv\.tex|codialog\.tex', + 'dinbrief', '\.drv|din.*tex', + 'dingbat', 'NULL', + 'directory', '\.tex', + 'dotseqn', 'NULL', + 'edmac', 'NULL', + 'eepic', 'eepic.tex', + 'elhyphen', 'NULL', # greek hyphenation + 'emp', 'NULL', + 'esint-type1', 'NULL', # already provided + 'ethiop', 'ethiodoc\.tex', + 'euro', 'euro.dtx', + 'exams', 'NULL', + 'fancynum', 'examples.tex', + 'feynmf', 'NULL', + 'fltpoint', 'NULL', + 'footnpag', 'NULL', + 'fourier', 'NULL', + 'fp', 'example.tex', + 'frcursive', '.*\.dtx', + 'gatech-thesis', 'gatech-thesis.tex|jules-verne.tex', + 'genmisc', 'NULL', + 'german', 'germdoc\.tex', + 'glossary', 'NULL', + 'hh', 'NULL', + 'ibycus-babel','NULL', # needs special hyphenation + 'indxcite', 'NULL', + 'insbox', 'demo.tex', + 'iso', 'layman.tex', + 'iso10303', 'NULL', + 'isostds', 'isosty.tex', + 'jadetex', 'NULL', + 'jurabib', 'jbtest.tex', + 'karnaugh', 'kvdoc\.tex', + 'latexmp', 'NULL', + 'ledmac', 'NULL', + 'ledpar', 'NULL', + 'lettrine', 'NULL', + 'levy', 'NULL', + 'lfb', 'NULL', + 'lgreek', 'NULL', + 'manjutex', 'manjutex.tex', + 'mapcodes', 'mapcode\.drv', + 'maple', 'NULL', + 'mdwtools', 'NULL', + 'metatex', 'NULL', + 'mff', 'mffdoc.tex', + 'mfnfss', 'NULL', + 'mfpic', 'mfpicdoc.tex', + 'midnight', '\.doc', + 'minutes', 'Sample.tex', + 'natbib', 'natbib.dtx|natnotes.tex', + 'newlfm', 'NULL', + 'ocherokee', 'NULL', + 'ofs', 'ofsdoc-e\.tex|ofsdoc\.tex|ofs-slt\.tex', + 'ogonek', 'togonek\.ltx|\.tex', + 'ot2cyr', 'OT2.*tex', + 'othello', 'othello\.tex', + 'otibet', 'NULL', + 'paper', 'paper.drv', + 'parrun', 'parrun.dtx', + 'passivetex', 'NULL', + 'patch', 'NULL', + 'pdfscreen', 'NULL', + 'petri-nets', 'pndoc\.tex', + 'pictex', 'NULL', + 'plgraph', 'NULL', + 'plnfss', 'NULL', + 'poligraf', 'NULL', + 'powerdot', 'NULL', + 'ppchtex', 'NULL', + 'prosper', 'pros.*tex', + 'pst-3dplot', '.*-e\.tex|doc-.*.tex|pst-3dplot-doc', + 'pst-bar', '.*-e\.tex|doc-.*.tex|pst-bar-doc.tex', + 'pst-barcode', 'NULL', # showexpl.sty? + 'pst-blur', '.*-e\.tex|doc-.*.tex|pst-blur-doc.tex', + 'pst-circ', '.*-e\.tex|doc-.*.tex|pst-circ-doc.tex', + 'pst-fr3d', 'doc-.*.tex|pst-fr3d-doc', + 'pst-func', '.*-e\.tex|doc-.*.tex|pst-func-doc', + 'pst-geo', '.*-e\.tex|doc-.*.tex|pst-geo-doc.tex', + 'pst-ghsb', '.*-e\.tex|doc-.*.tex|pst-ghsb-doc.tex', + 'pst-gr3d', '.*-e\.tex|doc-.*.tex|pst-gr3d-doc.tex', + 'pst-jftree', '.*-e\.tex|doc-.*.tex|pst-jftree-doc.tex', + 'pst-lens', '.*-e\.tex|doc-.*.tex|pst-lens-doc.tex', + 'pst-light3d', '.*-e\.tex|doc-.*.tex|pst-light3d-doc', + 'pst-math', '.*-e\.tex|doc-.*.tex|pst-math-doc.tex', + 'pst-optic', '.*-e\.tex|doc-.*.tex|pst-optic-doc.tex', + 'pst-osci', '.*-e\.tex|doc-.*.tex|pst-osci-doc.tex', + 'pst-poly', '.*-e\.tex|doc-.*.tex|pst-poly-doc.tex', + 'pst-slpe', '.*-e\.tex|doc-.*.tex|pst-slpe-doc.tex', + 'pst-uml', '.*-e\.tex|doc[-_].*.tex|pst-uml-doc.tex', + 'pst-vue3d', '.*-e\.tex|doc-.*.tex|pst-vue3d-doc.tex', + 'qobitree', 'example\.tex', + 'qsymbols', 'NULL', + 'r_und_s', 'NULL', + 'rcsinfo', 'rcsinfo2html.tex', + 'refman', 'layout.tex|\.dtx', + 'rlepsf', 'NULL', + 'semaphor', 'example.tex', + 'skak', 'skakdoc.tex', + 'songbook', 'sample-sb.tex', + 'soul', 'soul.dtx', + 'startex', 'NULL', + 'syntax', 'syntax[a-z].*\.tex', + 'taylor', 'NULL', + 'texpower', 'manual\.tex', + 'texsis', 'Manual.tex', + 'textmerg', 'tmexamp[[0-9]\.tex', + 'thesis', '\.drv', + 'thumbpdf', 'NULL', + 'timing', 'timing.tex', + 'tipa', 'tipaman\.tex|tipatug\.tex', + 'titlesec', 'titlesec.tex', + 'tools', '\.dtx', + 'totpages', 'NULL', + 'umrand', 'umrand\.tex', + 'universa', 'NULL', + 'velthuis', 'manual.tex', + 'vhistory', 'NULL', + 'wasy2', 'wasydoc\.tex', + 'wordcount', 'NULL', + 'xkeyval', 'NULL', + 'xymtex', 'xymtx200.tex', + 'yfonts', 'NULL', + 'youngtab', 'NULL', + 'zefonts', 'zefonts.tex', +); + +#$standarddvi='\.tex|\.ltx'; +$standarddvi='NULL'; # let's try relying on authors uploading pdf's. + + +# packages which need special Metapost files +%specialmp= ( + 'feynmp', 'feynmp.mp', + 'latexmp', 'latexmp.mp', + 'mpattern', 'mpattern.mp', # don't install test.mp + 'semioneside', 'NULL', # don't install figure*.map +); +$standardmp='\.mp$'; + +# packages which need special BibTeX styles installed +%specialcsf= ( +); +$standardcsf='\.csf'; + +%specialbst= ( +); +$standardbst='\.bst'; + +# packages which need special BibTeX data files (not) installed. +%specialbib= ( + 'aguplus', 'NULL', + 'doipubmed', 'NULL', + 'eplain', 'NULL', + 'mslapa', 'NULL', + 'ucthesis', 'NULL', +); +$standardbib='\.bib$'; # $ so we don't find README.bibtex in IEEEtran + +# packages which have Metafont sources to compile +%specialmf= ( + 'astro', 'astro.mf', + 'backgammon', 'bg\.mf', + 'cherokee', 'cherokee.mf', + 'circ', 'csybimos\.mf|csycirc\.mf|csydiod\.mf|csyrest\.mf|csywidko\.mf|csysym\.mf|optic\.mf', + 'cirth', 'cir.*\.mf', + 'cmpica', 'cmpic.*\.mf', + 'dancers', 'dancers\.mf', + 'dice', 'dice3d\.mf', + 'dingbat', '\.mf', + 'eiad', 'e.*10\.mf', + 'engwar', 'engwar\.mf', + 'ethiop', 'NULL', + 'euro-ce', 'eu.*\.mf|ce.*\.mf', + 'feynmf', 'feynmf\.mf', + 'greenpoint', 'greenpoint\.mf', + 'hands', 'hands\.mf', + 'ibygrk', 'NULL', + 'ifsym', '\.mf|\.gen', + 'logic', 'milstd\.mf', + 'mfpic', 'grafbase\.mf', + 'morse', 'morse10.mf|morse.def', + 'ogham', 'ogham\.mf', + 'skak', 'skak.*[0-9].*\.mf', + 'tengwar', 'tengwar\.mf', + 'umrand', 'umrand[ab]\.mf', +); +$standardmf='[0-9]\.mf'; + +# packages which have dvips header files +%specialpro= ( + 'carlisle', 'pspicture.ps', + 'esint-type1', 'config.esint', + 'zefonts', 'slantcm.cfg', +); +$standardmap='\.map'; +$standardvmap='\.ali'; +$standardenc='\.enc'; +$standardpro='\.pro'; +$standardafm='\.afm'; +$standardpfm='\.pfm'; +%specialafm= (); +%specialpfm= (); +$standardpfb='\.pfb|\.inf'; +%specialpfb= (); + +$standardovf='\.ovf'; +%specialovf= (); + +$standardofm='\.ofm'; +%specialofm= (); + +$standardovp='\.ovp'; +%specialovp= ( 'psfragx', 'NULL', ); + +$standardotp='\.otp'; +%specialotp= (); + +$standardocp='\.ocp'; +%specialocp= (); + +# packages which have xmltex files +%specialxmt= ( + 'passivetex', '\.xmt|fotex.sty', +); +$standardxmt='\.xmt'; + +# which suffixes to remove after building +$cleanpatt='\.head|\.tmp|\.dvi|\.log|\.out|\.aux|\.toc|\.lof|\.lot|\.bbl|\.blg|\.idx|\.ind|\.ilg|\.glo|\.gls|\.loa'; + +# command line options +$opt_debug = 1; # verbosity is good? +$result = GetOptions ( +"debug!", +"test!" + ); + +if ($result eq 0 ) { + die ("OPTION FAILURE"); +} + +# +for (@ARGV) { + $packagedir=$_; + if (! -d $packagedir) { + warn "$0: $packagedir not a directory, skipping.\n"; + next; + } + + @x=split(/\//,$packagedir); + $package=pop(@x); + $dest=$specialdest{$package} || "texmf-dist"; + + $TOPDEST="$TDS/$package"; + $DEST="$TOPDEST/$dest"; + + my $MAKE=0; + if (-f "$packagedir/Makefile") { + open(X,"$packagedir/Makefile"); + while (<>) { + if (/^texlive:/) {$MAKE=1;} + } + close(X); + + } + if ($MAKE) { + &SYSTEM("cd $packagedir; make -f Makefile texlive; mkdir -p $DEST; mv texmf/* $DEST)"); + print "Package $packagedir has a TeXlive-aware Makefile. Make and send to $DEST\n"; +} +else +{ + + $insrunner=$specialinsrunner{$package}; + if ($insrunner eq "") { $insrunner=$standardinsrunner; } + + $whichformat = $specialfmt{$package} || $standardfmt; + $whichdocformat = $specialdocfmt{$package} + || ($dest eq "texmf-doc" ? "english" : $standarddocfmt); + + print "\n----------------------------------\n"; + print "<$whichformat> <$whichdocformat> $packagedir ($package) -> $DEST\n"; + if ($special{$package} ne "") { + eval $special{$package}; + die "failure in $special{$package} (for $package): $@" if $@; + } + else + { + &donormal; + } + +} + chdir($startdir); + +} + + + +# some packages (e.g., vntex) are tl-ready. +# +sub MAKEcopy { + my $dest = $_[0] || $DEST; + + chdir($packagedir) || die "chdir($packagedir) failed: $!"; + &SYSTEM("mkdir -p $dest"); + + # do the copy. + &SYSTEM("$CP -r * $dest"); + + # remove symlinks, needed for arev. + &SYSTEM("find $dest -type l | xargs --no-run-if-empty rm"); + + # remove top-level README (shouldn't overwrite texmf-dist/README), + # needed for vntex, pgf, probably others. + -f "$dest/README" && unlink ("$dest/README"); +} + + +# +# For most packages, this is the first thing called. +# +sub setup { + my ($ctl) = @_; + + # precreate the directories we might need + $DOCDIR = "$DEST/doc/$whichdocformat/$package"; + &SYSTEM("mkdir -p $DOCDIR"); + &SYSTEM("mkdir -p $DEST/tex/$whichformat/$package"); + &SYSTEM("mkdir -p $DEST/source/$whichdocformat/$package"); + + # junk we don't ever want. + unlink ("$packagedir/00Contents"); + + return if $ctl eq "nocopytodoc"; + # copy everything to the doc directory + # and work in there + &SYSTEM("$CP -r $packagedir/* $DEST/doc/$whichdocformat/$package"); +} + +sub donormal { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &buildfilelist; +# run the .ins files (if any) supplied + $inspatt = $specialins{$package }; + if ($inspatt eq "") { + $inspatt=$standardins; + } + $Foundry = $specialfoundry{$package }; + if ($Foundry eq "") { + $Foundry=$standardfoundry; + } + &runins($inspatt); +# rebuild the list of files in the directory + &buildfilelist; + &domf; + &dodvi; +# rebuild again, as we have .dvi files now + &buildfilelist; + &dobst; + &domp; + &dobib; + &doxmt; + &dotex; + &runfonts; + &domakeindex; + &doomega; + &dosource; + &dotype1; +# +# this is a bit weird, but its an easy way to remove +# empty directories that we never used. +# + &SYSTEM("rmdir $DEST/tex/$whichformat/$package 2> /dev/null"); + &SYSTEM("rmdir $DEST/source/$whichformat/$package 2> /dev/null"); + &SYSTEM("rmdir $DEST/doc/$whichdocformat/$package 2> /dev/null"); + killfiles($cleanpatt); +} +#================================================================= +# +# running .ins files usually works with LaTeX, but plain +# tex is needed sometimes - textmerg at least doesnt work with LaTeX. +# how to deal with that? +# +sub runins { + local($thispatt) = @_; + print "\t RUNINS $thispatt\n"; + for (grep(/$thispatt/,@filenames)) { + print "\t RUN $_\n" ; + &runjob("yes | $insrunner $_"); + } +} +sub install { + local($destdir,$thispatt) = @_; + print "\t INSTALL $thispatt to $destdir\n"; + for (grep(/$thispatt/,@filenames)) { + if (! -d $destdir) { &SYSTEM("mkdir -p $destdir") } + #print "\t\t Move $_ to $destdir\n"; + &SYSTEM("$MV $_ $destdir"); + } +} +sub dodvi { +# build the documentation files + $dvipatt = $specialdvi{$package }; + # packages which are doc themselves rarely rebuild cleanly, + # and aren't worth it. + $dvipatt = "NULL" if $specialdest{$package} eq "texmf-doc"; + if ($dvipatt eq "") { $dvipatt=$standarddvi; } + &rundvi($dvipatt); +} + +sub domakeindex { +# move the makeindex runtime files + $makeindexpatt = $specialmakeindex{$package }; + if ($makeindexpatt eq "") { $makeindexpatt=$standardmakeindex; } + &install("$DEST/makeindex/$package",$makeindexpatt); +} + +sub dotex { +# move the runtime files + $texpatt = $specialtex{$package }; + if ($texpatt eq "") { $texpatt=$standardtex; } + &install("$DEST/tex/$whichformat/$package",$texpatt); +} + + +sub dobst { +# there may be some BibTeX style files + $csfpatt = $specialcsf{$package }; + if ($csfpatt eq "") { $csfpatt=$standardcsf; } + &install("$DEST/bibtex/csf/$package",$csfpatt); + $bstpatt = $specialbst{$package }; + if ($bstpatt eq "") { $bstpatt=$standardbst; } + &install("$DEST/bibtex/bst/$package",$bstpatt); +} + +sub dosimplemf { +# there may be some simple MF files + $mfpatt = $specialmf{$package }; + if ($mfpatt eq "") { $mfpatt=$standardmf; } + &install("$DEST/metafont/$package",$mfpatt); +} +sub domp { +# there may be some Metapost files + $mppatt = $specialmp{$package }; + if ($mppatt eq "") { $mppatt=$standardmp; } + &install("$DEST/metapost/$package",$mppatt); +} + +sub dobib{ +# and some BibTeX bibliography files + $bibpatt = $specialbib{$package }; + if ($bibpatt eq "") { $bibpatt=$standardbib; } + &install("$DEST/bibtex/bib/$package",$bibpatt); +} + +sub dosource{ +# now the source: + $sourceformat = $specialsourcefmt{$package }; + if ($sourceformat eq "") { $sourceformat=$standardsourcefmt; } + # default to using specialdocfmt, as we do in setup? + $sourcepatt = $specialsource{$package }; + if ($sourcepatt eq "") { $sourcepatt=$standardsource; } + &install("$DEST/source/$sourceformat/$package",$sourcepatt); +} + + +sub doomega{ + $ovfpatt = $specialovf{$package }; + if ($ovfpatt eq "") { $ovfpatt=$standardovf; } + &install("$DEST/fonts/ovf/public/$package",$ovfpatt); + $ofmpatt = $specialofm{$package }; + if ($ofmpatt eq "") { $ofmpatt=$standardofm; } + &install("$DEST/fonts/ofm/public/$package",$ofmpatt); + $ovppatt = $specialovp{$package }; + if ($ovppatt eq "") { $ovppatt=$standardovp; } + &install("$DEST/fonts/ovp/public/$package",$ovppatt); + $otppatt = $specialotp{$package }; + if ($otppatt eq "") { $otppatt=$standardotp; } + &install("$DEST/omega/otp/$package",$otppatt); + $ocppatt = $specialocp{$package }; + if ($ocppatt eq "") { $ocppatt=$standardocp; } + &install("$DEST/omega/ocp/$package",$ocppatt); +} + +sub dotype1{ +# now the dvips and font mapping files: + $encpatt = $specialenc{$package }; + if ($encpatt eq "") { $encpatt=$standardenc; } + &install("$DEST/fonts/enc/dvips/$package",$encpatt); + $mappatt = $specialmap{$package }; + if ($mappatt eq "") { $mappatt=$standardmap; } + &install("$DEST/fonts/map/dvips/$package",$mappatt); + + $vmappatt = $specialvmap{$package }; + if ($vmappatt eq "") { $vmappatt=$standardvmap; } + &install("$DEST/fonts/map/vtex/$package",$vmappatt); + + $propatt = $specialpro{$package }; + if ($propatt eq "") { $propatt=$standardpro; } + &install("$DEST/dvips/$package",$propatt); + $pfbpatt = $specialpfb{$package }; + if ($pfbpatt eq "") { $pfbpatt=$standardpfb; } + &install("$DEST/fonts/type1/public/$package",$pfbpatt); + $afmpatt = $specialafm{$package }; + if ($afmpatt eq "") { $afmpatt=$standardafm; } + &install("$DEST/fonts/afm/public/$package",$afmpatt); + $pfmpatt = $specialpfm{$package }; + if ($pfmpatt eq "") { $pfmpatt=$standardpfm; } + &install("$DEST/fonts/type1/public/$package",$pfmpatt); +} + +sub doxmt{ +# now the xmltex files: + $xmtpatt = $specialxmt{$package }; + if ($xmtpatt eq "") { $xmtpatt=$standardxmt; } + &install("$DEST/tex/xmltex/$package",$xmtpatt); +} + +sub domf { +# build the font files + $mfpatt = $specialmf{$package}; + if ($mfpatt eq "") { $mfpatt=$standardmf; } + &runmf($mfpatt); +} + +sub rundvi { + local($thispatt) = @_; + $TEX = $specialTEX{$package }; + if ($TEX eq "") { + if ($whichformat eq 'latex') { $TEX="pdflatex"; } + else { $TEX=$whichformat; } + } + if ($TEX eq "generic") { $TEX="pdflatex"; } + print "\t MAKEDVI $thispatt, $TEX, @filenames\n"; + for (grep(/$thispatt/,@filenames)) { + ($FileBase,$Filepath,$Filesuffix) = fileparse($_,"\.[A-z]*"); + print "found $FileBase\n"; + if (-r "$FileBase.drv" && $Filesuffix eq ".dtx" ) + { $Filesuffix=".drv" ; } + print "\t DOC: run $TEX on $FileBase$Filesuffix\n"; + open(TMP,">$FileBase.aux"); + close(TMP); + &runjob("TEXMFLOCAL=. $TEX '\\nonstopmode\\input $FileBase$Filesuffix'"); + &runjob("bibtex $FileBase"); + &runjob("TEXMFLOCAL=. $TEX '\\nonstopmode\\input $FileBase$Filesuffix'"); + if ($Filesuffix eq ".drv" || $Filesuffix eq ".dtx" ) { + &runjob("$CP $startdir/gind.ist ."); + &runjob("makeindex -s gind.ist $FileBase"); + unlink "gind.ist"; + } else { + &runjob("makeindex $FileBase"); + } + &runjob("$TEX '\\nonstopmode\\input $FileBase$Filesuffix'"); + } + print "DVI over\n"; +} +# +# run a &SYSTEM job, and append stderr output to log file +# +sub runjob { + local($job) = @_; + if ($opt_test) { print "RUNJOB $job\n"} + else{ + $Jobid="_$$"; + &SYSTEM("$job 2> $Jobid.log"); + open(TMP,"$Jobid.log") || die("Failed to open $Jobid.log") ; + print ">> $_" while (<TMP>); + close(TMP); + unlink "$Jobid.log"; + } +} + +# +# remove all files corresponding to a pattern +# +sub killfiles { + local($killpatt) = @_; + for (grep(/$killpatt/,@filenames)) { + print "\t Remove $_\n"; + unlink $_; + } +} + +# rebuild list of files +sub buildfilelist { + opendir(DIR,'.') || die ("ERROR: cannot open directory"); + @filenames =grep(!/^\.\.?$/,readdir(DIR)); + closedir(DIR); + print " [list rebuilt]\n"; +} + +sub runmf { + local($mfpatt) = @_; + $needdir=1; + print "\t Make fonts for $package ($mfpatt)\n"; + for (grep(/$mfpatt/,@filenames)) { + $needdir=1; + print "\t\t Make TFM from $_\n"; + ($FileBase,$Filepath,$Filesuffix) = fileparse($_,"\.[A-z]*"); + if (-e "$FileBase.tfm") { } + else { + &runjob("mktextfm --destdir=`pwd` $FileBase.tfm"); + } + } + &SYSTEM("mkdir -p $DEST/fonts/source/$Foundry/$package"); + &runjob("$MV *.mf $DEST/fonts/source/$Foundry/$package"); + &SYSTEM("rm -f *pk"); # not worth the space +} + +sub runfonts { + for (grep(/.vf/,@filenames)) { + $needdir=1; + print "\t\t install VF $_\n"; +($FileBase,$Filepath,$Filesuffix) = fileparse($_,"\.[A-z]*"); + if ($needdir) { + &SYSTEM("mkdir -p $DEST/fonts/vf/$Foundry/$package"); + $needdir=0; + } + &SYSTEM("$MV $FileBase.vf $DEST/fonts/vf/$Foundry/$package "); + } + for (grep(/.tfm/,@filenames)) { + $needdir=1; + print "\t\t install TFM $_\n"; +($FileBase,$Filepath,$Filesuffix) = fileparse($_,"\.[A-z]*"); + if ($needdir) { + &SYSTEM("mkdir -p $DEST/fonts/tfm/$Foundry/$package"); + $needdir=0; + } + &SYSTEM("$MV $FileBase.tfm $DEST/fonts/tfm/$Foundry/$package "); + } +} + + +sub SYSTEM { + local ($job) = @_; + if ($opt_test) { + print "SYSTEM: $job\n"; + } else { + print "SYSTEM: $job\n" if $opt_debug; + system($job); + } +} + +sub MAKEflatten { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + + print "\t SPECIAL flatten $package\n"; + # so far we've only seen README's at one level. + &SYSTEM('for d in *; do test -r $d/README && mv $d/README README.$d; done'); + + &SYSTEM("$MV -f */*/*/*/* ."); + &SYSTEM("$MV -f */*/*/* ."); + &SYSTEM("$MV -f */*/*/* ."); + &SYSTEM("$MV -f */*/* ."); + &SYSTEM("$MV -f */*/* ."); + &SYSTEM("$MV -f */* ."); + &SYSTEM("find -type d -print | xargs rmdir 2>/dev/null"); + &buildfilelist; + &donormal; +} + +sub MAKEunzipandflatten { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &SYSTEM("unzip -o -a $package.zip; rm $package.zip"); + &SYSTEM("$MV */*/*/*/* .; rmdir */*/*/*"); + &SYSTEM("$MV */*/*/* .; rmdir */*/*"); + &SYSTEM("$MV */*/*/* .; rmdir */*/*"); + &SYSTEM("$MV */*/* .; rmdir */*"); + &SYSTEM("$MV */*/* .; rmdir */*"); + &SYSTEM("$MV */* .; rmdir *"); + &buildfilelist; + &donormal; +} + +sub MAKEnosymlinks { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + + print "\t SPECIAL nosymlinks $package\n"; + &SYSTEM("find . -type l | xargs rm"); + + # remove from lineno package, it's in the ltabptch package (which + # doesn't use this function). Told Uwe, hopefully he will fix. + &SYSTEM("rm -f ltabptch.sty"); + + &buildfilelist; + &donormal; +} + +# do some stuff for simple packages with hyphenation files, like +# cbcoptic and ibycus-babel. The arguments are: +# LANGNAME - full language name, like "coptic" (first arg of .dat) +# LANGABBREV - abbreviated language name, like "cop" (in .dat filename) +# HYPHFILE - hyphenation .tex file name, like "copthyph.tex" +# +# General procedure is: +# +# create: /home/karl/src/Master/texmf/tpm/hyphen-language.tpm +# (must be done by hand) +# create: texmf/tex/generic/config/language.ll.dat +# (done here, unless it already exists) +# install pattern file from ctan: texmf/tex/generic/hyphen/langhyph.tex +# (done here) +# add in: /home/karl/src/Master/texmf/tpm/collection-langother.tpm +# (must be done by hand) +# +sub GENMAKEhyphenation { + my ($langname,$langabbrev,$hyphfile) = @_; + &setup; + &buildfilelist; + &donormal; + print "\t SPECIAL $package: install $hyphfile\n"; + my $generichyphdir = "$TOPDEST/texmf/tex/generic/hyphen"; + &SYSTEM("mkdir -p $generichyphdir"); + &SYSTEM("$MV $hyphfile $generichyphdir"); + + my $genericconfigdir = "$TOPDEST/texmf/tex/generic/config"; + my $configfile = "$genericconfigdir/language.$langabbrev.dat"; + if (! -r $configfile) { + print "\t SPECIAL $package: create $configfile\n"; + &SYSTEM("mkdir -p $genericconfigdir"); + &SYSTEM("echo $langname $hyphfile >$configfile"); + } + + print "\t YOU-MUST-DO $package: create texmf/tpm/hyphen-$langname.tpm\n"; + print "\t YOU-MUST-DO $package: add to texmf/tpm/collection-langsomething.tpm\n"; +} + +sub MAKEcbcoptic { + &GENMAKEhyphenation ("coptic", "cop", "copthyph.tex"); +} + +sub MAKEibycusbabel { + &GENMAKEhyphenation ("ibycus", "iby", "ibyhyph.tex"); +} + + + +# package subroutines +sub MAKEbabel { + &setup; + &buildfilelist; + &donormal; + print "\t SPECIAL remove old lahyph.tex\n"; # since braams hasn't + &SYSTEM("rm -f $DEST/doc/generic/$package/lahyph.tex"); + my $files = "icehyph.tex iahyphen.tex " . + "bghyphen.tex bghyphsi.tex catmik.tex mik2t2.tex"; + print "\t SPECIAL move to /tmp: $files\n"; # since not separate on CTAN + &SYSTEM("cd $DEST/doc/generic/$package && mv $files /tmp"); + print "\t YOU-MUST-DO check against texmf/tex/generic/hyphen\n"; + print "\t YOU-MUST-DO and texmf-dist/tex/generic/bghyph: $files\n"; +} + +sub MAKEbbm { + &setup; + chdir("$DEST/doc/latex/$package/fonts"); + &buildfilelist; + &domf; + chdir("$DEST/doc/latex/$package"); + &buildfilelist; + &donormal; +} + +sub MAKEmflogo{ + &setup; + chdir("$DEST"); + &runjob("tar xvf $DEST/doc/latex/$package/logofont.tar"); + chdir("$DEST/doc/latex/$package"); + &donormal; + } + +sub MAKEfp { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &runjob("mkdir -p $DEST/tex/plain/fp; $CP fp.tex $DEST/tex/plain/fp"); + &donormal; +} + + +sub MAKEhyperref { + &setup; + chdir("$DEST/doc/latex/$package"); + &SYSTEM("$MV doc/* ../../../doc/latex/$package"); + &SYSTEM("rmdir doc"); + &buildfilelist; + &donormal; +} + +sub MAKExymtex { + &setup; + chdir("$DEST/doc/latex/$package"); + &SYSTEM("$MV doc200/* ."); + &SYSTEM("rmdir doc"); + &buildfilelist; + &donormal; +} + +# handle mpp script a la perltex. +sub MAKEmpattern { + &setup; + &buildfilelist; + &donormal; + print "\t SPECIAL move mpp from doc to /tmp\n"; + &SYSTEM("$MV $DEST/doc/metapost/$package/mpp /tmp"); + &SYSTEM("chmod a+x /tmp/mpp"); + print "\t YOU-MUST-DO update mpp to source/.../texlive/\n"; +} + +sub MAKEpbdiagram { + &setup; + chdir("$DEST/doc/latex/$package"); + &SYSTEM("rm -rf mf tfm"); + &buildfilelist; + &donormal; +} + +# the perltex.pl generated from perltex.dtx must go to the source dir, +# so it ends up installed in the bin dir for each arch. +sub MAKEperltex { + &setup; + &buildfilelist; + &donormal; + print "\t SPECIAL move $package.pl from doc to /tmp\n"; + &SYSTEM("$MV $DEST/doc/latex/$package/$package.pl /tmp"); + &SYSTEM("chmod a+x /tmp/$package.pl"); + print "\t YOU-MUST-DO update $package.pl to source/.../texlive/\n"; +} + +# pgf mostly is just a copy to the tex dir, but Till has a doc dir at +# the same level. +# +sub MAKEpgf +{ + print "\t SPECIAL pgf\n"; + &MAKEcopy ("$DEST/tex"); + chdir ("$DEST/tex") || die "chdir($DEST/tex) failed: $!"; + + print "\t SPECIAL move tex/doc/pgf to doc/generic/pgf\n"; + &SYSTEM ("mkdir -p $DEST/doc/generic"); + &SYSTEM ("$MV doc/pgf $DEST/doc/generic/pgf"); +} + + +# copy seminar files. +sub MAKEseminar { + &SYSTEM("mkdir -p $DEST/tex/latex/$package"); + &SYSTEM("$CP $packagedir/inputs/* $DEST/tex/latex/$package"); + # + &SYSTEM("mkdir -p $DEST/source/latex/$package"); + &SYSTEM("$CP $packagedir/src/* $DEST/doc/latex/$package"); + # + &SYSTEM("mkdir -p $DEST/doc/latex/$package"); + &SYSTEM("$CP $packagedir/*read* $packagedir/doc/* $DEST/doc/latex/$package"); +} + +sub MAKExypic { +# this simply copies source files as per INSTALL instructions + chdir($packagedir) || die ("ERROR: cannot open directory"); + &runjob("mkdir -p $DEST/fonts/source/$Foundry/xypic"); + &runjob("mkdir -p $DEST/fonts/type1/$Foundry/xypic"); + &runjob("mkdir -p $DEST/fonts/tfm/$Foundry/xypic"); + &runjob("mkdir -p $DEST/fonts/pk/cx/$Foundry/xypic"); + &runjob("mkdir -p $DEST/tex/generic/xypic"); + &runjob("mkdir -p $DEST/dvips/xypic"); + &runjob("mkdir -p $DEST/doc/generic/xypic"); + &runjob("mkdir -p $DEST/source/generic/xypic"); + &runjob("$CP texinputs/* $DEST/tex/generic/xypic"); + &runjob("$CP texfonts/* $DEST/fonts/tfm/$Foundry/xypic"); + &runjob("$CP mfinputs/* $DEST/fonts/source/$Foundry/xypic"); + &runjob("$CP src/* $DEST/doc/generic/xypic"); + &runjob("$CP type1/* $DEST/fonts/type1/$Foundry/xypic"); + &runjob("$CP ps/* $DEST/dvips/xypic"); + &runjob("$CP doc/*.* $DEST/doc/generic/xypic"); + &runjob("$CP [A-Z]* $DEST/doc/generic/xypic"); + open (TMP,">$DEST/texmf-dist/dvips/xypic/config.xyp"); + print TMP "p +xypic.map"; + close(TMP); +# do the PK files + chdir("pkfonts"); + &buildfilelist; + for (@filenames) { + if (-d $_) { + chdir $_; + s/cx([0-9]*)//; + $dpi=$1; + opendir(DIR,'.'); + @ffontnames =grep(!/^\.\.?$/,readdir(DIR)); + closedir(DIR); + for (@ffontnames) { +($FileBase,$Filepath,$Filesuffix) = fileparse($_,"\.[A-z0-9]*"); + &SYSTEM("mkdir -p $DEST/fonts/pk/cx/$Foundry/xypic/dpi$dpi"); + &SYSTEM("$MV $_ $DEST/fonts/pk/cx/$Foundry/xypic/dpi$dpi/$FileBase.pk"); + } + chdir '..'; + } + } +} + + +sub MAKEkuvio { + &setup; + chdir("$DEST/doc/$whichdocformat/$package/arrsy"); + &buildfilelist; + &domf; + chdir("$DEST/doc/$whichdocformat/$package/doc-src"); + &SYSTEM("gunzip -c kuv-A4.tar.gz | tar xvf - "); + &SYSTEM("MFINPUTS=$DEST/fonts/source/$Foundry/$package:;export MFINPUTS; TEXINPUTS=..//:; export TEXINPUTS; tex tdwk-A4; dvips tdwk-A4 -o"); + &SYSTEM("$MV tdwk-A4.dvi $DEST/doc/$whichdocformat/$package/tdwk.dvi"); + &SYSTEM("$MV tdwk-A4.ps $DEST/doc/$whichdocformat/$package/tdwk.ps"); + chdir("$DEST/doc/$whichdocformat/$package"); + &SYSTEM("$MV examples-A4.ps $DEST/doc/$whichdocformat/$package/examples.ps"); + &SYSTEM("$MV arrsy/symbols.tex $DEST/doc/$whichdocformat/$package"); + &SYSTEM("$MV arrsy/arrsy.tex arrsy/arrsy.sty kuvio.* $DEST/tex/$whichformat/$package"); + &SYSTEM("rm examples.ps"); + } + +sub MAKEborceux { + &setup; + chdir("$DEST/doc/$whichdocformat/$package/user-guides"); + &SYSTEM("$MV -f * $DEST/doc/$whichdocformat/$package"); + chdir("$DEST/doc/$whichdocformat/$package/diagram"); + &SYSTEM("$MV -f * $DEST/tex/$whichformat/$package"); +} + +sub MAKEbarr { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &SYSTEM("rm *.zip"); + &buildfilelist; + &dodvi; +# rebuild again, as we have .dvi files now + &buildfilelist; + &domakeindex; + &dotex; + &dosource; +} + +sub MAKEconcmath { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &SYSTEM("$MV fonts/*/* ."); + &buildfilelist; + &domf; + &dodvi; +# rebuild again, as we have .dvi files now + &buildfilelist; + &domakeindex; + &dotex; + &dosource; +} +sub MAKEecc { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &SYSTEM("$MV tfm/* ."); + &SYSTEM("$MV src/* ."); + &SYSTEM("rmdir src tfm"); + &buildfilelist; + &domf; + &dodvi; +# rebuild again, as we have .dvi files now + &buildfilelist; + &dotex; + &domakeindex; + &dosource; +} + +sub MAKEplqx { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &SYSTEM("$MV tex/* ."); + &SYSTEM("$MV doc/* ."); + &SYSTEM("rmdir doc tex"); + &buildfilelist; + &donormal; +} + +sub MAKEaugie { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &SYSTEM("$MV dvips/* ."); + &SYSTEM("$MV tfm/* ."); + &SYSTEM("$MV afm/* ."); + &SYSTEM("$MV doc/* ."); + &SYSTEM("$MV vf/* ."); + &SYSTEM("$MV tex/* ."); + &SYSTEM("$MV type1/* ."); + &SYSTEM("rmdir type1 tex vf afm dvips doc tfm"); + &buildfilelist; + &donormal; +} +sub MAKEae { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &SYSTEM("$MV tfm/* ."); + &SYSTEM("$MV vf/* ."); + &SYSTEM("$MV src/* ."); + &SYSTEM("$MV tex/* ."); + &SYSTEM("rmdir tex vf src tfm"); + &buildfilelist; + &dosource; + &dotex; + &domakeindex; + &runfonts; +} + +sub MAKEdevanagr { + chdir ($packagedir) || die "chdir($packagedir) failed: $!"; + # + print "\t SPECIAL $package: renaming README files\n"; + &SYSTEM('for f in *; do test -r $f/README && mv $f/README README.$f; done'); + # + print "\t SPECIAL $package: renaming .c and .exe\n"; + &SYSTEM('mv bin/devnag.c bin/devnag.exe /tmp'); + # + print "\t SPECIAL $package: flatten\n"; + chdir (".."); + &MAKEflatten; + print "\t YOU-MUST-DO update /tmp/devnag.c and devnag.exe into Build\n"; +} + +sub MAKEeasy { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &SYSTEM("rm doc/*.ps"); + &SYSTEM("$MV doc/* $DEST/doc/$whichdocformat/$package"); + &buildfilelist; + &dodvi; +# rebuild again, as we have .dvi files now + &buildfilelist; + &dotex; + &domakeindex; + &dosource; +} + + + +sub MAKEfootnpag { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &SYSTEM("$MV src/* ."); + &buildfilelist; + &dodvi; +# rebuild again, as we have .dvi files now + &buildfilelist; + &dotex; + &domakeindex; + &dosource; +} + + +sub MAKEeplain { + print "\t SPECIAL $package\n"; + &setup; + chdir ($DEST) || die "chdir($DEST) failed: $!"; + rename ("tex/eplain/eplain", "tex/eplain/base"); + &SYSTEM ("$MV $DOCDIR/eplain.tex tex/eplain/base"); + &SYSTEM ("$MV $DOCDIR/btxmac.tex tex/eplain/base"); + &SYSTEM ("$MV $DOCDIR/arrow.tex tex/eplain/base"); + + &SYSTEM ("$MV $DOCDIR/doc doc/eplain/base"); + &SYSTEM ("$MV $DOCDIR/[A-L]* $DOCDIR/[M-Z]* doc/eplain/base/"); + unlink ("doc/eplain/base/texinfo.tex"); + + rename ("source/eplain/eplain", "source/eplain/base"); + &SYSTEM ("$MV $DOCDIR/* source/eplain/base"); + +} + +sub MAKEeqnarray { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); +open(TMP,">eqnarray.ins"); + print TMP "\\def\\batchfile{eqnarray.ins}\n"; +print TMP "\\input docstrip\n"; +print TMP " \\keepsilent\n"; +print TMP " \\generateFile{eqnarray.sty}f{\\from{eqnarray.dtx}{code}}\n"; +print TMP "\\end\n"; + close(TMP); + &buildfilelist; + &runins($standardins); + &dodvi; + &dotex; + &domakeindex; + &dosource; +} + +sub MAKEfeynmf { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &SYSTEM("gunzip manual.ps"); + &buildfilelist; + &runins('feynmf.ins'); + &buildfilelist; + &dosimplemf; + &dodvi; + &buildfilelist; + &domp; + &dotex; + &domakeindex; + &dosource; + killfiles($cleanpatt); +} + +sub MAKEchangebar { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &buildfilelist; + &donormal; +} + +sub MAKEot2cyr { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &buildfilelist; + &dodvi; + &buildfilelist; + &dotex; + &domakeindex; + &dosource; + &SYSTEM("mkdir -p $DEST/fonts/afm/monotype/timescyr"); + &SYSTEM("$MV mnt*.afm $DEST/fonts/afm/monotype/timescyr"); + &SYSTEM("mkdir -p $DEST/fonts/tfm/monotype/timescyr"); + &SYSTEM("$MV mnt*.tfm $DEST/fonts/tfm/monotype/timescyr"); + &SYSTEM("mkdir -p $DEST/fonts/vf/monotype/timescyr"); + &SYSTEM("$MV mnt*.vf $DEST/fonts/vf/monotype/timescyr"); + &SYSTEM("mkdir -p $DEST/fonts/tfm/bh/luccyr"); + &SYSTEM("$MV hl*.tfm ls*.tfm $DEST/fonts/tfm/bh/luccyr"); + &SYSTEM("mkdir -p $DEST/fonts/vf/bh/luccyr"); + &SYSTEM("$MV hl*.vf $DEST/fonts/vf/bh/luccyr"); + killfiles($cleanpatt); +} +sub MAKEsiam { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &buildfilelist; + &dodvi; + &buildfilelist; + &dobst; + &dotex; + &domakeindex; + &dosource; + &SYSTEM("mkdir -p $DEST/doc/plain/siam"); + &SYSTEM("mkdir -p $DEST/doc/amstex/siam"); + &SYSTEM("mkdir -p $DEST/tex/plain/siam"); + &SYSTEM("mkdir -p $DEST/tex/plain/amstex"); + &SYSTEM("$MV plain/*doc* $DEST/doc/plain/siam"); + &SYSTEM("$MV plain/* $DEST/tex/plain/siam"); + &SYSTEM("$MV amstex/*doc* $DEST/doc/amstex/siam"); + &SYSTEM("$MV amstex/* $DEST/tex/amstex/siam"); + killfiles($cleanpatt); +} + +sub MAKEmisc { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &buildfilelist; + &dotex; + &domakeindex; + killfiles($cleanpatt); +} + +sub MAKEtamethebeast { + my $destdir = "$DEST/doc/english/$package"; + &SYSTEM("mkdir -p $destdir"); + &SYSTEM("$CP -r $packagedir/* $destdir"); +} + +sub MAKEtexdraw { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &buildfilelist; + &dotex; + &domakeindex; + &SYSTEM("mkdir -p $DEST/doc/generic/texdraw"); + &SYSTEM("$MV manual/* $DEST/doc/generic/texdraw"); + killfiles($cleanpatt); +} + +sub MAKEexpressg { + &setup; +chdir("$DEST/doc/$whichdocformat/$package"); +&buildfilelist; + $inspatt = $specialins{$package }; + &buildfilelist; + if ($inspatt eq "") { + $inspatt=$standardins; + } +&runins($inspatt); + &SYSTEM("mpost expeg.mp"); +# rebuild the list of files in the directory + &buildfilelist; + &dodvi; +# rebuild again, as we have .dvi files now + &buildfilelist; + &runfonts; +&dobst; + &dobib; +&dotex; + &domakeindex; + &dosource; + &dotype1; +# +# this is a bit weird, but its an easy way to remove +# empty directories that we never used. +# + &SYSTEM("rmdir $DEST/tex/$whichformat/$package 2> /dev/null"); + &SYSTEM("rmdir $DEST/doc/$whichdocformat/$package 2> /dev/null"); + &SYSTEM("rmdir $DEST/source/$whichformat/$package 2> /dev/null"); + killfiles($cleanpatt); +} + +sub MAKEtipa { +# this simply copies source files + chdir($packagedir) || die ("ERROR: cannot open directory"); + &runjob("mkdir -p $DEST/fonts/source/$Foundry/tipa"); + &runjob("mkdir -p $DEST/fonts/type1/$Foundry/tipa"); + &runjob("mkdir -p $DEST/fonts/tfm/$Foundry/tipa"); + &runjob("mkdir -p $DEST/fonts/map/dvips/tipa"); + &runjob("mkdir -p $DEST/tex/latex/tipa"); + &runjob("mkdir -p $DEST/doc/fonts/tipa"); + &runjob("mkdir -p $DEST/source/latex/tipa"); + &runjob("$CP dvips/* $DEST/fonts/map/dvips/tipa"); + &runjob("$CP sty/* $DEST/tex/latex/tipa"); + &runjob("$CP tfm/* $DEST/fonts/tfm/$Foundry/tipa"); + &runjob("$CP type1/* $DEST/fonts/type1/$Foundry/tipa"); + &runjob("$CP mf/* $DEST/fonts/source/$Foundry/tipa"); + &runjob("$CP doc/* $DEST/doc/fonts/tipa"); +} + +sub MAKEpslatex { +# this simply copies source files + chdir($packagedir) || die ("ERROR: cannot open directory"); + &runjob("mkdir -p $DEST/fonts/tfm/$Foundry/pslatex"); + &runjob("mkdir -p $DEST/fonts/vf/$Foundry/pslatex"); + &runjob("mkdir -p $DEST/tex/latex/pslatex"); + &runjob("mkdir -p $DEST/dvips/pslatex"); + &runjob("mkdir -p $DEST/doc/latex/pslatex"); + &runjob("$CP latex/* $DEST/tex/latex/pslatex"); + &runjob("$CP tfm/* $DEST/fonts/tfm/$Foundry/pslatex"); + &runjob("$CP vf/* $DEST/fonts/vf/$Foundry/pslatex"); + &runjob("$CP dvips/* $DEST/dvips/pslatex"); + &runjob("$CP -r fontinst $DEST/doc/latex/pslatex"); + &runjob("$CP -r shell $DEST/doc/latex/pslatex"); + +} +sub MAKEeco { +# this simply copies source files + chdir($packagedir) || die ("ERROR: cannot open directory"); + &runjob("mkdir -p $DEST/fonts/tfm/$Foundry/eco"); + &runjob("mkdir -p $DEST/fonts/vf/$Foundry/eco"); + &runjob("mkdir -p $DEST/tex/latex/eco"); + &runjob("mkdir -p $DEST/dvips/eco"); + &runjob("mkdir -p $DEST/doc/latex/eco"); + &runjob("$CP src/*sty $DEST/tex/latex/eco"); + &runjob("$CP fd/* $DEST/tex/latex/eco"); + &runjob("$CP tfm/* $DEST/fonts/tfm/$Foundry/eco"); + &runjob("$CP vf/* $DEST/fonts/vf/$Foundry/eco"); + &runjob("$CP -r src/*tex src/*x src/*sh $DEST/doc/latex/eco"); + &runjob("$CP -r [A-Z]* $DEST/doc/latex/eco"); + } + +sub MAKEelhyphen { + &setup; + &buildfilelist; + &donormal; + + print "\t SPECIAL $package: lowercase names\n"; + &SYSTEM('for f in GR*hyph*.tex; do mv $f `echo $f | tr A-Z a-z`; done'); + + print "\t SPECIAL $package: install gr*hyph.tex files\n"; + my $generichyphdir = "$TOPDEST/texmf/tex/generic/hyphen"; + &SYSTEM("mkdir -p $generichyphdir"); + &SYSTEM("$MV gr*hyph*.tex $generichyphdir"); + + print "\t YOU-MUST-DO $package: update texmf/tex/generic/config/language.gr.dat\n"; + print "\t YOU-MUST-DO $package: update texmf/tpm/hyphen-greek.tpm\n"; + print "\t YOU-MUST-DO $package: add to texmf/tpm/collection-langgreek.tpm\n"; +} + +sub MAKEcatalog { +# this simply copies source files + $DEST="$TDS/catalogue/texmf-doc"; + chdir($packagedir) || die ("ERROR: cannot open directory"); + &runjob("mkdir -p $DEST/doc/english/catalogue"); + &runjob("$CP -r * $DEST/doc/english/catalogue"); + chdir("$DEST/doc/html/catalogue/entries") || die ("ERROR cannot chdir $DEST/doc/english/catalogue/entries"); + &buildfilelist; + foreach $File (grep(/.html$/,@filenames)) { + print "process $File\n"; + open FOO,">$File.new"; + open BAR,"$File"; + while (<BAR>) { + s|\.\./\.\./\.\.|http://theory.uwinnipeg.ca/scripts/CTAN|g; + print FOO ; + } + close FOO; + close BAR; + &SYSTEM("$MV $File.new $File"); + } + } + +# all the lshort translations are pretty similar. +sub MAKElshort { + print "MAKElshort\n"; + (my $lang = $package) =~ s,.*-,,; # lshort-english -> english + my $destdir = "$DEST/doc/$lang/$package"; + &SYSTEM("mkdir -p $destdir"); + &SYSTEM("$CP -r $packagedir/* $destdir"); + # keep only pdf's to save space. + &SYSTEM("cd $destdir && rm -f lshort*.ps lshort*.dvi lshort-*-book.zip"); +} + +sub MAKEltt { +# this simply copies source files + chdir($packagedir) || die ("ERROR: cannot open directory"); + &runjob("mkdir -p $DEST/doc/ltt"); + &runjob("$CP * $DEST/doc/ltt"); + } + +sub MAKEpstricks { +# this simply copies source files + chdir($packagedir) || die "chdir($packagedir) failed: $!"; + &runjob("mkdir -p $DEST/tex/generic/pstricks"); + &runjob("mkdir -p $DEST/doc/generic/pstricks"); + &runjob("mkdir -p $DEST/source/generic/pstricks"); + &runjob("mkdir -p $DEST/tex/latex/pstricks"); + &runjob("mkdir -p $DEST/dvips/pstricks"); + &runjob("$CP generic/* $DEST/tex/generic/pstricks"); + &runjob("$CP latex/* $DEST/tex/latex/pstricks"); + &runjob("$CP -r doc/* $DEST/doc/generic/pstricks"); + &runjob("$CP dvips/* $DEST/dvips/pstricks"); + &runjob("$CP [A-Z]* $DEST/doc/generic/pstricks"); + chdir($packagedir); + } + +sub MAKEwilson { + &setup; + + my $docdir = "$DEST/doc/$whichdocformat/$package"; + chdir ($docdir) || die "chdir($docdir) failed: $!"; + + opendir(DIR,'.') || die "opendir(.) failed: $!"; + @dirnames =grep(!/^\.\.?$/,readdir(DIR)); + closedir(DIR); + + for my $d (@dirnames) { + if ($d =~ /\.zip$/) { + unlink ("$docdir/$d"); + next; + } + + my $target = "$docdir/$d"; + next if ! -d $target; # samples/readme files + print "PROCESS Wilson subdir $d\n"; + chdir ($target) || die "chdir($target) failed: $!"; + + if ($d) { + for my $f (glob ("try*"), glob ("*.pdf"), "README") { + my $dest = "$docdir/"; + $dest .= "$d-" if $f !~ /$d/; + $dest .= $f; + &runjob("$MV $f $dest"); + } + } + + &buildfilelist; +# run the .ins files (if any) supplied + $inspatt = $specialins{$package }; + &buildfilelist; + &runins($inspatt || $standardins); + &dodvi; + &domf; + &dodvi; +# rebuild again, as we have .dvi files now + &buildfilelist; + &runfonts; + &dobst; + &dobib; + &dotex; + &domakeindex; + &dosource; + &dotype1; + killfiles($cleanpatt); + } + killfiles($cleanpatt); +} + +sub MAKEt2 { +# this simply copies source files + chdir($packagedir) || die ("ERROR: cannot open directory"); + &runjob("mkdir -p $DEST/dvips/t2"); + &runjob("mkdir -p $DEST/tex/fontinst/cyrfinst"); + &runjob("mkdir -p $DEST/tex/plain/cyrplain"); + &runjob("mkdir -p $DEST/tex/latex/t2"); + &runjob("mkdir -p $DEST/doc/generic/t2"); + &runjob("$CP -r cyrfinst/* $DEST/tex/fontinst/cyrfinst"); + &runjob("$CP -r cyrplain/* $DEST/tex/plain/cyrplain"); + &runjob("$CP enc-maps/encfiles/* $DEST/fonts/enc/t2"); + &runjob("$CP enc-maps/*.* enc-maps/[A-Z]* $DEST/doc/generic/t2"); + &runjob("$CP -r etc examples $DEST/doc/generic/t2"); + chdir("$DEST/doc/generic/t2/etc"); + &runjob("latex mathtext.ins"); + &runjob("rm *log; mv *sty $DEST/tex/latex/t2"); + } + +sub MAKEcontext { +# this simply copies source files + chdir($packagedir) || die ("ERROR: cannot open directory"); + &runjob("mkdir -p $DEST"); + &runjob("$CP cont-tmf.zip cont-wrk.zip cont-uti.zip $DEST"); + chdir($DEST) || die ("ERROR: cannot open directory"); + &runjob("unzip -o cont-tmf"); + &runjob("unzip -o cont-uti"); + &runjob("unzip -o cont-wrk"); + &runjob("mkdir web2c"); + &runjob("cd tex/context/config; mv texexec.rm texexec.ini"); + &runjob("rm cont-tmf.zip cont-wrk.zip cont-uti.zip "); +open FOO,">tex/context/config/cont-cz.ini"; +print FOO "\\input cont-cz.tex\n"; +print FOO "\\endinput"; +close FOO; +open FOO,">tex/context/config/cont-de.ini"; +print FOO "\\input cont-de.tex\n"; +print FOO "\\endinput"; +close FOO; +open FOO,">tex/context/config/cont-en.ini"; +print FOO "\\input cont-en.tex\n"; +print FOO "\\endinput"; +close FOO; +open FOO,">tex/context/config/cont-nl.ini"; +print FOO "\\input cont-nl.tex\n"; +print FOO "\\endinput"; +close FOO; +open FOO,">tex/context/config/cont-uk.ini"; +print FOO "\\input cont-uk.tex\n"; +print FOO "\\endinput"; +close FOO; +open FOO,">tex/context/config/context.ini"; +print FOO "\\input context.tex\n"; +print FOO "\\endinput"; +close FOO; +# &runjob("sed 's/\#\#//' < `kpsewhich fmtutil.cnf` > /tmp/fmtutil.$Jobid"); +# &runjob("TEXMFLOCAL=$DEST VARTEXMF=$DEST fmtutil --cnffile /tmp/fmtutil.$Jobid --fmtdir web2c --byfmt cont-en"); +# &runjob("TEXMFLOCAL=$DEST VARTEXMF=$DEST fmtutil --cnffile /tmp/fmtutil.$Jobid --fmtdir web2c --byfmt cont-de"); +# &runjob("TEXMFLOCAL=$DEST VARTEXMF=$DEST fmtutil --cnffile /tmp/fmtutil.$Jobid --fmtdir web2c --byfmt cont-nl"); +# &runjob("rm /tmp/fmtutil.$Jobid"); + } + +# docs in two languages. The English one is in a separate package, +# mathmode. Just remove it from the copy when building the German one. +# +sub MAKEvossde { + my $docdir = "$DEST/doc/german/$package"; + &SYSTEM("mkdir -p $docdir"); + &SYSTEM("$CP -r $packagedir/* $docdir"); + &SYSTEM("rm -r $docdir/mathmode"); +} + +sub MAKEukrhyph { +# this simply copies source files + chdir($packagedir) || die ("ERROR: cannot open directory"); + &runjob("mkdir -p $DEST/tex/generic/ukrhyph"); + &runjob("mkdir -p $DEST/doc/generic/ukrhyph"); + &runjob("$CP README $DEST/doc/generic/ukrhyph"); + &runjob("$CP *.* $DEST/tex/generic/ukrhyph"); + &runjob("$MV $DEST/tex/generic/ukrhyph/*.pdf $DEST/doc/generic/ukrhyph"); + &runjob("rm $DEST/tex/generic/ukrhyph/*.ps"); + } + +sub MAKElfb { + # remove pregenerated pk files. + &MAKEflatten (); + print "\t SPECIAL removing lfb PK files\n"; + &SYSTEM("rm *pk"); +} + +sub MAKElh { +# this simply copies source files + chdir($packagedir) || die ("ERROR: cannot open directory"); +&runjob("mkdir -p $DEST/fonts/source/lh"); +&runjob("mkdir -p $DEST/doc/fonts/lh"); +&runjob("mkdir -p $DEST/source/fonts/lh"); +&runjob("$CP -r doc/* $DEST/doc/fonts/lh"); +&runjob("$CP -r INSTALL *.* tex $DEST/doc/fonts/lh"); +&runjob("$CP -r mf/* $DEST/fonts/source/lh"); + +chdir("tex"); + + &inst_lh_fonts ("12ex-la","t2a"); + &inst_lh_fonts ("13ex-lb","t2b"); + &inst_lh_fonts ("14ex-lc","t2c"); + &inst_lh_fonts ("15ex-ld","t2d"); + &inst_lh_fonts ("11ex-rx","x2"); + &inst_lh_fonts ("03cm-wn","ot2"); + &inst_lh_fonts ("01cm-lh","lcy"); +} + +sub MAKElucida { +# this simply copies source files + chdir($packagedir) || die ("ERROR: cannot open directory"); + &runjob("mkdir -p $DEST"); + &runjob("$CP -r * $DEST"); + } + +sub MAKEliterat { +# this simply copies source files + chdir($packagedir) || die ("ERROR: cannot open directory"); + &runjob("mkdir -p $DEST/fonts/tfm/paragrap/literat"); + &runjob("mkdir -p $DEST/fonts/vf/paragrap/literat"); + &runjob("mkdir -p $DEST/fonts/type1/paragrap/literat"); + &runjob("mkdir -p $DEST/fonts/afm/paragrap/literat"); + &runjob("mkdir -p $DEST/tex/latex/literat"); + &runjob("mkdir -p $DEST/dvips/literat"); + &runjob("mkdir -p $DEST/doc/fonts/literat"); + + &runjob("$CP dvips/* $DEST/dvips/literat"); + &runjob("$CP tex/*tex $DEST/doc/fonts/literat"); + &runjob("$CP psfonts/*pfb $DEST/fonts/type1/paragrap/literat"); + &runjob("$CP psfonts/*inf $DEST/fonts/type1/paragrap/literat"); + &runjob("$CP psfonts/*afm $DEST/fonts/afm/paragrap/literat"); + &runjob("$CP tex/*sty tex/*fd $DEST/tex/latex/literat"); + &runjob("$CP tfm/* $DEST/fonts/tfm/paragrap/literat"); + &runjob("$CP tfm-raw/* $DEST/fonts/tfm/paragrap/literat"); + &runjob("$CP vf/* $DEST/fonts/vf/paragrap/literat"); + &runjob("$CP [A-Z]* insta* license $DEST/doc/fonts/literat"); + } + + +sub MAKExmltex { +# this simply copies source files + chdir($packagedir) || die ("ERROR: cannot open directory"); + &runjob("mkdir -p $DEST/tex/xmltex/config"); + &runjob("mkdir -p $DEST/tex/xmltex/base"); + &runjob("mkdir -p $DEST/doc/xmltex/base"); + + &runjob("$CP *.ini $DEST/tex/xmltex/config"); + &runjob("$CP xmltex.tex *xmt xmltex.cfg $DEST/tex/xmltex/base"); + &runjob("$CP manual* *xml test* *txt $DEST/doc/xmltex/base"); + } + +sub MAKEbase { + &SYSTEM("mkdir -p $DEST/tex/latex/base"); + &SYSTEM("mkdir -p $DEST/doc/latex/base"); + &SYSTEM("mkdir -p $DEST/doc/latex/base"); + if (-f "$packagedir/00Contents" ) { unlink "$packagedir/00Contents" ; } + &SYSTEM("$CP -r $packagedir/* $DEST/doc/latex/base"); + chdir($packagedir) || die ("ERROR: cannot open directory"); + $package="base"; + $DEST="$TDS/ltxbase/texmf-dist"; + print "!$whichformat $packagedir ($package) -> $DEST\n"; + &donormal; + } + +sub MAKEfancyvrb { + &setup; + chdir("$DEST/doc/latex/$package"); + print "\t SPECIAL $package\n"; + &SYSTEM("$MV contrib/README README.contrib"); + &SYSTEM("$MV contrib/* .; rmdir contrib"); + &buildfilelist; + &donormal; +} + +sub MAKEfeatpost { + &setup; + chdir("$DEST/doc/metapost/$package") + || die "chdir($DEST/doc/metapost/$package) failed: $!"; + print "\t SPECIAL $package, leaving most in doc\n"; + @filenames = glob("macro/*.mp"); + &install("$DEST/metapost/featpost", ".mp"); + &SYSTEM("rm -rf system"); # seeing his texmf.cnf will only confuse people +} + +sub MAKEms { + &setup; + chdir("$DEST/doc/latex/$package"); + &SYSTEM("$MV contrib/README README.contrib"); + &SYSTEM("$MV contrib/* .; rmdir contrib"); + &buildfilelist; + &donormal; +} + +sub MAKEucs { + &setup; + chdir("$DEST/doc/latex/$package"); + &SYSTEM("$MV data $DEST/tex/latex/ucs"); + &SYSTEM("$MV *def *sty $DEST/tex/latex/ucs"); + &SYSTEM("$MV contrib/* $DEST/tex/latex/ucs"); +} + +sub MAKEtexsis { + &setup; + chdir("$DEST/doc/texsis/$package"); + &SYSTEM("make TXSsite.tex"); + &buildfilelist; + &donormal; + &SYSTEM("rm *.ps"); +} + + +sub MAKEthumbpdf { + &donormal; + my $myscriptdir = "$TOPDEST/texmf/scripts/thumbpdf"; + &SYSTEM("mkdir -p $myscriptdir/"); + &SYSTEM("mv thumbpdf.pl $myscriptdir/"); +} + +sub MAKEIEEEtran { + print "\t SPECIAL renaming README files, then flatten\n"; + chdir ($packagedir) || die "chdir($packagedir) failed: $!"; + &SYSTEM('for f in *; do test -r $f/README && mv $f/README README.$f; done'); + chdir (".."); + &MAKEflatten; + # let's not worry about the fact that the tex run on testflow fails (it + # wants a paper size); we still get the distributed pdf, which is good enough. +} + +sub MAKEbardiag { + &setup; + chdir("$DEST/doc/latex/$package"); + &SYSTEM("$MV doc/* ."); + &buildfilelist; + &donormal; +} + +sub MAKEmathpazo { + &setup; + chdir("$DEST/doc/latex/$package"); + &SYSTEM("$MV latex/* type1/* afm/* vf/* tfm/* dvips/* .; rmdir latex type1 afm vf tfm dvips"); + &buildfilelist; + &donormal; +} + +sub MAKEhaprosper { + &setup ("nocopytodoc"); # create dirs but that's all + chdir("$packagedir"); + &SYSTEM("mkdir -p $DEST"); + print "\t SPECIAL copying HA-prosper\n"; + &SYSTEM("$CP -r README Doc/* $DEST/doc/latex/HA-prosper"); + &SYSTEM("$CP -r Run/* $DEST/tex/latex/HA-prosper"); + &SYSTEM("$CP -r Source/* $DEST/source/latex/HA-prosper"); +} + +sub MAKEpclnfss { + chdir("$packagedir"); + &SYSTEM("mkdir -p $DEST/source/fonts/pclnfss"); + &SYSTEM("mkdir -p $DEST/doc/fonts/pclnfss"); + &SYSTEM("$CP -r [A-Z]* $DEST/doc/fonts/pclnfss"); + &SYSTEM("$CP -r fonts $DEST"); + &SYSTEM("$CP -r tex $DEST"); + &SYSTEM("$CP -r src/* tests $DEST/source/fonts/pclnfss"); + +} + + +sub MAKESIstyle { + chdir("$packagedir"); + &SYSTEM("mkdir -p $DEST"); + &SYSTEM("$CP -r source tex doc $DEST"); + &SYSTEM("$CP -r README $DEST/doc/latex/SIstyle"); + &SYSTEM("cd $DEST/source/latex/SIstyle; unzip *zip; rm *zip"); + +} + +sub MAKEbeamer { + chdir("$packagedir"); + &SYSTEM("mkdir -p $DEST/doc/latex/beamer"); + &SYSTEM("$CP -r AUTHORS ChangeLog FILES INSTALL README TODO examples lyx emacs doc/* $DEST/doc/latex/beamer"); + &SYSTEM("mkdir -p $DEST/tex/latex/beamer"); + &SYSTEM("$CP -r base/* themes emulation extensions/multimedia $DEST/tex/latex/beamer"); + +} + + +# this doesn't really work yet. +sub MAKEbeebe { + &setup; + print "\t SPECIAL moving beebe .bib and .bst\n"; + chdir ("$DEST/doc/latex/$package") || die; + &SYSTEM("mkdir -p $DEST/bibtex/bib/beebe $DEST/bibtex/bst/beebe"); + &SYSTEM("$MV tex*.bib tug*.bib $DEST/bibtex/bib/beebe"); +#xx ugh, they aren't there &SYSTEM("$MV *.bst $DEST/bibtex/bst/beebe"); + &SYSTEM("rm *"); + +} +sub MAKEpst { + print "\t SPECIAL $package starts\n"; + $standardtex = qq{^$package\.(tex|sty)}; + $whichformat='generic'; + $whichdocformat='generic'; + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &buildfilelist; + + $inspatt=$standardins if ! $inspatt; + &runins($inspatt); + &buildfilelist; + &dosource; + &dotex; + &dotype1; + killfiles($cleanpatt); + &SYSTEM("mkdir -p $DEST/tex/latex/$package; mv $DEST/tex/generic/$package/*sty $DEST/tex/latex/$package"); +} + + +sub inst_lh_fonts { + local($texfile,$dir) = @_; +&runjob("tex $texfile "); +&runjob("rm -f $texfile.dvi $texfile.log"); +&runjob("mkdir -p $DEST/fonts/source/lh/lh-$dir"); +&runjob("$CP wrk/*.mf $DEST/fonts/source/lh/lh-$dir"); +&runjob("rm -r wrk/*"); +} + +sub MAKEfontinst { +chdir("$packagedir"); +&runjob("mkdir -p $DEST/tex/latex/fontinst"); +&runjob("mkdir -p $DEST/tex/fontinst"); +&runjob("mkdir -p $DEST/source/fontinst"); +&runjob("mkdir -p $DEST/doc/fontinst/base"); +&runjob("$CP -r examples test $DEST/doc/fontinst/base"); +&runjob("$CP -r doc/* README test $DEST/doc/fontinst/base"); +&runjob("$CP -r source $DEST/source/fontinst/base"); +&runjob("$CP -r latex/* $DEST/tex/latex/fontinst"); +&runjob("$CP -r inputs/* $DEST/tex/fontinst"); +} + +sub MAKEpsnfss { +chdir("$packagedir"); +&runjob("mkdir -p $DEST/doc/latex/psnfss"); +&runjob("mkdir -p $DEST/fonts/map/dvips/psnfss"); +&runjob("mkdir -p $DEST/source/latex/psnfss"); +&runjob("$CP *.tex *.txt *.pdf $DEST/doc/latex/psnfss"); +&runjob("$CP *.enc *.dtx *.ins $DEST/source/latex/psnfss"); +&runjob("$CP *.map $DEST/fonts/map/dvips/psnfss"); +&runjob("unzip lw35nfss; unzip freenfss; mv tex fonts $DEST"); +&runjob("latex psfonts.ins; mv *sty $DEST/tex/latex/psnfss "); +} + +sub MAKEkoma { + chdir("$packagedir"); + &runjob("TEXLIVE=$DEST make -f Makefile.unx texlive"); + &SYSTEM("rm -f scrgui*.dvi"); # just keep pdf's +} + +sub MAKEcmlgc { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &SYSTEM("rm -rf vtex"); + &MAKEflatten; +} + +sub MAKEpict2e { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &buildfilelist; +# run the .ins files (if any) supplied + $inspatt = $specialins{$package }; + if ($inspatt eq "") { + $inspatt=$standardins; + } + $Foundry = $specialfoundry{$package }; + if ($Foundry eq "") { + $Foundry=$standardfoundry; + } + &runins($inspatt); +# rebuild the list of files in the directory + &SYSTEM("$MV pict2e-example.cfg pict2e.cfg"); + &buildfilelist; + &dodvi; +# rebuild again, as we have .dvi files now + &buildfilelist; + &dotex; + &dosource; + &SYSTEM("rmdir $DEST/tex/$whichformat/$package 2> /dev/null"); + &SYSTEM("rmdir $DEST/source/$whichformat/$package 2> /dev/null"); + &SYSTEM("rmdir $DEST/doc/$whichdocformat/$package 2> /dev/null"); + killfiles($cleanpatt); +} + + +sub MAKEpictex { + &setup; + chdir ($DOCDIR) || die "chdir($DOCDIR) failed: $!"; + &SYSTEM("rm -rf mathspic"); # separate package + &SYSTEM("mv addon/* .; rmdir addon"); + &donormal; +} + + +sub MAKElistings { + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &setup; + chdir("$DEST/doc/$whichdocformat/$package"); + &SYSTEM("$MV listings*pdf listings.pdf"); + &donormal; +} |