README.web2c-mp:
================

This is a modified and reorganized redistribution of MetaPost 0.63, 
adapted to work with web2c-6.1 and kpathsea-2.6.  It is based on the
teTeX-0.3 development version, which is basically nothing else than
web2c-6.1 with the patches for kpathsea-2.6 and some other minor
bug-fixes already included.  Care has been taken to ensure that it'll
work with native web2c-6.1 installations using kpathsea-2.6 as well.

This distribution consists of the the following files:

web2c-mp-lib.tar.gz     - the MetaPost input files and documentation,
                          reorganized to fit into the texmf tree,

web2c-mp-src.tar.gz     - the modified MetaPost sources, reorganized
                          to fit into the web2c source tree,

web2c-mp-web2c.patch    - patches to web2c and kpathsea routines
                          for installations based on web2c-6.1
                          patched for kpathsea-2.6. 

web2c-mp-teTeX.patch    - patches to web2c and kpathsea routines
                          for installations based on teTeX-0.3.

To compile MetaPost and its utility programs, you'll need the modified
MetaPost sources, the web2c and kpathsea sources, and one of the two 
patch files listed above, depending on which installation you're using.


INSTALLATION:
=============

1.) Retrieve the web2c and kpathsea sources. 

    a) For the teTeX-0.3 distribution this means getting the files 
   
         teTeX-0.3-lib.tar.gz 
         teTeX-0.3-src.tar.gz 
        
       from ftp://sunsite.informatik.rwth-aachen.de from the directory
       /pub/tex/development/teTeX.

    b) For native web2c distributions this means getting the files

         lib-6.x.tar.gz
         web-6.1.tar.gz
         web2c-6.1.tar.gz
         web2c.kpathsea-2.6.help

       from any CTAN hots from the directory /tex-archive/systems/web2c.
       You'll also need the actual kpathsea-2.6 source files which 
       are packaged with dvipsk-5.58f.tar.gz.  (You'll need dvips(k) 
       anyway for including MetaPost pictures into TeX documents!)


2.) Unpack the web2c sources and texmf libraries.

    a) For the teTeX-0.3 distribution this simply means unpacking
       the two above-mentioned tar.gz files and your done.

       The web2c and kpathsea sources will end up in the directory
       teTeX-0.3-src/kpse-2.6.  The various input files will end up
       in teTeX-0.3/texmf.  teTeX-0.3 also serves as the destination
       directory of your installation.

    b) For native web2c distributions things are more difficult:
       First, you'll have to unpack web2c-6.1.tar.gz, web-6.1.tar.gz
       and dvips-5.58f.tar.gz.  You'll then have to move the web2c
       subdirectory of web2c-6.1 to dvips-5.58f, which will serrve 
       as the combined source directory, which should be renamed
       to kpathsea-2.6.

       Once you've got that, you'll have to apply the patch file
       web2c.kpathsea-2.6.help.  Finally don't forget to unpack
       the lib-6.x.tar.gz file containing the input files in the 
       appropriate destination location of your installation.
   

3.) Unpack the MetaPost sources and libraries.

    Now, you're ready to unpack the MetaPost distribution itself
    to merge it with the standard distribution unpacked so far.
   
    First, change to the directory where your texmf directory is 
    located (e.g. teTeX-0.3 or /usr/local/lib) and unpack the file 
    web2c-mp-lib.tar.gz. This should produce the subdirectories 
    texmf/metapost/{base,misc,support} and texmf/doc/metapost.

    Next, change to the top-level directory of your web2c sources
    (e.g. teTeX-0.3-src/kpse-2.6 or kpathsea-2.6) and unpack the 
    file web2c-mp-src.tar.gz. This should produce the subdirectories
    web2c/mp, web2c/mpware and add the file mp.man to web2c/man.


4.) Apply the patches to the web2c and kpathsea sources.

    Since there are some minor differences between the native web2c 
    distribution and teTeX-0.3, it was necessary to prepare two 
    different patches to insure that everything works correctly.  

    To apply these patches the procedure is similar in both cases,
    except for the top-level from which to apply the patches:

    a) For teTeX-0.3 change to teTeX-0.3-src and type the command

         patch -p -l -s < web2c-mp-teTeX.patch

       If all is fine, you shouldn't get any output when patch
       is instructed to operate silently. (The -l option means
       doing pattern matching somewhat more losely, so that patch
       won't choke on whitespace differences.)

       After applying the patch change to teTeX-0.3-src/bin-extra
       and create symbolic link by typing 
     
         ln -s virmp mp

       Unfortunately, symbolic links can't be packed into a patch.
       
    b) For native web2c distributions is very similar: Chhange to 
       the directory kpathsea-2.6 and type
 
         patch -p -l -s < web2c-mp-web2c.patch


5.) If everything went well, it's time to start the compilation.

    a) For teTeX-0.3 change to teTeX-0.3-src and do the following:
       make config; make clean; make all; make install.

       This should do almost everything except for making the 
       formats, bases, and mem files, which is done by a separate 
       target make ini in the top-level Makefile. 

       If all is well, you should see that configure creates 
       Makefiles in the web2c/mp and web2c/mpware subdirectories
       and that the compilation runs in these directories to
       produce the programs inimp, virmp, and several utilities.

    b) For native web2c distributions the procedure is very similar,
       except that there is no extra Makefile on top of everything.
       Instead, change to kpathsea-2.6 and do the following:
       sh configure; make clean; make all; make install.

       Here the make install target will also create the formats,
       bases, and mem files, which requires that the input files
       are in the correct place at the time you run make install.
      

6.) Once your compilation has succeeded, it's time to test MetaPost.

    For a good start, change to texmf/doc/metapost and run MetaPost
    on manfig.mp (using either 'virmp \&plain manfig' or 'mp manfig').
    This should produce a bunch of output files named manfig.<number>.
    If you've succeeded with that, you might try to recreate mpman.ps 
    by running dvips on mpman.dvi, which will include the figures
    contained in the manfig.<number> files.  You might then try the
    same with mpgraph.mp, which will also process the data files *.d.


7.) If all went well, you should be set to start exploring MetaPost
    by creating your own MetaPost figures.



CHANGES:
========

A number of files from the original MetaPost distribution have 
been discarded and/or replaced by modified or completely rewritten 
versions that are based on the web2c/mf or web2c/dviutils sources.
A detailed list of changes applied to the original MetaPost sources
can be found in web2c/mp/ChangeLog and web2c/mpware/ChangeLog. 
The patches for the web2c and kpathsea source files also include
additions to the ChangeLog files, documenting what has changed.



NOTES:
======

1.) This distribution uses separate binaries for `inimp' and `virmp'.
    This was done this way for consistency with TeX and METAFONT.  
    In the long term, it might be preferable to use combined binaries
    with a `-I' command line option for all of TeX, METAFONT, and 
    MetaPost, but until then, it would be confusing if only MetaPost 
    behaved differently from the others.  

    A symbolic link `mp' pointing to `virmp' is used to invoke MetaPost 
    with the default mem file preloaded (plain.mem, stored as mp.mem).  
    It's possible to use a similar link `mfmp' to invoke MetaPost with 
    the METAFONT-compatible mem file (mfplain.mem, stores as mfmp.mem), 
    but most users will probably never use that.


2.) The default version of MetaPost is a ``big'' version using the same 
    parameters as TeX and METAFONT for the memory layout.  I don't know
    if anyone actually needs this, but having a big version probably 
    can't hurt either.  There is a new "SMALLMP" configuration option 
    in web2c/lib/c-auto.h.in (similar to "SMALLTeX" and "SMALLMP" that 
    might be useful when porting Web2C to systems with limited memory.


3.) The input character set has been extended to allow any character
    just like TeX and METAFONT do.  This might come handy for included
    text in `btex ... etex' strings that are passed to TeX, but it is 
    probably better to avoid using non-ASCII characters in file names
    and such.  


4.) MetaPost and the `dvitomp' utility program use the path searching
    routines from the kpathsea library.  The `dmp' utility program,
    however, which is written in C instead of WEB, uses the simpler
    `pathexpand' routine added recently in Version 0.63 of MetaPost.
    If you encounter problems with this not-yet-widely-tested routine,
    you may want to disable this by undefining the PATHEXPAND symbol
    in web2c/lib/c-auto.h.in or the compiler options for pathexpand.c 
    in web2c/mpware/Makefile.in.


5.) MetaPost by default uses carefully-coded external floating-point
    routines that replace the fixed point math routines in mp.web.
    You may want to check them by running the timing test programs 
    in the web2c/mp/MPtime subdirectory that also check the accuracy
    of the floating-point routines compared to the original routines.
    If, for some reason, you want to use the fixed-point routines, you 
    can do so by defining the FIXPT symbol in web2c/lib/c-auto.h.in.


6.) MetaPost has a `-T' command line option to select ``troff mode''
    to process included textual material using `troff' instead of TeX.
    Successful operation of this mode requires a ``suitable'' version
    of `troff' that is capable of producing PostScript output using 
    the `dpost' post-processor.  While some System V'ish versions of 
    Unix do seem to have them, some (many?) other systems have not.
    In that case, you might try `groff' instead, but you'll have to 
    modify the default TROFF command in web2c/mpware/troffmpx.in 
    and the TRFONTS serach path in web2c/mpware/dmp.h.in.  

    To produce troff documents with included MetaPost figures you'll 
    still need the `pictures' macros that define the `.BP' troff 
    command.  I haven't yet found a version of Unix that has these
    macros,  but you might be able to produce portable MetaPost 
    figures in ``troff mode'' for inclusion into other systems 
    without it.  (You could also use MetaPost in ``TeX mode'' if 
    you use only uilt-in PostScript fonts and set `prologues:=1'.)


7.) While the original MetaPost distribution provides its own copy
    of psfonts.map, this implementation allows to use the version
    distributed with dvipsk.  The parsing routines for psfonts.map
    have been extended to handle comments and blank lines correctly.

    When using PostScript fonts, it might be a good idea to keep
    the old versions of the PostScript font metrics distributed 
    with dvips, since some files in texmf/doc/metapost reference
    the fonts rptmr and rpsyr (TimesRoman and Symbol in raw 
    encoding)which have been replaced by ptmr0, etc. recently.
    


UPDATES:
========

As this distribution differs significantly from the original MetaPost 
distribution, incorporating updates for future releases of MetaPost 
won't be quite as easy as in the case of TeX, METAFONT, etc., where 
it is usually sufficient to replace the new versions of the WEB files 
and update the version number in the change file.  

In the case of MetaPost and DVItoMP, which are both written in WEB, 
it should be sufficient to install the new WEB files and update 
the change files if necessary.  The external C routines mpext.c 
and dvimpext.c have been replaced by the standard Web2C routines, 
except for the callmakempx() function that was integrated in 
web2c/lib/openinout.c.  The external math routines mpmath.c have
been retained unchanged, but they're unlikely to change anyway.

Updating the other utility programs written in C might be somewhat
more difficult since several of these files have been modified and
these modifications will have to be re-applied in future revision.
To make it easier to update these files, context diffs have been
provided for the files newer.c, dmp.c and pathexp.c in web2c/mpware.


ACKNOWLEDGEMENTS:
=================

I'd like to thank Denis Roegel and Sebastian Rahtz for testing 
a preliminary version of this distribution and pointing out 
some problems that have been fixed meanwhile.  I'd also like 
to thank Thomas Esser for the teTeX distribution and Karl Berry 
for web2c/kpathsea.  Last not least, I'd also like to thank 
John Hobby for writing MetaPost in the first place. Let's hope
that it'll eventually find its way into the standard distribution.


Ulrik Vieth <vieth@thphy.uni-duesseldorf.de>	-- 1995/05/08
