Compile_MINGW Log in to Edit

THIS DOCUMENT IS SEVERELY OUTDATED.

YOU SHOULD USE MSYS2.

About

The process is rather complicated. As Windows is not a proper POSIX/UNIX system, some software that makes it so should be installed. Most common way to do it is with the help of msys/mingw bundle.

However, you'll also need git, and git comes to windows in form of "msys-git" package. So you'll have two msys installs, one with git and one with build tools.

This is sub-optimal, so you should combine the two. This is explained below.

Pre-requisites

shell and buildtools (bash, gcc, ld, make, etc...)

That is what mingw/msys package does.

http://sourceforge.net/projects/mingw/files/latest/download?source=files

When the installer prompts you to select components, remember to check the box for "MinGW Developer ToolKit" (which should automatically include MSYS).
Note: The installer is a "live" installer, and requires connection to the internet.

wget

Included with mingw/msys.

git

Install it from http://git-scm.com/download/win

Afterwards, edit your MSYS /etc/profile file and include the following

export PATH=$PATH:"/c/Program Files/git/bin"

Now you can use git from msys/mingw.

autotools (autoconf, automake)

Included as part of "MinGW Developer Toolkit".

Libraries

SDL 1.2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#!/bin/sh

#rm SDL-devel-1.2.15-mingw32.tar.gz
if [ ! -f SDL-devel-1.2.15-mingw32.tar.gz ]; then
echo "FILE NOT FOUND"
wget http://www.libsdl.org/release/SDL-devel-1.2.15-mingw32.tar.gz
fi
tar xzvf SDL-devel-1.2.15-mingw32.tar.gz 2>/dev/null
cd SDL-1.2.15
cp bin/SDL.dll $WINDIR
if [ ! -d /mingw/include/SDL ]; then
mkdir /mingw/include/SDL
fi
cp include/SDL/* /mingw/include/SDL
cp lib/* /mingw/lib
cp bin/sdl-config /bin
cd ..

SDL_image 1.2

Requires SDL installed.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

if [ ! -f SDL_image-1.2.12.tar.gz ]; then
echo "FILE NOT FOUND"
wget http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.12.tar.gz
fi
tar xzf SDL_image-1.2.12.tar.gz
cd SDL_image-1.2.12
./configure
make
make install
cd ..

if [ ! -f SDL_image-1.2.12-win32.zip ]; then
echo "FILE NOT FOUND"
wget http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.12-win32.zip
fi
unzip -o SDL_image-1.2.12-win32.zip
cp *.dll $WINDIR

Optional libraries.

libpng

openkb can compile fine without libpng. It is only used to SAVE png files. But some of the tools do require it. You can also edit tools/Makefile and make them not depend on it. Anyways, to install libpng, do this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

echo "zlib"

# zlib
if [ ! -f zlib-1.2.5.tar.gz ]; then
echo "FILE NOT FOUND"
wget http://prdownloads.sourceforge.net/libpng/zlib-1.2.5.tar.gz?download -O zlib-1.2.5.tar.gz
fi
tar xzf zlib-1.2.5.tar.gz
cd zlib-1.2.5
sed -i 's/SHARED_MODE=0/#SHARED_MODE=0/' win32/Makefile.gcc
make -f win32/Makefile.gcc
SHARED_MODE=1 BINARY_PATH=/local/bin INCLUDE_PATH=/local/include LIBRARY_PATH=/local/lib make install -f win32/Makefile.gcc
#./configure
#make
#gcc -shared -o /bin/zlib1.dll -Wl,–out-implib=/lib/libz.dll.a [!em]*.o
cd ..

#exit
echo "libpng"

# libpng
if [ ! -f libpng-1.6.14.tar.gz ]; then
echo "FILE NOT FOUND"
wget http://sourceforge.net/projects/libpng/files/libpng16/1.6.14/libpng-1.6.14.tar.gz/download -O libpng-1.6.14.tar.gz
fi
tar xzf libpng-1.6.14.tar.gz
cd libpng-1.6.14
CPPFLAGS="-I/local/include" CFLAGS="-I/local/include" LDFLAGS="-L/local/lib" ./configure
CPPFLAGS="-I/local/include" CFLAGS="-I/local/include" LDFLAGS="-L/local/lib" make
make install
cd ..

Related

Wiki: CompileGuides

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.