So it's finally time to learn how to compile (On Windows)?

In truth, it's actually very easy. You simply need to remember the names of a few programs and their syntax. And not be scared of a command line. Don't worry--you'll get over that fear eventually!

First grab yourself a copy of MSYS2

MSYS2 is a small system built on Cygwin and MinGW-w64 that you can install under Windows. Very simply, you get bash and a package manager. Easy stuff!

To download, head over to the MSYS2 website and follow the installation instructions. You don't have to view the "Detailed MSYS2 install guide", unless you're curious.

Now install what you need for compiling Kart!

Issue the following command into MSYS2, for 64-bit compiling, pacman -S git mingw-w64-x86_64-make mingw-w64-x86_64-gcc For 32-bit, replace x86_64 with i686 and add mingw-w64-i686-nasm to the command line.

Prepare to compile

Issue the following command to add x86_64 and i686 binaries to your PATH. echo 'export PATH="$PATH:/mingw64/bin:/mingw32/bin"' >> ~/.bash_profile And restart MSYS2.

PATH is an enviroment variable--simply a value that is exported to all programs run--which determines where programs can be found.

Actually compile

Yes, it's time! Issue the following command to clone the SRB2Kart Public git repository. git clone https://git.magicalgirl.moe/KartKrew/Kart-Public.git For any other repository, go to that project's webpage and look for its clone URL. The HTTPS URL is easiest to work with.

git is a version control system--a fancy way of saying "keeping track of who did what".

Now issue cd Kart-Public/src This puts you into the source code directory of SRB2Kart. From here you can actually compile.

Now issue the following command to compile a 64-bit executable. CC=x86_64-w64-mingw32-gcc CFLAGS="-Wno-error=format" mingw32-make.exe MINGW64=1 SDL=1 NOUPX=1 NOOBJDUMP=1 WINDOWSHELL=1 You can also compile faster by telling Make to run more "jobs" at once--simply add -j followed by the number of jobs you wish to use. A good starting number is the number of cores for your processor. To compile a 32-bit executable, replace x86_64 with i686 and change MINGW64 to MINGW

Setting CC is required to tell Make which compiler to use. This is most necessary when you have multiple compilers installed. E.g. 64 and 32 bit.

Setting CFLAGS like so is not required. But I have put it in the example because of a problem in the source code, which would result in a warning. It's simply easier to suppress the warning rather than fix the underlying problem, currently.

MINGW64=1 or MINGW=1 is required to tell Make that you are compiling under Mingw. The "64" is not related to "-w64" in Mingw-64. SDL=1 tells Make that you are compiling with SDL2. SDL2 is the only supported interface anyway, however.

I have included NOUPX=1 and NOOBJDUMP=1 merely for convinience, as it speeds linking--the final stage of building the program--up. You may need to install additional packages if you leave those out, too. I may add details concerning compiling without those options in the future.

And WINDOWSHELL=1 tells Make that it's operating under cmd. This Make does, another version operates under bash. But I won't go into that here.

If all goes well, you should be told that srb2win.exe was generated. You can find this executable under bin/Mingw/Release for 32-bit, and bin/Mingw64/Release both in the directory above. Simply place one in the appropriate Kart installation directory and it should work fine.

But wait, where are my files?

During the installation of MSYS2, you should have been asked to choose where MSYS2 is installed. The default paths are C:\msys32 for 32-bit and C:\msys64 for 64-bit. If you want to get the path to navigate to under Windows while working in MSYS2, issue the following command pwd This command prints the full path offset from your MSYS2 installation directory.