Build Win32 Minetest including all required libraries

From Minetest Developer Wiki
Jump to navigation Jump to search

Common

cmake (windows version)

You need to install cmake for all versions. I recommend using 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)
    • msys-patch
    • msys-w32api
  • make sure C:\mingw\bin is in system path variable

curl-7.33.0

  • extract package
  • open msys console
  • enter package path
./configure --prefix=/mingw --with-winssl --enable-ipv6
make

gettext

use version from mingw

libogg-1.3.1

  • extract package
  • open msys console
  • enter package path
./configure --prefix=/mingw
make
make install

libvorbis-1.3.3

  • extract package
  • open msys console
  • enter package path
./configure --prefix=/mingw
make
make install

Luajit-2.0.2

  • extract package
  • open msys console
  • enter package path

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)

2) build

make

zlib

use mingw version!

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

irrlicht engine (different versions)

directx sdk

download direct x sdk from microsoft and install

irrlicht-1.8

  • extract package

1) edit irrlicht makefile

1.1) add directx sdk inc path to CXXINCS using -I"path"

1.2) add directx sdk lib path to CXXINCS using -L"path"

1.3) enable direct x 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

  • open msys console
  • enter package path
cd irrlicht-1.8/source/Irrlicht
make win32 NDEBUG=1

irrlicht-1.7.3

  • extract package

1) edit irrlicht makefile

1.1) add directx sdk inc path to CXXINCS using -I"path"

1.2) add directx sdk lib path to CXXINCS using -L"path"

1.3) enable direct x 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

  • open msys console
  • enter package path
cd irrlicht-1.7.3/source/Irrlicht
make win32 NDEBUG=1

libpng-1.6.6

Make sure you have installed libz-dev from mingw

  • extract package
  • open msys console
  • enter package path
./configure --prefix=/mingw --enable-shared
make
make install

freetype-2.5.0 (requires libpng)

  • extract package
  • open msys console
  • enter package path
./configure --prefix=/mingw

Open builds/unix/unix-cc.mk and remove "-ansi" from ANSIFLAGS

make
make install

openal sdk

install official sdk 1.1

minetest

  • run cmake and configure correctly
  • open commandline and enter following command (if it fails check path, make sure mingw/bin is in there)
mingw32-make



Mingw64 Build

mingw64

download install

msys from mingw32

copy e.g. from mingw32 make sure path for you msys shell is set to mingw64 compiler!

TODO all other libs


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 lib path
  • build release (libvorbis/libvorbisfile)

luajit-2.0.2

  • extract
  • build (open vs2012 developer console)
cd src
msvcbuild.bat

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

  • extract
  • build
cd winbuild
nmake /f Makefile.vc mode=dll ENABLE_WINSSL=yes ENABLE_IPV6=yes
  • 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
#define FT_EXPORT(x) __declspec(dllexport) x
#define FT_BASE(x) __declspec(dllexport) x
  • build release

gettext (requires libiconv)

use official gnu gettext 0.13.1 win32 build

libiconv

use official gnu libiconv 1.9.1 win32 build

minetest

  • run cmake gui and configure correctly
  • open msvc developer console and enter mintest base path
msbuild minetest.sln /p:Configuration=Release /t:Clean,Build