Building ioquake3 on Windows - mingw and msys
Credit to ensiform, kevlarman, Timbo, zinx, and the rest of the ioquake3 IRC crew for walking me through this and holding my hand while I cried and cried.
This will work for Win2K, XP, and Vista.
Win2K only prerequisite:
1) download GDIPlus.dll from Microsoft: http://www.microsoft.com/downloads/details.aspx?FamilyId=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en and put it into c:\temp\
2) run the installer and extract the files into c:\temp\ (it will want to put it somewhere stupid by default)
3) copy GDIPlus.dll into your c:\winnt\system32\ (or c:\windows\system32\) folder, wherever you have your \system32\
4) you need this file for the SVN program ONLY on a Win2K machine--XP and Vista machines DO NOT NEED THIS FILE.
5) you can only COMPILE on Win2K, you cannot PLAY YOUR COMPILED BINARIES on Win2K. Well you can with some tweaking, but check the ipv6 section of the ioquake3 readme for the reason why you can't play on Win2K by default, just compile. The binaries/.exe files you make on a Win2K system will work just fine on WinXP and Vista, though.
Setting up your compilin' environment:
1) download http://downloads.sourceforge.net/mingw/MinGW-5.1.4.exe into c:\temp\mingw\
2) run the installer, all you need is the base install and nothing else; install to default directories, etc.
3) download http://downloads.sourceforge.net/mingw/MSYS-1.0.10.exe into c:\temp\msys\
4) run the installer, run the post-install stuff and make sure you choose the right folder you installed mingw to
5) download http://tortoisesvn.net/downloads into c:\temp\svn\
6) run the installer with all the defaults, reboot when it tells you to
7) go to http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91 and download the latest installer; it should be near the top of the list and named something like "Setup-Subversion-1.5.3.msi"
8) run the installer with all the defaults
9) make the folder c:\msys\1.0\ioq3-source
10) right-click that folder and choose "TortoiseSVN" and then "Settings", under the General section click on the Edit button (lower middle right). This will pop up a config file to edit.
11) search for "enable-auto-props"; it is near the bottom of the config. Uncomment that line. Make sure there is no leading whitespace for the line you uncomment or SVN freaks out.
12) also uncomment all the lines in the "[auto-props]" section, the last section of the config file. Save the config file and then hit the Ok button to close the Settings window.
13) right-click the "ioq3-source" folder again and choose "SVN Checkout", use the URL of repository to be svn://svn.icculus.org/quake3/trunk
14) leave everything else as default and click the OK button; you should start getting source unless svn is down/broken
15) alternatively, you can use the command-line version of svn by opening a command prompt, navigating to c:\msys\1.0\ and then running the following command: "svn co svn://svn.icculus.org/quake3/trunk ioq3-source". You may also do this inside of msys by navigating to / and running the command from there.
1) you can edit c:\msys\1.0\msys.bat to change the LightYellow and NavyBlue colors in your msys console to something like Black and White if you want, just scroll down in the .bat and you should find the color definitions
2) run msys; we need to make sure that your fstab is set to point to mingw in the correct location or if msys post-install setup screwed it up
3) do these commands:
$ cd /
$ cd etc
$ vi fstab
4) you want to make sure that the first line there looks like "C:\MinGW /mingw", mine looked like "C:MinGW /mingw" because the msys setup didn't think c:\ needed that \ in there. It can also look like "C:/MinGW /mingw" and be fine; it just needs one slash or the other between c: and MinGW. If your path/alias looks fine, type ":" then "q" then "!" and hit ENTER. This should quit you out of the editor. You can then type "exit" or just close the msys window to exit.
5) if your path is jacked up, you need to use vi to edit it. Move your cursor over to the "M" and hit the letter "i" (for "insert mode"). Type "\" and then hit the ESC key to exit "insert mode". Type ":" then "w" then "q" then "!". In the lower-left you should see ":wq!". Hit ENTER to save your changes and quit the editor.
6) in case you were wondering, ":" gets you to command mode for the editor, "w" writes/saves the file, "q" quits the editor, and "!" tells the editor to not whine and just do what you tell it to.
7) in case you were also wondering why you couldn't just use notepad or wordpad to edit that straight text file, it's because unix stuff freaks out over invisible characters like "linefeed" and "newline" and windows stuff doesn't really care. So you could risk trying to dink around with that or just have it work the first time with the editor vi.
Compiling the sucker:
1) load msys
2) do these commands:
$ cd /
$ cd ioq3-source/
3) you should see stuff start to happen; do not worry about "/bin/sh.exe: svnversion: command not found" because mingw/msys do not have the "svnversion" command and it's not an issue anyway; it just sets a version number for the junk you're compiling.
4) compiling depends on how much RAM you have and how fast your computer is. So it could go quickly or take forever.
5) when you're done compiling, you should have the compiled files in:
6) you may find that your .exe files are larger than release .exe files from ioquake3; this is because they are fancy and "strip" out the extra debugging information and symbols in the .exe when they make their releases. The larger file is NOT a problem so don't worry about it. If you want to do a "release" style compile, then look for another guide because I sure as hell don't know how to do it. It probably involves editing some makefiles/scripts or something with gcc command line options in the script, I'd guess. You can also use Visual Studio as the .exe seems to be pretty small, but it doesn't generate any dedicated server binary or missionpack DLLs, so I dunno.
1) As of ioquake3 1.36, you may see these errors:
/bin/sh.exe: -c: line 1: syntax error near unexpected token `;'
/bin/sh.exe: -c: line 1: `for i in ; do echo " $i"; done'
make: [targets] Error 2 (ignored)
This can be safely ignored per http://bugzilla.icculus.org/show_bug.cgi?id=3813 "mingw32 shell has problems with empty 'for' loops, problem appears when LDFLAGS is empty"
IPv6 support with wspiapi.h
1) From the ioquake3 README:
Building with MinGW for pre Windows XP
IPv6 support requires a header named "wspiapi.h" to abstract away from differences in earlier versions of Windows' IPv6 stack. There is no MinGW equivalent of this header and the Microsoft version is obviously not redistributable, so in its absence we're forced to require Windows XP. However if this header is acquired separately and placed in the qcommon/ directory, this restriction is lifted.
2) If you do this and release your source, remember to NOT release wspiapi.h along with it as this file is NOT redistributable. You can use it to build your binary, but make sure you do NOT release it or try to GPL it.
3) Win2K, download Windows® Server 2003 R2 Platform SDK ISO: http://www.microsoft.com/downloads/details.aspx?FamilyId=E15438AC-60BE-41BD-AA14-7F1E0F19CA0D&displaylang=en (click the Validate button and then click the Download button that appears in its place after you validate)
4) for the Platform SDK, just do the defaults for installation; you can find wspiapi.h at: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\wspiapi.h
5) WinXP/Vista, download Windows SDK for Windows Server 2008 and .NET Framework 3.5 ISO: http://www.microsoft.com/downloads/details.aspx?FamilyId=F26B1AA4-741A-433A-9BE5-FA919850BDBF&displaylang=en (click the Validate button and then click the Download button that appears in its place after you validate)
6) for the Windows SDK, just do the defaults install folders
7) you do not need to install the Documentation, Samples, or Mobile Tools. Really... it takes 2.2 GB to install everything or "only" 500 MB to install just the headers, libraries, compilers, and regular development tools.
8) you can find wspiapi.h at: C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\wspiapi.h
9) Windows SDK (but not Platform SDK) will install some Visual Studio 9.0 files and leave them littered in your C:\ root. They will all have the same timestamp of 11/7/2007. Feel free to delete these. For reference, the ones I got rid of were:
Using your compiled files:
1) I installed Quake 3 into, say, c:\program files\quake3, then installed the latest patches. I then installed ioquake3 into that same folder. I copied the whole install from c:\program files\quake3 to something like c:\program files\devquake3 so I could mess around and not ruin my regular game install.
2) since the needed SDL and OpenAL .dll files were already installed with ioquake3, all you need to copy over are the .exe and new .dll files when you want to test them in your \devquake3 install.
3) in case you're wondering, for the devquake3 example:
c:\Program Files\devquake3\ <--- put the .exe files here
c:\Program Files\devquake3\baseq3 <--- put the baseq3 .dll files here
c:\Program Files\devquake3\missionpack <--- put the missionpack .dll files here