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:

:startsh
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
vrs=2.68
wget http://ftp.gnu.org/gnu/autoconf/autoconf-$vrs.tar.gz -O .tmpfile && tar xvf .tmpfile
cd autoconf-$vrs
./configure --prefix=/mingw && make && make install && cd ..

echo Automake
vrs=1.11.1
wget http://ftp.gnu.org/gnu/automake/automake-$vrs.tar.gz -O .tmpfile && tar xvf .tmpfile && rm .tmpfile
cd automake-$vrs
./configure --prefix=/mingw && make && make install
cd ..

echo 7zip
vrs=920
wget http://downloads.sourceforge.net/sevenzip/7za$vrs.zip && mkdir 7zip-$vrs
cd 7zip-$vrs && unzip ../7za$vrs.zip && rm ../7za$vrs.zip
cp 7za.exe /mingw32/bin/
cd ..

echo findutils
vrs=4.4.2-2
wget http://sourceforge.net/projects/mingw/files/MSYS/findutils/findutils-$vrs/findutils-$vrs-msys-1.0.13-bin.tar.lzma
wget http://sourceforge.net/projects/mingw/files/MSYS/findutils/findutils-$vrs/locate-$vrs-msys-1.0.13-bin.tar.lzma
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
vrs=1.7.6-preview20110709
wget http://msysgit.googlecode.com/files/PortableGit-$vrs.7z
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:
SDL http://www.libsdl.org/download-1.2.php
SDL_gfx http://www.ferzkopp.net/Software/SDL_gfx-2.0/
SDL_image http://www.libsdl.org/projects/SDL_image/
SDL_ttf http://www.libsdl.org/projects/SDL_ttf/
FFMpeg-MT http://ffmpeg.zeranoe.com/builds/
gtk+ http://www.gtk.org/download/win32.php
libsndfile http://www.mega-nerd.com/libsndfile/#Download
fluidsynth http://sourceforge.net/projects/fluidsynth/files/

echo SDL
vrs=1.2.14
wget http://www.libsdl.org/release/SDL-devel-$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
vrs=2.0.22
wget http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-$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
vrs=1.2.10
wget http://www.libsdl.org/projects/SDL_image/release/SDL_image-devel-$vrs-VC.zip
unzip SDL_image-devel-$vrs-VC.zip && rm SDL_image-devel-$vrs-VC.zip
cd SDL_image-$vrs
cp -R lib/* /mingw/lib/ && cp -R include/* /mingw/include/
cd ..

echo SDL_ttf
vrs=2.0.10
wget http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-devel-$vrs-VC.zip
unzip SDL_ttf-devel-$vrs-VC.zip && rm SDL_ttf-devel-$vrs-VC.zip
cd SDL_ttf-$vrs
cp -R lib/* /mingw/lib/ && cp -R include/* /mingw/include/
cd ..

echo ffmpeg-mt
vrs=9acffed
wget http://ffmpeg.zeranoe.com/builds/win32/dev/ffmpeg-git-$vrs-win32-dev.7z
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 ..
wget http://ffmpeg.zeranoe.com/builds/win32/shared/ffmpeg-git-$vrs-win32-shared.7z
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
vrs=1.2.5
wget http://sourceforge.net/projects/libpng/files/zlib/$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+
wget http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.22/gtk+-bundle_2.22...
mkdir gtk+
cd gtk+
unzip ../gtk+-bundle_2.22.1-20101227_win32.zip
cp -Rf bin/* /mingw/bin/
cp -Rf include/* /mingw/include
cp -Rf lib/* /mingw/lib
cd ..

echo directx headers
wget http://www.mplayerhq.hu/MPlayer/contrib/win32/dx7headers.tgz
mkdir dxheaders
cd dxheaders
tar xvf ../dx7headers.tgz
cp ./* /mingw/include/
cd ..

echo libsndfile
vrs=1.0.25
wget http://www.mega-nerd.com/libsndfile/files/libsndfile-$vrs.tar.gz
tar xvf libsndfile-$vrs.tar.gz
cd libsndfile-$vrs
./configure --prefix=/mingw
make
make install
cd ..

echo fluidsynth
wget http://sourceforge.net/projects/fluidsynth/files/fluidsynth-1.1.5/fluids...
tar xvf fluidsynth-1.1.5.tar.bz2
cd fluidsynth-1.1.5
./configure --prefix=/mingw
make
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://vilevn.git.sourceforge.net/gitroot/vilevn/vilevn
cd vilevn
./autogen.sh
CPPFLAGS="-I/mingw/include/SDL -I/mingw/include" LDFLAGS=-L/mingw/lib ./configure --prefix=/mingw
make
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.

Reply