This INSTALL file describes how to compile all the binaries (Linux,
MS-DOS, Win32 (Cygnus and Mingw32)) with Linux and how to install them 
in your system.


1. UNIX (Linux) binaries

 (a) create:
     + Linux binaries (x86, libc-5.4.23, ELF) of LMPC and DEMcut are included 
       in the `Linux Binary Package' and the `Full Package' but you can also
     + edit Makefile and src/Makefile (if you like) 
     + type `make unix' 
 (b) install:
     + type `make install' as root


2. MS-DOS binaries

 (a) create:
     + MS-DOS binaries of LMPC and DEMcut are included in the `MS-DOS
       Binary Package' and in the `Full Package' but you can also 
     + get the cross-compiler from
       - ftp://sunsite.unc.edu/devel/msdos/binutils-2.6.go32.tar.gz
       - ftp://sunsite.unc.edu/devel/msdos/djdev200.go32.tar.gz
       - ftp://sunsite.unc.edu/devel/msdos/gcc-2.7.2.go32.tar.gz
     + install the cross-compiler
     + edit Makefile and src/Makefile (if you like)
     + type `make dos'
 (b) install:
     + copy bin/lmpc.exe and bin/demcut.exe anywhere you can use it from MS-DOS
     + if you don't have a DPMI server (DOSemu, QEMM) copy bin/cwsdpmi.exe in
       your PATH
     + you need a MS-DOS Perl to use DEMA (The DEM Text File Analyser)


3. Win32 (Cygnus) binaries 

 (a) create:
     + Win32 (Cygnus) binaries of LMPC and DEMcut are included in the 
       `Win32 (Cygnus) Binary Package' and in the `Full Package' but you can 
       also follow the hints in Appendix B below to compile a Win32 (Cygnus) 
       executable with a Linux system
 (b) install:
     + copy bin/lmpc32.exe and bin/demcut32.exe anywhere you can use it from
       Windows95 or WindowsNT
     + if you don't have the cygwin.dll (version b17.1) get it from
       ftp://ftp.cygnus.com/pub/gnu-win32/ and copy it anywhere the programs
       can read it in (C:\WINDOWS\SYSTEM or the current directory)
     + you need a Win32 Perl to use DEMA (The DEM Text File Analyser)


4. Win32 (Mingw32) binaries

 (a) create:
     + Win32 (Mingw32) binaries of LMPC and DEMcut are included in the 
       `Win32 (Mingw32) Binary Package' and in the `Full Package' but you 
       can also follow the hints in Appendix B below to compile a Win32 
       (Mingw32) executable with a Linux system.
 (b) install:
     + copy bin/lmpcm.exe and bin/demcutm.exe anywhere you can use it from
       Windows95 or WindowsNT
     + you need a Win32 Perl to use DEMA (The DEM Text File Analyser)


5. Additional compilation hints

You need lex and yacc to compile the package. I compile it with flex version 
2.5.2 and GNU Bison version 1.25 because they were included in my S.u.S.E.
Linux 4.2 (June '96). This is my first language parse project. Therefore I 
have no idea if it may compile with other versions too. I don't provide 
precompiled C-files. They tend to be very long and can recreated easily.

You can create the included binaries with Linux only. You may succeed
compiling the source with djgpp for MS-DOS or even with the CDK under WindowsNT
but it is not supported at all. Compiling the source on a (non-Linux) UNIX 
workstation should be possible. As far as I know I removed all 
endian-dependence in the code. 


6. Compiling speed

The whole process of compiling Linux, MS-DOS and Win32 (Cygnus and Mingw32) 
binaries of LMPC and DEMcut, the creation of the documentation for the 
distribution packages (doc, txt) and the packaging itself takes at my 
P133 3 minutes and 15 seconds.


Appendix A

Now I'll describe very shortly how to build LMPC executables for Windows95 and
WindowsNT with Linux. 

First of all: I don't use neither Windows95 nor WindowsNT. My computer is
an almost "Linux only" box. I have to admit that I use DOSemu and Wine 
(Windows emulator) from time to time.

UNIX is able to create executables for Win32 with a cross-compiler from
Cygnus Support (info@cygnus.com). They added a new target system (win32) to 
the well-known GNU C compiler. 

The executables created with the cross-compiler need a special DLL 
(cygwin.dll) to run. This DLL works between the program and the OS. It 
emulates a UNIX behaviour for the compiled programs and a Win32 behaviour
for the underlying OS. 

Get the Cygnus Developers' Kit (CDK) (known as GNU-WIN32/CYGWIN32 too) from
ftp://ftp.cygnus.com/pub/gnu-win32/

Get the file cdksrc.tar.gz (release b17.1 is 26254103 bytes long) or the 
splitted version and unpack it into a directory (/usr/src/cdk). 
Get the newest version of cygwin.dll (release b17.1 is 3046367 bytes long)
from the same place and put it in your DLL directory (something like 
C:\WINDOWS\SYSTEM or the like). 
Get the newest version of mingw32.

Go to the CDK directory and configure the whole package with

./configure --target=i386-pc-cygwin32 --prefix=/usr/cdk

This should give you
a. a progress message (you may have an other machine type)
>Configuring for a i586-pc-linux-gnu host.

b. a warning (ignore it)
>*** This configuration is not supported in the following subdirectories:
>     tcl tk expect target-libgloss gdb
>    (Any other directories should still work fine.)

c. a second progress message
>Created "Makefile" in /usr/src/cdk using "config/mh-linux"
>Links are now set up to build a cross-compiler for i386-pc-cygwin32
>  from i586-pc-linux-gnu.

Make it with

make

This may take a while. It is interesting to look at the PIDs in an other
window. The process IDs easily exceed the 16 bit mark and start over again.

It may stop with an error. The most important file is gcc/xgcc. If this file
exists everything is OK and you can install the whole package with 

make install

This should generate some missing libraries and stop again with an error.

The CDK comes with its own libc: newlib. This newlib is a bit different from
other C-libraries but LMPC should compile relatively cleanly with it.

The src/Makefile of LMPC should be adapted to the location of the new 
`cross-gcc'. Than do a

make win 

in the LMPC main directory and voila ... bin/lmpc32.exe and bin/demcut32.exe
are the new Win32 executables.


Appendix B

Minimalist GNU Win32 package (Mingw32)

My programs are (from a programmers point of view) so simple, it is even 
possible to compile a version without the cygwin.dll and use the standard C 
library functions provided in crtdll.dll. This makes a package called 
Minimalist GNU Win32 (Mingw32) package possibe.

Mingw32 is an add-on to the standard Cygnus package. It won't run 
without the Cygnus compiler. The idea behind Mingw32 is the existence of
the crtdll.dll in all Win32 environments. This DLL provides lots of standard
C library functions and Mingw32 changes the Cygnus package is such a way,
that this DLL is linked instead of cygwin.dll. There are some drawbacks,
because important functions as strsep or gettimeofday are missing in
crtdll.dll but in general the GNU C library source helps a lot in such
cases. Users report a bit slower execution of lmpcm.exe in comparision to 
lmpc32.exe.

Get the newest version of Mingw32 from
http://www.fu.is.saga-u.ac.jp/~cdin/gcc.html
You need mingw32_013.tar.gz.

The problem is now to install Mingw32 and get it to work with the Cygnus GCC. 
The readme.txt file is not of large help, because it deals with WindowsNT only.

Unpack it in /usr/cdk/i386-pc-mingw32, right next to 
/usr/cdk/i386-pc-cygwin32.
Now create a new directory /usr/cdk/lib/gcc-lib/i386-pc-mingw32 with the
subdirectory /usr/cdk/lib/gcc-lib/i386-pc-mingw32/cygnus-2.7.2-961023
and copy (or symlink) all necesarry files required in such a directory.
If you don't know what all this means look in your gcc man page under
cross-compiling or any standard book on GNU development tools.

You need especially cc1, cpp, libgcc.a from the standard Cygnus package and
lib*.a, *crt*.o, and specs from the Mingw32 directory.

The src/Makefile of LMPC should be adapted to the location of the new
`cross-gcc'. Than do a

make mingw

in the LMPC main directory and voila ... bin/lmpcm.exe and bin/demcutm.exe
are the new Win32 executables. They have more or less the same size as
the standard Cygnus binaries but the don't need cygwin.dll any more.

Beta test users report a totally broken demcutm.exe. I have no idea and no
possibility to check it. Until nobody finds the problem, it will remain.

Uwe Girlich
