If you came to this page, then you probably know TeX as either the teTeX packages of your Linux distribution or as the multiplatform TeX Live CD.
TeTeX and TeX Live are developed in tandem, and have Web2c at their core. TeX Live also includes fpTeX for the Windows platform, which is built with Microsoft tools.
However, TeX developers working under Unix may appreciate the option to use the same GNU tools both for Windows and for Unix. Not necessarily to build a complete TeX environment; it may be enough to build specific programs which are to be used in an existing TeX setup.
The MinGW compiler is a version of gcc which, other than CygWin, generates normal Windows executables, which use the Win32 dlls and don't require a Unix emulation layer. This makes porting to MinGW non-trivial.
However, for console programs the difficulties aren't that enormous, and much of the work was already been done by others: at one time, Han The Than, the author of pdf[e]tex, created Windows executables by cross-compiling with the MinGW compiler, and much of Fabrice Popineau's code for Win32/MSVC port can be adapted to the MinGW compiler.
MinGW can be built as a cross-compiler; see the MinGW FAQ. An alternative is to run a native version of MinGW under Windows. To this end, you need to either run MinGW from a CygWin environment or from MSYS (Minimal SYStem), which is a companion project to MinGW. MSYS provides enough of a Unix emulation layer and utilities for running Unix-style configure and make scripts. MSYS is not required for running MinGW-generated executables.
I based my patches on teTeX version 2.0.2 rather than TeX Live simply because that worked best for me. The Windows C sources though are taken from TeX Live 7, with very few changes. The Windows header files have been written from scratch. The Windows make files haven't been used at all. I offer my patches here for download as long as they have not been integrated into the official sources.
At patch time, Windows-specific sources are placed in a subdirectory of their own, where they can't interfere with a Unix build. The assumption is that compilation takes place in separate trees. For a MinGW compile, the Windows sources are added to the build tree at configure time.
Note that there is a slight twist to cross-compiling teTeX because the compilation process needs tools which it generated earlier. Naturally, this will fail when build platform and target platform differ. One solution is to create a native build first, and use the tools generated during the native build instead.
These include TeX, eTeX, pdf[e]TeX, MetaFont and MetaPost. Also utilities such as pltotf, kpsewhich, dvips and afm2tfm.
I did not try to build Omega and related programs, or the mktex... programs, or any kind of previewer. Additional patches to support some of these are welcome.
Unix:
Windows:
set BISON_HAIRY=/d/MinGW/share/bison/bison.hairy set BISON_SIMPLE=/d/MinGW/share/bison/bison.simple
Note. I am no expert in any of this. I just describe how I got things to work. There may be better ways.
I originally used Debian Woody, which contains the gcc 2.95 toolchain. On the MinGW website, I picked gcc sources matching my system's gcc, and tried to match the other components date-wise as far as possible. This resulted in the following set:
At the moment, I run Debian Sarge/Unstable with gcc 3.2.3 and simply use current versions of everything:
Moving from gcc 2.95 to gcc 3.2 required no changes in the patches themselves, but did require one change in the configure script tetexcfg.cross, which is indicated in a comment.
On the Windows side, I run Windows NT4 under VMware. Versions:
An aside: although running inside a virtual machine means a performance hit, this is outweighed by the convenience of easy creation of a fresh machine simply by copying a directory. Theoretically, it would have been even more convenient to keep all files in Linux directories, making them available to the virtual machine via Samba. However, this had a very bad impact on performance. So for compilation I copy things back and forth, although I do test via (virtual) Samba shares; see below.
For testing the mingw executables I added a directory teTeX/bin/win32 to my regular teTeX installation and I put the generated executables in there. I made the entire teTeX tree available to Windows via a Samba share. In a Windows console window, I added this directory to the searchpath and defined an environment variable TEXMFCNF for the texmf/web2c directory of the teTeX tree (<drive letter>\...\web2c). This isn't exactly a fully functional TeX installation, but I was able to run the following tests:
Testing file searching:
kpsewhich cmr10.tfm
Creating a format file (somehow, the Linux format files don't work, which I find surprising and somewhat worrying):
pdfetex -ini latex.ltx
Using this format file:
pdfetex ^&latex test
If your testfile tries to use T1 encoding, you may have to do something first about ec fonts:
Generating a MetaFont format file:
mf --jobname=mf --ini "\input plain input modes dump"
Generating ecrm1000.mf:
Borrow mktexmf.exe, geturl.dll, kpathsea.dll, libmktex.dll and
regex.dll from the TeX Live 7 cd and type
mktexmf ecrm1000
Generating ecrm1000.tfm:
Borrow mktextfm.exe from TeX Live 7 and type:
mktextfm ecrm1000
Last updated: May 5 2003