Development:MSYS/MinGW: Difference between revisions

From Adonthell
Jump to navigation Jump to search
m fixed typos
m Reverted edits by Asipicabad (talk) to last revision by Ksterker
 
(3 intermediate revisions by 2 users not shown)
Line 6: Line 6:


The general idea is to create a small Unix-like environment on your Windows system that can host Adonthell, which has its origins in the GNU/Linux world. That way, development on Adonthell can be consistent across platforms without the need to accommodate for radically different build systems and compilers.
The general idea is to create a small Unix-like environment on your Windows system that can host Adonthell, which has its origins in the GNU/Linux world. That way, development on Adonthell can be consistent across platforms without the need to accommodate for radically different build systems and compilers.
__TOC__


== Install MSYS/MinGW ==
== Install MSYS/MinGW ==
Line 27: Line 29:
   echo "export CXXFLAGS=-I/usr/local/include" >> ~/.profile
   echo "export CXXFLAGS=-I/usr/local/include" >> ~/.profile
   echo "export LDFLAGS=-L/usr/local/lib" >> ~/.profile  
   echo "export LDFLAGS=-L/usr/local/lib" >> ~/.profile  
  echo "export SWIG_LIB=/usr/local/share/swig/1.3.29" >> ~/.profile
  echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig"  >> ~/.profile
  echo "export CMAKE_INCLUDE_PATH=/usr/local/include"  >> ~/.profile
  echo "export CMAKE_LIBRARY_PATH=/usr/local/lib"  >> ~/.profile


You can check that they were added correctly with <tt>more ~/.profile</tt>. If you wonder  why we don't use an editor to modify that file: the editor that comes with MSYS is [http://en.wikipedia.org/wiki/Vi vi], which might feel strange if you never used it before. You should consider learning it though, if you don't want to switch between the shell and a graphical text editor just to make small changes to some files.
You can check that they were added correctly with <tt>more ~/.profile</tt>. If you wonder  why we don't use an editor to modify that file: the editor that comes with MSYS is [http://en.wikipedia.org/wiki/Vi vi], which might feel strange if you never used it before. You should consider learning it though, if you don't want to switch between the shell and a graphical text editor just to make small changes to some files.
Line 32: Line 38:
== Install Adonthell Prerequisites ==
== Install Adonthell Prerequisites ==


Now that our minimal unix system is installed, we can install all of Adonthell's [[Development:Dependency Matrix|Dependencies]].
Now that a minimal unix system is installed, you can setup all of Adonthell's [[Development:Dependency Matrix|Dependencies]]. For the most part, just download the source code of the most recent version to a common directory, such as <tt>C:\adonthell-dev</tt>. Then, in the MSYS shell, change into that directory
 
  cd /c/adonthell-dev
 
and extract the archive using the <tt>tar</tt> command. Mind the different program options for different types of archives. E.g.
 
  tar -xzf libtool-1.5.22.tar.gz
  tar -xjf libpng-1.2.8.tar.bz2
 
Unless noted otherwise, change into the directory you just unpacked and run the following set of commands for each dependency:
 
  ./configure --prefix=/usr/local
  make
  make install
 
Some of the dependencies neat special treatment to get them installed, although newer versions might fix these issues. They are listed below.
 
=== Python ===
 
Python doesn't compile without patching the source code. Instead, the following method seems the path with the least resistance:
 
# Download python-2.4.3.msi [http://python.org/ftp/python/2.4.3/python-2.4.3.msi] and execute the installer. Chose a installation directory without whitepace in the pathname,  e.g <tt>C:\Python2.4</tt>
# Download pyMinGW-bin-core-2.4.3.1.zip [http://jove.prohosting.com/iwave/ipython/pyMinGW.html]
# Extract this over your Python installation to replace corresponding files.
# Copy contents of the MinGW folder to the toplevel Python2.4 folder to replace the executables and dll file
# Create links to Python library and header files in MSYS:
 
  ln -s /c/Python2.4/python24.dll /usr/local/bin/python24.dll
  ln -s /c/Python2.4/libs/libpython24.a /usr/local/lib/libpython24.a
  ln -s /c/Python2.4/python.exe /usr/local/bin/python.exe
  ln -s /c/Python2.4/include /usr/local/include/python2.4
  ln -s /c/Python2.4/Lib /usr/local/lib/python2.4
 
=== SDL ===
 
To compile SDL with DirectX support, get the directx-devel package [http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz] from the SDL website and extract into /usr/local . The compile as per standard instructions above.
 
=== zlib ===
 
zlib 1.2.3 doesn't use configure. Instead run the following commands.
 
  make -f win32/Makefile.gcc
  make install -f win32/Makefile.gcc INCLUDE_PATH=/usr/local/include LIBRARY_PATH=/usr/local/lib
  cp zlib1.dll /usr/local/bin/
 
=== Freetype2 ===
 
Version 2.2.1 required those commands to compile
 
  ./configure LDFLAGS="'-no-undefined -L/usr/local/lib'" --prefix=/usr/local
  mingw32-make
  make install
 
=== Libxml2 ===
 
Version 2.2.1 required those commands to compile
 
  ./configure --without-python --prefix=/usr/local
  make
  make install
 
=== libvorbis ===
 
Version 1.1.2 requires a little tweak after the <tt>configure</tt> step. Edit lib/Makefile and replace line
 
  libvorbisfile_la_LIBADD = libvorbis.la
 
with
  libvorbisfile_la_LIBADD = -logg libvorbis.la
 
Then continue with the standard <tt>make</tt> and <tt>make install</tt>.
 
=== libpng ===
 
Version 1.2.8 requires a little tweak after the <tt>configure</tt> step. Edit lib/Makefile and replace line
 
  for ext in a la so; do\
 
with
  for ext in a la; do\
 
Then continue with the standard <tt>make</tt> and <tt>make install</tt>.
 
=== pkg-config ===
 
There is no way to compile pkg-config yourself, as it requires glib 2.0, which in turn requires pkg-config. Instead get the binary version [http://www.gimp.org/~tml/gimp/win32/downloads.html] and extract to /usr/local.


=== CMake ===


Get the binary zip file and place the 'bin', 'doc', 'man' and 'share' directories into /usr/local.


[[Category:Development]]
[[Category:Development]]

Latest revision as of 18:14, 27 November 2010

Adonthell Development on Windows

Overview

This page is largely based on the README.Win32 that comes with Adonthell's source code and describes how to set up an environment for developing Adonthell on Windows. In contrast to latter it doesn't assume that you are a Unix guru already.

The general idea is to create a small Unix-like environment on your Windows system that can host Adonthell, which has its origins in the GNU/Linux world. That way, development on Adonthell can be consistent across platforms without the need to accommodate for radically different build systems and compilers.

Install MSYS/MinGW

Download the following files from the MinGW website and install in this order:

  1. MinGW-5.1.3.exe [1]
  2. MSys-1.0.10.exe [2]
  3. msysDTK-1.0.1.exe [3]

Follow these instructions if you need help with the installation. Afterwards, launch MSys from the Windows Start Menu.

Since MSYS does not include the program more we'll have to create a symlink:

 ln -s /usr/bin/less.exe /usr/bin/more

We also have to set a number of environment variables. To make them persistent, we add them to ~/.profile:

 echo "export CFLAGS=-I/usr/local/include" >> ~/.profile
 echo "export CPPFLAGS=-I/usr/local/include" >> ~/.profile
 echo "export CXXFLAGS=-I/usr/local/include" >> ~/.profile
 echo "export LDFLAGS=-L/usr/local/lib" >> ~/.profile 
 echo "export SWIG_LIB=/usr/local/share/swig/1.3.29" >> ~/.profile
 echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig"  >> ~/.profile
 echo "export CMAKE_INCLUDE_PATH=/usr/local/include"  >> ~/.profile
 echo "export CMAKE_LIBRARY_PATH=/usr/local/lib"  >> ~/.profile

You can check that they were added correctly with more ~/.profile. If you wonder why we don't use an editor to modify that file: the editor that comes with MSYS is vi, which might feel strange if you never used it before. You should consider learning it though, if you don't want to switch between the shell and a graphical text editor just to make small changes to some files.

Install Adonthell Prerequisites

Now that a minimal unix system is installed, you can setup all of Adonthell's Dependencies. For the most part, just download the source code of the most recent version to a common directory, such as C:\adonthell-dev. Then, in the MSYS shell, change into that directory

 cd /c/adonthell-dev

and extract the archive using the tar command. Mind the different program options for different types of archives. E.g.

 tar -xzf libtool-1.5.22.tar.gz
 tar -xjf libpng-1.2.8.tar.bz2

Unless noted otherwise, change into the directory you just unpacked and run the following set of commands for each dependency:

 ./configure --prefix=/usr/local
 make
 make install

Some of the dependencies neat special treatment to get them installed, although newer versions might fix these issues. They are listed below.

Python

Python doesn't compile without patching the source code. Instead, the following method seems the path with the least resistance:

  1. Download python-2.4.3.msi [4] and execute the installer. Chose a installation directory without whitepace in the pathname, e.g C:\Python2.4
  2. Download pyMinGW-bin-core-2.4.3.1.zip [5]
  3. Extract this over your Python installation to replace corresponding files.
  4. Copy contents of the MinGW folder to the toplevel Python2.4 folder to replace the executables and dll file
  5. Create links to Python library and header files in MSYS:
 ln -s /c/Python2.4/python24.dll /usr/local/bin/python24.dll
 ln -s /c/Python2.4/libs/libpython24.a /usr/local/lib/libpython24.a
 ln -s /c/Python2.4/python.exe /usr/local/bin/python.exe
 ln -s /c/Python2.4/include /usr/local/include/python2.4
 ln -s /c/Python2.4/Lib /usr/local/lib/python2.4 

SDL

To compile SDL with DirectX support, get the directx-devel package [6] from the SDL website and extract into /usr/local . The compile as per standard instructions above.

zlib

zlib 1.2.3 doesn't use configure. Instead run the following commands.

 make -f win32/Makefile.gcc
 make install -f win32/Makefile.gcc INCLUDE_PATH=/usr/local/include LIBRARY_PATH=/usr/local/lib
 cp zlib1.dll /usr/local/bin/

Freetype2

Version 2.2.1 required those commands to compile

 ./configure LDFLAGS="'-no-undefined -L/usr/local/lib'" --prefix=/usr/local
 mingw32-make
 make install

Libxml2

Version 2.2.1 required those commands to compile

 ./configure --without-python --prefix=/usr/local
 make
 make install

libvorbis

Version 1.1.2 requires a little tweak after the configure step. Edit lib/Makefile and replace line

 libvorbisfile_la_LIBADD = libvorbis.la

with

 libvorbisfile_la_LIBADD = -logg libvorbis.la

Then continue with the standard make and make install.

libpng

Version 1.2.8 requires a little tweak after the configure step. Edit lib/Makefile and replace line

 for ext in a la so; do\

with

 for ext in a la; do\

Then continue with the standard make and make install.

pkg-config

There is no way to compile pkg-config yourself, as it requires glib 2.0, which in turn requires pkg-config. Instead get the binary version [7] and extract to /usr/local.

CMake

Get the binary zip file and place the 'bin', 'doc', 'man' and 'share' directories into /usr/local.