Wine Makefile for Charles Petzold's Example Programs
Dimitrie O. Paun
dimi at intelliware.ca
Wed Mar 12 16:02:10 CST 2003
For the past few weeks, I've been working with John Kopplin on
getting the Petzold examples compiling under Wine using his
Gnu Makefile package, available from:
It took some work, but we've done it. The good news is that
all (but 3) examples compile just fine. This has been accomplished
while making absolutely _no_ changes to the original source, and
very few (and obvious) changes to the GNU Makefiles.
This is very good news, as it shows we can have a common build
system between Wine and Windows. The only samples that don't
work just yet are those from Chap21 which build DLLs, and DLL
creation is yet not supported by winegcc. I hope this will change
in the near future.
The problems that needed fixing were very simple, and quite
obvious. They fall into 2 categories:
1. The samples expect to link with the msvcrt, not the
Unix libc, so we had to pass the -mno-cygwin flag
to the compiler/linker. Under mingw this is the default
behaviour. This change is actually beneficial for
the Windows port as well, as it will allow the samples
to be build using Cygwin's gcc also. As such, it
should be considered a portability fix, rather than
a Wine specific fix.
2. The filnames used mixed case (not matching the actual
name on disk), and some includes use backslash (\),
intead of forward slash (/). This problem is typical
and simple to address in a portable manner if you
can modify the source. As we wanted to not touch
the examples in any way, we had to find another way
around it. Luckily, Unix accepts virtually any char
in a filename (except / of course), as well as links.
So we just created the appropriate symbolic links
where necessary, or just renamed the file if it made
All these renames / symlinks creation was collected in a nice
little intallation script. So, without further delay, here
are the instructions on how to try the sample under Wine.
(place the Petzold CD in the CDROM drive)
$ mount /mnt/cdrom
$ mkdir petzold
$ cd petzold
$ cp -r /mnt/cdrom/* .
$ wget http://www.computersciencelab.com/Petzold.zip
$ unzip -a Petzold.zip
$ bash Wine/install.sh
P.S. As usual, comments, suggestions, and/or flames are more than welcomed!
More information about the wine-devel