Build Win32 Minetest including all required libraries

= Common =

CMake (Windows version)
You need to install CMake for all versions. It is recommended to use the GUI.

= Mingw32 build =

mingw32 (tested 0.6.2-beta-20131004-1)

 * Select following packages:
 * mingw32-base
 * mingw32-gcc-g++
 * msys-base
 * mingw32-libz-dev
 * mingw32-gettext-(dev/bin/dll)
 * mingw32-iconv-(dev/bin/dll) aka mingw32-libiconv-(dev/bin/dll)
 * msys-patch
 * msys-w32api
 * Make sure C:\mingw\bin is in system path variable

Libidn 2.0.9 (dependency only for curl 7.36)
./configure make make install
 * Extract package
 * Open msys console
 * Enter package path

curl-7.33.0
./configure --prefix=/mingw --with-winssl --enable-ipv6 make
 * Extract package
 * Open msys console
 * Enter package path

curl-7.36.0
export OPENSLL_PATH='C:\Program Files (x86)\OpenSSL-Win32' ./configure --prefix=/mingw --with-winssl --enable-ipv6 cd lib make -f Makefile.m32 SSL=1 IP6=1
 * Make sure you have libidn installed
 * Download and install Openssl sdk package 1.0.1g or newer
 * Open msys console
 * Add OPENSLL_PATH as environment variable pointed to openssl sdk build folder
 * Enter package path

gettext
Use version from MinGW.

libogg-1.3.1
./configure --prefix=/mingw make make install
 * Extract package
 * Open msys console
 * Enter package path

libvorbis-1.3.3
./configure --prefix=/mingw make make install
 * Extract package
 * Open msys console
 * Enter package path

luajit-2.0.2
1) Preparation: apply patch diff -Naur LuaJIT-2.0.2/src/lib_package.c LuaJIT-2.0.2-old//src/lib_package.c --- LuaJIT-2.0.2/src/lib_package.c	2013-10-20 16:11:52 +0000 +++ LuaJIT-2.0.2-old//src/lib_package.c	2013-10-20 16:13:28 +0000 @@ -76,9 +76,8 @@ #ifndef GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS  #define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS  4  #define GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT  2 -BOOL WINAPI GetModuleHandleExA(DWORD, LPCSTR, HMODULE*);  #endif - +WINBASEAPI BOOL WINAPI GetModuleHandleExA(DWORD, LPCSTR, HMODULE*);  #undef setprogdir  static void setprogdir(lua_State *L)
 * Extract package
 * Open msys console
 * Enter package path

2) Build make

zlib
Use MinGW version.

1) Fix serialization.cpp to not set ZLIB_WINAPI in case of __MINGW32__ is defined.

DirectX SDK (tested with June 2010 version)
Download the DirectX SDK from Microsoft and install it.

Irrlicht 1.8.1
Download the official SDK, as it contains precompiled builds.

Irrlicht 1.8

 * Extract package

1) Edit Irrlicht's Makefile

1.1) Add DirectX SDK include path to CXXINCS using -I"path"

1.2) Add DirectX SDK library path to CXXINCS using -L"path"

1.3) Enable DirectX by commenting the line with NO_IRR_COMPILE_WITH_DIRECT3D_9_

1.4) Add -ldinput8 and -ldxguid to win32 LDFLAGS

1.4) Replace -ld3dx9d by d3dx9

2) Build

cd irrlicht-1.8/source/Irrlicht make win32 NDEBUG=1
 * Open msys console
 * Enter package path

Irrlicht 1.7.3
1) Edit Irrlicht's Makefile
 * Extract package

1.1) add DirectX SDK include path to CXXINCS using -I"path"

1.2) add DirectX SDK library path to CXXINCS using -L"path"

1.3) Enable DirectX by commenting the line with NO_IRR_COMPILE_WITH_DIRECT3D_9_

1.4) Add -ldinput8 and -ldxguid to win32 LDFLAGS

1.4) Replace -ld3dx9d by d3dx9

1.5) Remove -Wl,--no-export-all-symbols from LDFLAGS

1.6) Open IrrCompileConfig.h in include folder and comment #define _IRR_COMPILE_WITH_DIRECT3D_8_

2) Build

cd irrlicht-1.7.3/source/Irrlicht make win32 NDEBUG=1
 * Open msys console
 * Enter package path

libpng-1.6.10
Make sure you have installed libz-dev from MinGW and downloaded libpng pack for GNU/Linux (Windows one don't contains ./configure file) ./configure --prefix=/mingw --enable-shared make make install
 * Extract package
 * Open msys console
 * Enter package path

freetype-2.5.3 (requires libpng)
./configure --prefix=/mingw make make install
 * Extract package
 * Open msys console
 * Enter package path

OpenAL SDK
Install the official SDK, version 1.1.

Minetest
mingw32-make
 * Run CMake and configure correctly
 * Open commandline and enter the following command (if it fails check path, make sure mingw/bin is in there)

= MinGW64 Build =

MinGW64
Download and install.

msys from mingw32
Copy e.g. from mingw32 and make sure path for your msys shell is set to mingw64 compiler!

=VS2012 Build=

Install VS Express 2012

 * Download from Microsoft and install

Irrlicht 1.8

 * Open sln v11 file
 * Build release

libogg

 * Open sln v10 file
 * Convert
 * Build release

libvorbis

 * Open sln v10 file
 * Convert
 * Add libogg include path
 * Add libogg library path
 * Build release (libvorbis/libvorbisfile)

luajit-2.0.2
cd src msvcbuild.bat
 * Extract
 * Build (open vs2012 developer console)

zlib-1.2.8

 * Extract
 * Navigate to the /contrib/masmx86 folder.
 * Open the “bld_ml32.bat” file in a text editor.
 * Add the “/safeseh” switch to both lines in that file (e.g. “ml /safeseh /coff /Zi /c /Flmatch686.lst match686.asm”).
 * zlib uses a Version number declaration that can cause the build process to fail. To fix this, go back to the Solution Explorer, then navigate to zlibvc -> zlibvc.def. Double-click to open.
 * Change the line that reads “VERSION 1.2.8″ to read “VERSION 1.28″.
 * edit iowin32.c comment line "#define IOWIN32_USING_WINRT_API 1"

curl-7.33.0
cd winbuild nmake /f Makefile.vc mode=dll ENABLE_WINSSL=yes ENABLE_IPV6=yes
 * Extract
 * Build
 * Your new build as well as headers is in builds subfolder

freetype-2.5.0

 * Extract
 * Open solution in builds\win32\vc2010
 * Convert
 * Switch "Configuration type" to "dynamic link library"
 * Change target extension
 * Open include/freetype/config/ftconfig.h
 * Add following lines in MSVC block
 * 1) define FT_EXPORT(x) __declspec(dllexport) x
 * 2) define FT_BASE(x) __declspec(dllexport) x
 * Build release

gettext (requires libiconv)
Use the official GNU gettext 0.13.1 win32 build.

libiconv
Use the official GNU libiconv 1.9.1 win32 build.

Minetest
msbuild minetest.sln /p:Configuration=Release /t:Clean,Build
 * Run CMake GUI and configure correctly
 * Open msvc developer console and enter mintest base path