INSTALL [7. Jun 2000]

Compilation Instructions for The Mops V0.42d
--------------------------------------------

There are three major ways to compile The Mops, "shared", "standalone"
(using tcl2c, deprecated!) and "wrapped standalone" (using Wrap0.3).
The binaries you get with the binary distribution of The Mops are
wrapped standalone. This means Tcl/Tk and the main Tcl-scripts of
The Mops and the button images are all statically combined in the
binary. This means no hassle with Tcl/Tk versions (you do not need
an installed Tcl/Tk at all) but also: large binaries.
The creation of standalone and wrapped standalone executables
of The Mops is a bit tricky.
Therefore, if you really want to or have to compile The Mops:
Please compile a shared version of The Mops.


1. Compiling a Shared Version of The Mops
-----------------------------------------

1.1 Step 1 - Requirements
-------------------------

The following requirements _must_ be met to compile a shared
version of The Mops:

- ANSI-C-compiler (gcc preferred)
- Tcl/Tk (atleast V8.0)
  ftp://ftp.scriptics.com/pub/tcl/
  Note, that a complete installation of Tcl/Tk is required.
  Note also, that since Togl is a Tk-Widget that needs internal
  Tk-headers to be compiled, it is _not sufficient_ to just have
  an installed Tcl/Tk on your system, please _get the source
  distribution_ of Tcl/Tk.
- OpenGL
  (Mesa may be used as replacement for a real OpenGL, however,
   preview of trimmed NURB patches is not possible with the
   current Mesa)
  http://www.mesa3d.org/
- Togl
  http://www.mesa3d.org/brianp/Togl.html
  Compiling Togl is tricky with Tcl/Tk versions higher than
  8.0.4. The suggested way is to:
  - delete all headers from the Togl distribution except for
    "togl.h" of course
  - modify the Togl Makefile to look into the Tk source distribution
    for headers
  - modify "togl.c" to include "tkInt.h" regardless of the Tk version
- BMRT2.5 (ri.h, slc.h, libribout.a, libslcargs.a)
  http://www.bmrt.org/
or
- The Affine Toolkit
  http://www.affine.com/

Note, that BMRT's libribout.a and libslcargs.a come as binary only,
they might not be available on your platform!
If BMRT is not available on your platform you can still
compile The Mops with the Affine Toolkit with
reduced functionality, read: no parsing of shaders.
Get the Affine Toolkit from http://www.affine.com/.
Hint: The required libsribw.a (simple RIB writer) is compiled
from write.c and constant.c in the subdir sribw of the Affine Toolkit.

I suggest to get Tcl/Tk V8.0p2 and Togl V1.5.


1.2 Step 2 - Compiling
----------------------

You have all required software and compiled it successfully?
Please verify that by compiling and running a Togl example program
from the Togl distribution _before_ going any further.

- copy Makefile.shared to Makefile
>cd src
>cp Makefile.shared Makefile

- edit the Makefile:
  + choose the installation directories
  + choose your compiler
  + set appropriate CFLAGS
    (but be sure to choose CFLAGS _without_ -DMOPSSTANDALONE)
    if you are using the Affine Toolkit as libribout replacement
    add -DMOPSHAVEAFFINE
  + configure _all_ other parts until the Makefile tells you to stop
    (yes, this _is_ a lot of work)
    If Tcl/Tk, Togl and BMRT are unpacked in sister directories
    of the Mops distribution much less work is required, however!

- issue a
>make

- now compile the Mfio (3DMF) plugin:
>make mf3d
>make mfio.so

Now mopssh should be compiled and ready for a test run.
-try it:
>./mopssh mopstcl.tcl
Do not try to run mopssh without the script as argument!

If all went fine, you can now install The Mops:
>make install

The installation procedure creates a shell script
named mops, that calls mopssh the right way,
so that after installation you can start The Mops
typing:
>mops

Now read "Setup.txt" to learn how to customize The Mops.


2. Compiling a Standalone Version of The Mops
---------------------------------------------

Compiling standalone versions of The Mops should
be considered deprecated.

2.1 Step 1 - Requirements
-------------------------

The following requirements _must_ be met to compile a standalone
version of The Mops:

- ANSI-C-compiler (gcc preferred)
- Tcl/Tk (atleast V8.0) with PlusPatch applied!
  http://purl.oclc.org/net/nijtmans/plus.html
  Note, that you do _not_ need to install Tcl/Tk to compile and use
  the standalone version of The Mops. But compiling this Tcl/Tk
  is still necessary.
- OpenGL
  (Mesa may be used as replacement for a real OpenGL, however,
   preview of trimmed NURB patches is not possible with the
   current Mesa)
  http://www.mesa3d.org/
- Togl
  http://www.mesa3d.org/brianp/Togl.html
  Compiling Togl is tricky with Tcl/Tk versions higher than
  8.0.4. The suggested way is to:
  - delete all headers from the Togl distribution except for
    "togl.h" of course
  - modify the Togl Makefile to look into the Tk source distribution
    for headers
  - modify togl.c to include "tkInt.h" regardless of the Tk version
- BMRT2.5 (ri.h, slc.h, libribout.a, libslcargs.a)
  http://www.bmrt.org/
or
- The Affine Toolkit
  http://www.affine.com/
- a customized version of tcl2c (find the source in the
  tools/ subdirectory)

Note, that BMRT's libribout.a and libslcargs.a come as binary only,
they might not be available on your platform!
If BMRT is not available on your platform you can still
compile The Mops with the Affine Toolkit with
reduced functionality, read: no parsing of shaders.
Get the Affine Toolkit from http://www.affine.com/.
Hint: The required libsribw.a (simple RIB writer) is compiled
from write.c and constant.c in the subdir sribw of the Affine Toolkit.

I suggest to get Tcl/Tk V8.0p2plus and Togl V1.5.



2.2 Step 2 - Compiling a new tcl2c
----------------------------------

This step may be done before or after compiling the standalone Tcl/Tk
libraries, as the new tcl2c should be compatible with the old one.

- copy the new tcl2c.c from the src/tools subdirectory to the tcl8.x
  source tree (to tcl8.x/generic/ to be more specific)
- cd to tcl8.x/unix/
- assuming you did compile the standalone libraries before, issue a:
>make tcl2c
otherwise:
>./configure --enable-static
>make
- copy the new tcl2c to your private bin directory


2.3 Step 3 - Compiling
----------------------

You have all required software and compiled it successfully?
Please verify that by compiling and running a Togl example program
from the Togl distribution _before_ going any further.

- copy Makefile.standalone to Makefile
>cd src
>cp Makefile.standalone Makefile

- edit the Makefile:
  + choose the installation directories
  + choose your compiler
  + set appropriate CFLAGS
    (but be sure to choose CFLAGS _with_ -DMOPSSTANDALONE)
    if you are using the Affine Toolkit as libribout replacement
    add -DMOPSHAVEAFFINE
  + configure _all_ other parts until the Makefile tells you to stop
    (yes, this _is_ a lot of work)
    If Tcl/Tk, Togl and BMRT are unpacked in sister directories
    of the Mops distribution much less work is required, however!

- issue a
>make

- to compile the Mfio (3DMF) plugin:
>make mf3d
>make mfio.so

Now mops should be compiled and ready for a test run.
-try it:
>./mops

If all went fine, you can now install The Mops:
>make install

Now read "Setup.txt" to learn how to customize The Mops.


3. Compiling a Wrapped Standalone Version of The Mops
-----------------------------------------------------

3.1 Step 1 - Requirements
-------------------------

The following requirements _must_ be met to compile a wrapped standalone
version of The Mops:

- ANSI-C-compiler (gcc preferred)
- Tcl/Tk (atleast V8.2.1)
  ftp://ftp.scriptics.com/pub/tcl/
  Note, that you do not need to _install_ Tcl/Tk to compile and use
  the wrapped standalone version of The Mops. But compiling this Tcl/Tk
  is still necessary.
  Note also, that since Togl is a Tk-Widget that needs internal
  Tk-headers to be compiled and we need static versions of Tcl and Tk,
  it is _not sufficient_ to just have an installed Tcl/Tk on your system,
  please _get the source distribution_ of Tcl/Tk. 
- A zip utility that understands the -A option (zip2.2 does).
- A base64 encoder and tail.
  With this encoder (e.g. juju from:
  ftp://crydee.sai.msu.ru/zeus/unix/Mail/juju-0.4.5.tar.gz)
  you need to encode all button images and strip with tail the leading
  5 lines (containing the header) from them, e.g. with tcsh:

  > cd mops; mkdir base64-buttons; cd buttons;
  > foreach i (*.gif)
  > juen -a $i | tail +6 >! ../base64-buttons/$i
  > end

- Wrap0.3
  http://purl.oclc.org/net/nijtmans/wrap.html
  Please compile a static "libz" and a wrapped "tclsh" using wrap,
  and do not "make clean" afterwards. Note, that Makefile.wrapped
  is tuned to be used with Wrap0.3. If you use newer versions you
  will likely have to adapt the mops: and mopswrap: targets.
- OpenGL
  (Mesa may be used as replacement for a real OpenGL, however,
   preview of trimmed NURB patches is not possible with the
   current Mesa)
  http://www.mesa3d.org/
- Togl
  http://www.mesa3d.org/brianp/Togl.html
  Compiling Togl is tricky with Tcl/Tk versions higher than
  8.0.4. The suggested way is to:
  - delete all headers from the Togl distribution except for
    "togl.h" of course
  - modify the Togl Makefile to look into the Tk source distribution
    for headers
  - modify togl.c to include "tkInt.h" regardless of the Tk version
- BMRT2.5 (ri.h, slc.h, libribout.a, libslcargs.a)
  http://www.bmrt.org/
or
- The Affine Toolkit
  http://www.affine.com/


Note, that BMRT's libribout.a and libslcargs.a come as binary only,
they might not be available on your platform!
If BMRT is not available on your platform you can still
compile The Mops with the Affine Toolkit with
reduced functionality, read: no parsing of shaders.
Get the Affine Toolkit from http://www.affine.com/.
Hint: The required libsribw.a (simple RIB writer) is compiled
from write.c and constant.c in the subdir sribw of the Affine Toolkit.


3.2 Step 2 - Compiling
----------------------

You have all required software and compiled it successfully?
Please verify that by compiling and running a Togl example program
from the Togl distribution _before_ going any further.

- copy Makefile.wrapped to Makefile
>cd src
>cp Makefile.wrapped Makefile

- edit the Makefile:
  + choose the installation directories
  + choose your compiler
  + set appropriate CFLAGS
    (but be sure to choose CFLAGS _with_ -DMOPSSTANDALONE _and_
     -DMOPSWRAPPED)
    if you are using the Affine Toolkit as libribout replacement
    add -DMOPSHAVEAFFINE
  + configure _all_ other parts (yes, this _is_ a lot of work)
    If Tcl/Tk, Togl and BMRT are unpacked in sister directories
    of the Mops distribution much less work is required, however!

- issue a
>make

- to compile the Mfio (3DMF) plugin:
>make mf3d
>make mfio.so

Now mops should be compiled and ready for a test run.
-try it:
>./mops

If all went fine, you can now install The Mops:
>make install

Now read "Setup.txt" to learn how to customize The Mops.

End of Installation Instructions
