Datasheet

Create a directory for the MinGW files as follows:
These instructions assume you will install MinGW in
c:\mingw, but you can choose another location
if you like. If you do, make the appropriate changes in the following lines.
c:
mkdir \mingw
cd \mingw
Extract the contents of the tarballs as follows, changing all occurrences of \path\to to the directory
where you placed the downloaded files:
The 7-zip tool is used in this example; remember that its directory must be in the Windows search path.
If you have downloaded more recent versions of any of these files, be sure to make the appropriate file-
name changes. .
7z x \path\to\binutils-2.15.91-20040904-1.tar.gz
7z x \path\to\w32api-3.6.tar.gz
7z x \path\to\mingw-utils-0.3.tar.gz
7z x \path\to\gcc-core-3.4.2-20040916-1.tar.gz
7z x \path\to\mingw-runtime-3.9.tar.gz
7z x -y *.tar
del *.tar
Place c:\mingw\bin in your Windows search path. (See “The Windows Search Path” earlier in this
chapter for more details on setting this.)
Create a directory in which to build Lua. The following lines assume that this will be
c:\dev:
c:
mkdir \dev
cd \dev
Extract the contents. Here’s how to do this if you are using the 7-zip tool:
7z x \path\to\lua-5.1.1.tar.gz
7z x lua-5.1.1.tar
del lua-5.1.1.tar
Drop into the src subdirectory as follows:
cd lua-5.1.1\src
With your Windows text editor, create a new file with the following contents:
gcc -O2 -Wall -c *.c
ren lua.o lua.obj
ren luac.o luac.obj
ren print.o print.obj
gcc -shared -Wl,--export-all-symbols -o lua5.1.dll *.o
strip --strip-unneeded lua5.1.dll
gcc -o lua.exe -s lua.obj lua5.1.dll -lm
gcc -o luac.exe -s -static luac.obj print.obj *.o -lm
17
Chapter 1: Getting Situated
04_069172 ch01.qxp 1/2/07 7:53 PM Page 17