Behold, the power of GNU! Photo (CC-BY-SA Demet.

I love Windows. And by “love,” of course, I mean “tolerate grudgingly.” After all, good as Mac OS X is, running Windows means the ability to get the latest-and-greatest graphics drivers, run-on-anything hardware capabilities, promising new multitouch laptops, terrific gaming, wonderful visual tools like vvvv, quick-and-dirty video editing with great tools like Vegas, and Microsoft’s own Xbox360-friendly XNA developer tools. It’s access to cheaper computers, without having to make some of the sacrifices needed on Linux (and Linux is easier to dual-boot and share on Windows than on Mac).

In short, Windows can be a great visualist OS. The problem: to take advantage of much of the open source and free software stuff we love, you need an open toolchain and some of the basics from Linux, UNIX, and OS X that are absent on Windows. Know how free software advocates are constantly, annoyingly, referring to “GNU/Linux”? Well, while that doesn’t trip off the tongue, technically speaking they have a point. And indeed, one might as well say GNU/Mac OS X. It’s GNU, the little free software bits and compiling tools, on which all the most important parts of free and open source software are built.

Earlier this week, I talked about how you could build ffmpeg, the fantastic, free, command-line, do-everything video and audio conversion tool, on Windows. In fact, to do that, you’ll need those GNU goodies. And it turns out that build procedure isn’t all that intuitive. So, here you go – having learned this the hard way myself (I was booting into Linux or Mac OS to run ffmpeg), here’s the procedure.

1. Get MinGW.
MinGW is the “minimalist” port of GNU to Windows. Unlike Cygwin, from which MinGW and MSYS have forked, it’s not a massive pain in the … uh, okay, let’s just get started. Grab the latest automated exe installer from Sourceforge and run it. Pick a directory; c:mingw is a good start. I selected most of the compilers; make sure you include gcc and g++, at least.

2. Get MSYS.
MSYS is your command line; this is what gives you the equivalent of running the Terminal application in OS X, with bash as your shell. Grab the most recent stable MSYS from the same SourceForge site as MinGW; in this case, the file you want is MSYS 1.0.11.

3. Install MSYS and point it at MinGW.
Run the MSYS installer. As it reaches 100%, you’ll see a DOS command line open. Say “yes” to its yes/no questions, and it’ll ask you for the location of MinGW. Here’s the trick: don’t assume case sensitivity. So, even though I’m installed in C:MinGW, I’m going to type in (using UNIX-style forward slashes) “c:/mingw”. Then you’re good to go. If something goes wrong, you actually need to re-run the MSYS installer to fix it. See also ffmpeg’s instructions for MSYS.

4. Install SVN.
Subversion is going to let us grab the latest files. I could use the Windows Subversion, but I definitely want a copy of SVN running from the MSYS command line, too. You’ll find svn binaries for Windows from Tigris. Download that file, uncompress it, make a new directory in c:msys1.0 called “local,” then copy the folders from svn (bin, iconv, licenses, share) into c:msys1.0local. (PS, for more tips, check out the OpenTTD instructions for MinGW.

5. Install coreutils.
Here’s the part that really confused me. Some essential GNU utilities aren’t included in MinGW/MSYS by default, which means a lot of things won’t build. The trick is finding the right package. Browse through the files on MinGW’s SourceForge site. You’re looking for MSYS coreutils, which as of this writing is up to coreutils-5.97-2. You’ll find a number of files with an lzma extension, which you can easily open via the awesome Windows utility 7-zip. What you’re trying to grab is the coreutils file that ends with -ext. The “ext” package includes those files you’re missing. Find that file, decompress it, and copy the files you need from its bin folder to your c:mingw1.0bin. I just went ahead and copies everything, as it includes a lot of essential utilities. (For ffmpeg, you absolutely need “pr.exe.”)

6. Try installing ffmpeg!
If you’ve followed the steps above, one of the things you can install is ffmpeg. Configure won’t work without an essential flag:
./configure --enable-memalign-hack
make install

(If you want to build your ffmpeg libraries as DLLs, you can do –enable-shared.)

Once that’s done, though, you can run ffmpeg from your MSYS prompt. Neat! And you’ll also have a build toolchain that works well with other cross-platform open source projects. Now, go enjoy your game of Team Fortress 2, because you can.

If this makes you nostalgic as it does me, you, like me, are OLD. Photo (CC-BY David Orban.