Skip to main content

History: Build OGRE dependencies using MSYS

Source of version: 3 (current)

Copy to clipboard
            Original version by Trevor Dearham (WhiteKnight)

!MinGW And MSYS
!!Packages Used For MinGW
{MONO()} autoconf-2.59
 automake-1.9.6
 binutils-2.16.91
 gcc-core-3.4.4
 gcc-g++-3.4.4
 gcc-g77-3.4.4
 gettext-0.14.1
 libiconv-1.9.2
 libtool-1.5.20
 mingw-runtime-3.9
 mingw-utils-0.3
 w32api-3.5{MONO}

!!Packages Used For MSYS
{MONO()} bison-2.0
 flex-2.5.4a
 perl-5.6.1
 MSYS-1.0.11
 pkg-config-0.20
{MONO}

!!Where To Get Packages From
-+mingw-runtime-3.9+- and -+w32api-3.5+- where obtained from [http://www.mingw.org/download.shtml|MinGW]. -+pkg-config-0.20+- can be obtained from [http://www.gimp.org/~tml/gimp/win32/downloads.html|GTK+ for Windows]. The rest where from the package -+mingw-install-20050907.tar.gz+- obtained from [https://sourceforge.net/project/showfiles.php?group_id=148008|MinGW-install].

-- Link for acquiring pkg-config seems obsolete, fresher link at 2009/10/15 is [http://www.gtk.org/download-windows.html]

!!Installing Packages
# Uncompress -+mingw-install-20050907.tar.gz+-
# Move -+mingw-runtime-3.9.tar.gz+- and -+w32api-3.5.tar.gz+- into the -+mingw-install-20050907/mingw+- directory
# Delete -+ming-runtime-3.8.tar.gz+-, -+w32api-3.3.tar.gz+- and -+zlib-1.2.3-20050723-1.tar.gz+-, which are in the -+mingw-install-20050907/mingw+- directory
# Run -+mingw-install-20050907/setup/MSYS-1.0.11-2004.04.30-1.exe+-
# Yes to the continue with post install question.
# No to the do you have MinGW installed question.
# Run MSYS
# Using MSYS run -+mingw-install-20050907/msys/install.sh+-
# Using MSYS run -+mingw-install-20050907/mingw/install.sh+-
# Uncompress -+pkg-config-0.20.zip+- into "your MSYS directory"/1.0 e.g. -+msys/1.0+-
# Copy -+/share/aclocal/pkg.m4+- to -+/mingw/share/aclocal/+-
# Then similar to Step 4 of [http://mail.gnome.org/archives/gtk-devel-list/2005-January/msg00091.html|this link]:

{DL()}
1. Create a file -+/bin/pkg-config.sh+-, with the contents
{DL}

{CODE(wrap="1", colors="bash")} #!/bin/sh
 if pkg-config "$@" > /dev/null 2>&1 ; then
   res=true
 else
   res=false
 fi
 pkg-config "$@" | tr -d \\r && $res{CODE}
2. Make a copy of -+/etc/profile+-, in case something goes wrong, and then open -+/etc/profile+- and change line 43 from:
{MONO()}export HOME LOGNAME MSYSTEM HISTFILE{MONO}
to:
{MONO()} PKG_CONFIG=/bin/pkg-config.sh
 PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
 export HOME LOGNAME MSYSTEM HISTFILE PKG_CONFIG PKG_CONFIG_PATH{MONO}
{DL()}
3. Quit msys and then rerun it, so that the environment variables get set.
{DL}

!OGRE Dependencies
!!Packages Used
!!!For OGRE
[http://www.cegui.org.uk/|cegui_mk2-0.4.1]

[http://openil.sourceforge.net/|DevIL-1.6.7]

[http://www.freetype.org/|freetype-2.1.10]

[http://www.ode.org/|ode-0.5]

[http://www.zlib.net/|zlib-1.2.3]

[http://zziplib.sourceforge.net/|zziplib-0.13.44]

[http://developer.nvidia.com/object/cg_toolkit.html|Cg 1.4]

!!!Additional Packages For DevIL
[http://www.ijg.org/|jpeg 6b]

[http://www.littlecms.com/|lcms-1.14]

[http://gjuyn.xs4all.nl/libmng/|libmng-1.0.9]

[http://www.libpng.org/pub/png/libpng.html|libpng-1.2.8]

[http://www.libtiff.org/|tiff-3.7.4]

!!!Additional Package For cegui
[http://xml.apache.org/xerces-c/|xerces 2.7.0]

!!Building Packages
The steps in this section assume that you have uncompressed the relevant package and that you have changed to that directory in MSYS. Also most of these packages, by default, will install to the -+/usr/local+- directory to change this use add -+--prefix={some directory}+- e.g.
{MONO()}--prefix=/mingw{MONO}
to the configure script. Also note that MinGW, by default, will only read includes that are in the -+/mingw/include+- directory and libraries that are in the -+/mingw/lib+- directory. I will show you how to install to the -+/usr/local+- directory, as then this directory will then contain all the dependencies and as a result you will need to manually copy to the includes and libs to the -+/mingw+- directory or use the -+-I+- compiler option to specify the include file directory and the -+-L+- linker option to specify the link library directory.

The steps in this section also assume that you follow the installation of the packages in the order they are listed below.

Also, it is advisable to only keep the library files you wish to use, so if a particular package creates more that on library file, then delete the ones you don't want, e.g. -+zlib+- creates a static library (-+libz.a+-) and a dynamic link library (-+libzdll.a+- for linking at link time and -+zlib1.dll+- for runtime), so pick which one you want to keep and delete the other.

!!!DevIL
!!!!zlib 1.2.3
# Open -+win32/Makefile.gcc+- and change line 34 from:
{MONO()}CFLAGS = $(LOC) -O3 -Wall{MONO}
to:
{MONO()}CFLAGS = $(LOC) -mms-bitfields -O3 -Wall{MONO}
# Run:

{CODE(wrap="1", colors="bash")} mkdir /usr/local
 mkdir /usr/local/include
 mkdir /usr/local/lib
 make -f win32/Makefile.gcc
 INCLUDE_PATH=/usr/local/include LIBRARY_PATH=/usr/local/lib make -f win32/Makefile.gcc install{CODE}

!!!!jpeg 6b


Run:
{CODE(wrap="1", colors="bash")} ./configure CFLAGS=-mms-bitfields
 make
 make install-lib{CODE}

!!!!tiff 3.7.4


{DL()}
1. Open -+jmorecfg.h+- from your -+/usr/local/include+- directory.
{DL()}
1. Change line 161 from:
{MONO()}typedef long INT32{MONO}
to:
{MONO()}typedef int INT32{MONO}
to make it comply with the MS Windows header files.
2. Change line 226 from:
{DL}


{DL}

{CODE(wrap="1", colors="c++")} #ifndef HAVE_BOOLEAN
 typedef int boolean;
 #endif{CODE}
{DL()}
to:
{DL}
{CODE(wrap="1", colors="c++")} //#ifndef HAVE_BOOLEAN
 typedef int boolean;
 //#endif{CODE}
{DL()}
2. Run
{DL}
{CODE(wrap="1", colors="bash")} ./autogen.sh
 ./configure CFLAGS=-mms-bitfields CXXFLAGS=-mms-bitfields
 make
 make install{CODE}
Note: Read -+DevIL+-'s note before building this library.

!!!!libpng 1.2.8
# Get -+libpng-1.2.8-mingwPORT.tar.bz2+- from [http://www.mingw.org/download.shtml|MinGW].
# Uncompress it to the same directory as -+libpng+-.
# Run:

{CODE(wrap="1", colors="bash")} patch -p1 < mingwPORT/mingwPORT.patch
 make -f scripts/makefile.mingw CFLAGS=-mms-bitfields
 make -f scripts/makefile.mingw prefix=/usr/local install{CODE}

!!!!lcms 1.14


{DL()}
1. Open -+include/lcms.h+- and change line 149 from:~pp~typedef unsigned int DWORD, *LPDWORD;~/pp~to:~pp~typedef unsigned long DWORD, *LPDWORD;~/pp~to make it comply with the MS Windows header files.
2. Open -+msys\1.0\mingw\include\sys\stat.h+- and then add the following to line 194:
{DL}

{CODE(wrap="1", colors="c++")} #define S_IXOTH 0000001
 #define S_IXGRP 0000010
 #define S_IXUSR 0000100{CODE}
{DL()}
3. Run:
{DL}
{CODE(wrap="1", colors="bash")} ./configure CFLAGS=-mms-bitfields
 make
 make install{CODE}

!!!!libmng 1.0.9
{DL()}
1. Open -+/usr/local/include/icc34.h+- and change line 236 from: 
{DL}
{CODE(wrap="1", colors="c++")} typedef u_int8_t   icUInt8Number;
 typedef u_int16_t  icUInt16Number;
 typedef u_int32_t  icUInt32Number;
 typedef u_int32_t  icUInt64Number[2];{CODE}
{DL()}
to:
{DL}
{CODE(wrap="1", colors="c++")} typedef unsigned char  icUInt8Number;
 typedef unsigned short icUInt16Number;
 typedef unsigned int   icUInt32Number;
 typedef unsigned int   icUInt64Number[2];{CODE}
{DL()}
2. Open -+makefiles/makefile.mingw+-
{DL()}
1. Change line 20 from:
{CODE(wrap="1", colors="c++")}OPTIONS = -DMNG_NO_CMS -DMNG_ACCESS_CHUNKS -DMNG_STORE_CHUNKS{CODE}
to:
{CODE(wrap="1", colors="c++")}OPTIONS = -DMNG_FULL_CMS -DMNG_ACCESS_CHUNKS -DMNG_STORE_CHUNKS{CODE}
2. Change line 33 from:
{MONO()}#LCMSLIB=-llcms{MONO}
to:
{MONO()}LCMSLIB=-llcms{MONO}
3. Change line 55 from:
{CODE(wrap="1", colors="c++")}CFLAGS=$(ZLIBINC) $(JPEGINC) $(LCMSINC) -Wall -O3 -funroll-loops $(OPTIONS) $(ALIGN){CODE}
to:
{CODE(wrap="1", colors="c++")}CFLAGS=$(ZLIBINC) $(JPEGINC) $(LCMSINC) -Wall -O3 -funroll-loops $(OPTIONS) $(ALIGN) -mms-bitfields{CODE}
{DL}


3. Run:
{DL}
{CODE(wrap="1", colors="bash")} make -f makefiles/makefile.mingw
 make -f makefiles/makefile.mingw install{CODE}
Note: This make install will install to -+/mingw+-.

!!!!DevIL 1.6.7
# Copy -+/usr/local/include/lcms.h+- to -+/usr/local/include/lcms/lcms.h+-
# Change -+/usr/local/include/jmorecfg.h+- line 161 from:~pp~typedef long INT32;~/pp~to:~pp~typedef int INT32;~/pp~to make it comply with the MS Windows header files.
# Run

~pp~ ./autogen.sh
 ./configure CFLAGS=-mms-bitfields
 make
 make install~/pp~
Note: I could only get -+TIF+- to be a supported format was by linking -+tiff+-'s dll files, as -+tiff+-'s static library files have unresovled externals for zlib and jpeg.

!!!cegui
!!!!xerces 2.7.0
# Download the mingw-msys patch from [http://issues.apache.org/jira/browse/XERCESC-1471|here].
# Put the patch in your -+xerces+- directory e.g. -+~/xerces-c-src_2_7_0+-.
# Go to that directory and run:~pp~patch -p1 < xerces-c-src_2_6_0.patch~/pp~
# Run -+export XERCESCROOT={fill in your path to the base of xerces}+- e.g.~pp~export XERCESCROOT=/home/Trevor/xerces-c-src_2_7_0~/pp~Note: Don't use -+~+-, as it will not resolve to being your home directory.
# Then go to -+src/xercesc+- and run:

~pp~ ./runConfigure -p mingw-msys -c gcc -x g++ -z -mms-bitfields
 make
 make install
~/pp~
!!!!freetype 2.1.10


Run:
~pp~ ./autogen.sh
 ./configure CFLAGS=-mms-bitfields
 make
 make install
~/pp~
!!!!cegui 0.4.1


I could only get this to build with the help of [http://www.codeblocks.org/|Code::Blocks], which uses MinGW. I couldn't get MinGW to import and export correctly with MSYS, but it did compile it and therefore it should be possible to build cegui with MSYS.
# Download the patch for cegui [http://sourceforge.net/tracker/index.php?func=detail&aid=1400652&group_id=93749&atid=605424|here] and put it in your cegui source directory.
# Using MSYS run the following from your cegui source directory:~pp~patch -p1 < cegui.patch~/pp~
# Download the latest Code::Blocks project files (CB_mingw_files.zip) from [http://www.cegui.org.uk/modules/newbb/viewtopic.php?topic_id=1219&forum=2|here].
# Extract the Code::Blocks project files to the cegui directory.
# Create a -+dependencies+- directory inside your cegui source directory and inside that directory create an -+include+- and a -+lib+- directory.
# Copy the contents -+freetype+-'s -+include+- directory and -+xerces+-'s -+src+- into -+dependencies/include+- and -+freetype+-'s -+objs\.libs\libfreetype.a+- and -+xerces+-'s -+xerces-c-src_2_7_0\lib\libxerces-c.dll+- into -+dependencies/lib+-.
# Open -+makefiles\win32\CB_Mingw\CEGUI.workspace+- with Code::Blocks.
# Go to -+Build options+- of -+CEGUIBase+-.
## Open the -+Linker+- tab and change -+freetype.dll+- to -+freetype+- and add -+xerces-c+- for both build targets.
## Open the -+Compiler+- tab and then the -+#defines+- tab inside and add the follow define, so that -+xerces+- will be used instead of -+tinyxml+-:~pp~CEGUI_WITH_XERCES~/pp~
# Right click on -+DirectX9GUIRenderer+- and select -+Activate Project+- and then hold down the crtl and shift keys and then press the down arrow until -+DirectX9GUIRenderer+- is below -+FalagardBase+-. Use the sample technique to move -+OpenGLGUIRenderer+- below -+FalagardBase+-. This should allow you to only build -+CEGUIBase+-, -+TaharezLook+-, -+WindowsLook+- and -+FalagardBase+-, as this is all you should need.
# Build the workspace.



Note:
# If you get a link error when building -+CEGUIBase+- which contains the following text: -+undefined reference to inflate, inflateEnd, inflateReset+- and -+inflateInit2_+-, then add open the -+Build options+- for -+CEGUIBase+- and then the -+Linker+- tab and add -+zdll+- and then copy -+libzdll.a+- to -+dependencies/lib+-.
# You don't need to build -+CEGUISampleHelper+-, the samples and the DirectX and OpenGL renderers, and therefore it goes out of the scope of this wiki and therefore above I haven't mention the changes necessary to build them.



!!!OGRE Dependencies Not Already Built
!!!!zziplib 0.13.44
I could only get this to build with the help of [http://www.codeblocks.org/|Code::Blocks], which uses MinGW.
{DL()}
1. Import -+msvc7/zziplib.sln+- into Code::Blocks.
2. Go to the -+Build options+- and select the -+Directories+- tab and then the -+Compiler+- tab inside it and then do the following for all build targets.
{DL()}
1. Add the directory where you have put the include files for -+zlib+-.
2. Add ~pp~..\zzip~/pp~ to the directories list.
{DL}


3. Open the -+Directories+- tab's -+Linker+- tab and then add -+zlib+-'s library file for all buld targets.
4. Open the -+Compiler+- tab's -+Other options+- tab and add the following for all build targets:~pp~-mms-bitfields~/pp~
5. Open -+zzip\_config.h+- and change line 9 from:
{DL}



~pp~ #ifndef ZZIP_HAVE_BYTESWAP_H 
 #define ZZIP_HAVE_BYTESWAP_H  1 
 #endif~/pp~
{DL()}
to:
{DL}



~pp~ //#ifndef ZZIP_HAVE_BYTESWAP_H 
 //#define ZZIP_HAVE_BYTESWAP_H  1 
 //#endif~/pp~
{DL()}
6. Build the workspace.
{DL}



!!!!ode 0.5
# Open -+config/user-settings+-.
## Change line 14 from:~pp~PLATFORM=unix-gcc~/pp~to:~pp~PLATFORM=mingw~/pp~.
## Change line 44 from:~pp~#OPCODE_DIRECTORY=OPCODE~/pp~to:~pp~OPCODE_DIRECTORY=OPCODE~/pp~
# Run:

~pp~ make configure
 make ode-lib
~/pp~
!!!!Cg 1.4


# Using -+MinGW+-, go to -+Cg+-'s -+lib+- directory.
# Run:~pp~reimp -c cg.lib~/pp~

This should create two files, namely -+cg.def+- and -+libcg.a+-.