emerge the following packages to create a development environment:
dev-util/xmingw-binutils
dev-util/xmingw-gcc
dev-util/xmingw-runtime
dev-util/xmingw-w32api
app-emulation/wine
Use the following as a template for win32 makefiles:
CC=i386-mingw32msvc-gcc
CFLAGS=-O2 -pipe -std=c99 -mno-cygwin -mno-sse -mno-sse2 -mno-mmx -mthreads -DWIN32 -D_WIN32 -D_WINDOWShelloworld.exe: helloworld.o
$(CC) $(CFLAGS) -luser32 -o $@ $?helloworld.o: helloworld.c helloworld.h
$(CC) $(CFLAGS) -o $@ -c $<
NOTE: Now is not a good time to rice out your cflags. Debugging win32 code is hard enough without the compiler playing tricks on you.
To test your new win32 program:
wine ./helloworld.exe
Part 2 will talk about how to create win32 DLLs and import libraries.
*EDIT* I’m sick of all the lame losers out there that keep spamming my blog, so no more comments until something can be worked out
I had to use gcc-3.4.4-r1 to compile xmingw-binutils, because 4.0.2-r2 gives an error. If someone is interested I’ll retry and post the exact message.
The hard part would be to setup all the libraries and such I’d guess.
Like it’d be cool for when KDE 4 comes around to be able to make the Windows builds on Linux. But then you’d need to have loads of supporting libraries and such to compile something like amaroK.
Hopefully I’m wrong though. 🙂
That’s a fairly broken way to do it. The standard toolchain ebuilds really just need to be fixed to handle creating a windows cross-compile toolchain.