Skip to main content

Building the latest VileVN natively under Windows

I'll be taking as many shortcuts as I can so this won't be a long and involved process. I'll also provide instructions to build the most recent vilevn development release in said environment.

First, grab TDM-GCC to use as our mingw base. I would suggest the webdl installer for simplicity's sake. Install the 32-bit version, including all of the compilers (or at least the C, C++, and fortran ones...I don't think the others are used here, but it doesn't hurt to have them). You probably want to uncheck the Add to Path option...I'll show you a good way to work around that.

Next, grab MSYS and unpack it somewhere. Copy the entire contents inside the msys subfolder to the root of your new TDM install. Now, you will want to make a slight tweak to your msys.bat file, so open it up (preferably in notepad++ or pspad or some other text editor that can properly read UNIX line endings). Towards the bottom, find the lines:

if NOT EXIST %WD%sh.exe goto notfound

and add a line below that says:

set PATH=%PATH%;%CD%\bin;%CD%\mingw\bin;%CD%\mingw32\bin

Save and run msys.bat

Now, lets start out by getting the bare essential build tools. You should be able to copy these lines verbatim into your msys shell.

echo Autoconf
wget$vrs.tar.gz -O .tmpfile && tar xvf .tmpfile
cd autoconf-$vrs
./configure --prefix=/mingw && make && make install && cd ..

echo Automake
wget$vrs.tar.gz -O .tmpfile && tar xvf .tmpfile && rm .tmpfile
cd automake-$vrs
./configure --prefix=/mingw && make && make install
cd ..

echo 7zip
wget$ && mkdir 7zip-$vrs
cd 7zip-$vrs && unzip ../7za$ && rm ../7za$
cp 7za.exe /mingw32/bin/
cd ..

echo findutils
mkdir findutils-$vrs && cd findutils-$vrs
tar xvf ../findutils-$vrs-msys-1.0.13-bin.tar.lzma && rm ../findutils-$vrs-msys-1.0.13-bin.tar.lzma
tar xvf ../locate-$vrs-msys-1.0.13-bin.tar.lzma && rm ../locate-$vrs-msys-1.0.13-bin.tar.lzma
cp -R ./* /mingw/
cd ..

echo git
mkdir git-$vrs && cd git-$vrs
7za x ../PortableGit-$vrs.7z && rm ../PortableGit-$vrs.7z
mkdir -p /mingw/bin/git-core/ && cp bin/* /mingw/bin/git-core/
echo '#!/bin/bash' > /mingw/bin/git && echo '/mingw/bin/git-core/git.exe "$@"' >> /mingw/bin/git
cd ..

Now, we need to add our libs. You can check the current versions of each at the following links:

echo SDL
wget$vrs-mingw32.tar.gz -O .tmpfile && tar xvf .tmpfile && rm .tmpfile
cd SDL-$vrs
mkdir -p /mingw/lib
cp -Rf bin/* /mingw/bin && cp -R lib/* /mingw/lib && cp -R include/* /mingw/include
cd ..

echo SDL_gfx2
wget$vrs.tar.gz -O .tmpfile && tar xvf .tmpfile && rm .tmpfile
cd SDL_gfx-$vrs
CPPFLAGS="-I/mingw/include -I/mingw/include/SDL" LDFLAGS=-L/mingw/lib ./configure --prefix=/mingw && make && make install
cd ..

echo SDL_image
unzip SDL_image-devel-$ && rm SDL_image-devel-$
cd SDL_image-$vrs
cp -R lib/* /mingw/lib/ && cp -R include/* /mingw/include/
cd ..

echo SDL_ttf
unzip SDL_ttf-devel-$ && rm SDL_ttf-devel-$
cd SDL_ttf-$vrs
cp -R lib/* /mingw/lib/ && cp -R include/* /mingw/include/
cd ..

echo ffmpeg-mt
7za x ffmpeg-git-$vrs-win32-dev.7z && rm ffmpeg-git-$vrs-win32-dev.7z
cd ffmpeg-git-$vrs-win32-dev
cp -R lib/* /mingw/lib/ && cp -R include/* /mingw/include/
cd ..
7za x ffmpeg-git-$vrs-win32-shared.7z && rm ffmpeg-git-$vrs-win32-shared.7z
cd ffmpeg-git-$vrs-win32-shared && cp -R bin/* /mingw/bin/
cd ..

echo zlib
wget$vrs/zlib-$vrs.tar.bz2 -O .tmpfile && tar xvf .tmpfile && rm .tmpfile
cd zlib-$vrs
cp win32/Makefile.gcc ./Makefile.gcc
sed -i 's/libzdll.a/libz.dll.a/g' Makefile.gcc
sed -i 's/SHARED_MODE=0/SHARED_MODE=1/g' Makefile.gcc
sed -i 's/prefix = \/usr\/local/prefix = \/mingw\nBINARY_PATH=$(prefix)\/bin\nINCLUDE_PATH=$(prefix)\/include\nLIBRARY_PATH=$(prefix)\/lib/g' Makefile.gcc
make -f Makefile.gcc -j4
cp contrib/asm?86/match.S ./match.S
make -f Makefile.gcc -j4 LOC=-DASMV OBJA=match.o
make -f Makefile.gcc install
cd ..

echo gtk+
mkdir gtk+
cd gtk+
unzip ../
cp -Rf bin/* /mingw/bin/
cp -Rf include/* /mingw/include
cp -Rf lib/* /mingw/lib
cd ..

echo directx headers
mkdir dxheaders
cd dxheaders
tar xvf ../dx7headers.tgz
cp ./* /mingw/include/
cd ..

echo libsndfile
tar xvf libsndfile-$vrs.tar.gz
cd libsndfile-$vrs
./configure --prefix=/mingw
make install
cd ..

echo fluidsynth
tar xvf fluidsynth-1.1.5.tar.bz2
cd fluidsynth-1.1.5
./configure --prefix=/mingw
make install
cd ..

And that does it for setting up the build environment. Next, lets build the devel version of VileVN. Please note that building with wx is no longer supported.

mkdir -p VileVN && cd VileVN

echo VileVN Devel
git clone git://
cd vilevn
CPPFLAGS="-I/mingw/include/SDL -I/mingw/include" LDFLAGS=-L/mingw/lib ./configure --prefix=/mingw
cd ..

Now it is just a matter of copying the program and all the libs they use to a single folder. This may get you a few extra libs, but not if you followed my directions closely.

mkdir viledist
cd viledist
cp ../vilevn/vilevn.exe ./
cp ../vilevn/*.ttf ./
cp ../vilevn/*.sf2 ./
cp ../vilevn/*.pck ./
cp /mingw/bin/*.dll ./
cp /mingw/lib/SDL_*.dll ./
cp /mingw/lib/lib*.dll ./
cp /mingw/lib/zlib*.dll ./
cp /mingw/lib/jpeg*.dll ./

So, you have a complete package now sitting in C:\MinGW32\home\username\VileVN\viledist (or similar, depending on your windows username and where you installed TDM-gcc) with the current development release. Say you make some changes to the code or want to try compiling with different options or newer libraries. These are the steps to recompile, starting from your ~/ folder (/home/username):

cd VileVN

echo VileVN Devel
cd vilevn
CPPFLAGS="-I/mingw/include/SDL -I/mingw/include" LDFLAGS=-L/mingw/lib ./configure --prefix=/mingw
make clean && make
cd ..

And then to finish, if you want to overwrite your old build:

cd viledist
cp ../vilevn/vilevn.exe ./

If you have any questions, comments, or have problems getting this to work, let me know by posting in the forum. I currently know about the problems getting videos to playback properly under windows, and am looking into it. If you want to report any bugs, please run with the --verbose option and copy at least the relevant portions of your stdout.txt from the viledist folder. You can post the whole thing if you don't know what you are looking for, but try to limit running the game to the first or second time you run into the error before posting your log so we aren't having to sort through a bunch of unrelated logged messages to find the problem.