Build Win32 Minetest including all required libraries

From Minetest Developer Wiki
Revision as of 20:35, 13 April 2014 by Calinou (talk | contribs) (Huge typo fixes, corrections...)
Jump to navigation Jump to search

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)
    • msys-patch
    • msys-w32api
  • Make sure C:\mingw\bin is in system path variable

Libidn 2.0.9 (dependency only for curl 7.36)

  • Extract package
  • Open msys console
  • Enter package path
./configure
make
make install

cURL library (different versions)

curl-7.33.0

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

curl-7.36.0

  • 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
export OPENSLL_PATH='C:\Program Files (x86)\OpenSSL-Win32'
  • Enter package path
./configure --prefix=/mingw --with-winssl --enable-ipv6
cd lib
make -f Makefile.m32 SSL=1 IP6=1

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 (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

  • 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'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

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.10

Make sure you have installed libz-dev from MinGW and downloaded libpng pack for GNU/Linux (Windows one don't contains ./configure file)

  • Extract package
  • Open msys console
  • Enter package path
./configure --prefix=/mingw --enable-shared
make
make install

freetype-2.5.3 (requires libpng)

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

OpenAL SDK

Install the official SDK, version 1.1.

Minetest

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



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

  • 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 the official GNU gettext 0.13.1 win32 build.

libiconv

Use the 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