Skip to content


Browse files Browse the repository at this point in the history
Incorporated Martins msys from scratch notes
git-svn-id: c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jun 26, 2007
1 parent d1b926e commit 92b2cd3
Showing 1 changed file with 245 additions and 0 deletions.
245 changes: 245 additions & 0 deletions INSTALL.t2t
Expand Up @@ -54,6 +54,9 @@ windows application for creating and decompressing files here:

If you wish to prepare your msys environment yourself rather than using
our pre-made one, detailed instructions are provdided elsewhere in this

== Qt4.3 ==

Expand Down Expand Up @@ -747,6 +750,248 @@ $HOME/apps/bin/qgis
If all has worked properly the QGIS application should start up and appear
on your screen.

= Creation of MSYS environment for compilation of Quantum GIS
(including all dark magic involved) =

== Initial setup ==

=== MSYS ===

This is the environment that supplies many utilities from UNIX world in Windows and is needed
by many dependencies to be able to compile.

Download from here:

Install to ``c:\msys``

All stuff we're going to compile is going to get to this directory (resp. its subdirs).

=== MinGW ===

Download from here:

Install to ``c:\msys\mingw``

It suffices to download and install only ``g++`` and ``mingw-make`` components.

=== Flex and Bison ===

Flex and Bison are tools for generation of parsers, they're needed for GRASS and also QGIS compilation.

Download the following packages:

Unpack them all to ``c:\msys\local``

== Installing dependencies ==

=== Getting ready ===

Paul Kelly did a great job and prepared a package of precompiled libraries for GRASS.
The package currently includes:

- zlib-1.2.3
- libpng-1.2.16-noconfig
- xdr-4.0-mingw2
- freetype-2.3.4
- fftw-2.1.5
- PDCurses-3.1
- proj-4.5.0
- gdal-1.4.1

It's available for download here:

Moreover he also left the notes how to compile it (for those interested):

Unpack the whole package to ``c:\msys\local``

=== GDAL level one ===

Since Quantum GIS needs GDAL with GRASS support, we need to compile GDAL
from source - Paul Kelly's package doesn't include GRASS support in GDAL.
The idea is following:
+ compile GDAL without GRASS
+ compile GRASS
+ compile GDAL with GRASS

So, start with downloading GDAL sources:

Unpack it to some directory, preferably ``c:\msys\local\src``.

Start MSYS console, go to gdal-1.4.1 directory and run the commands below.
You can put them all to a script, e.g. and run them at once.
The recipe is taken from Paul Kelly's instructions - basically they
just make sure that the library will be created as DLL and the utility
programs will be dynamically linked to it...

CFLAGS="-O2 -s" CXXFLAGS="-O2 -s" LDFLAGS=-s ./configure --without-libtool --prefix=/usr/local --enable-shared --disable-static --with-libz=/usr/local --with-png=/usr/local
make install
rm /usr/local/lib/libgdal.a
g++ -s -shared -o ./libgdal.dll -L/usr/local/lib -lz -lpng ./frmts/o/*.o ./gcore/*.o ./port/*.o ./alg/*.o ./ogr/ogrsf_frmts/o/*.o ./ogr/ogrgeometryfactory.o ./ogr/ogrpoint.o ./ogr/ogrcurve.o ./ogr/ogrlinestring.o ./ogr/ogrlinearring.o ./ogr/ogrpolygon.o ./ogr/ogrutils.o ./ogr/ogrgeometry.o ./ogr/ogrgeometrycollection.o ./ogr/ogrmultipolygon.o ./ogr/ogrsurface.o ./ogr/ogrmultipoint.o ./ogr/ogrmultilinestring.o ./ogr/ogr_api.o ./ogr/ogrfeature.o ./ogr/ogrfeaturedefn.o ./ogr/ogrfeaturequery.o ./ogr/ogrfeaturestyle.o ./ogr/ogrfielddefn.o ./ogr/ogrspatialreference.o ./ogr/ogr_srsnode.o ./ogr/ogr_srs_proj4.o ./ogr/ogr_fromepsg.o ./ogr/ogrct.o ./ogr/ogr_opt.o ./ogr/ogr_srs_esri.o ./ogr/ogr_srs_pci.o ./ogr/ogr_srs_usgs.o ./ogr/ogr_srs_dict.o ./ogr/ogr_srs_panorama.o ./ogr/swq.o ./ogr/ogr_srs_validate.o ./ogr/ogr_srs_xml.o ./ogr/ograssemblepolygon.o ./ogr/ogr2gmlgeometry.o ./ogr/gml2ogrgeometry.o
install libgdal.dll /usr/local/lib
cd ogr
g++ -s ogrinfo.o -o ogrinfo.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s ogr2ogr.o -o ogr2ogr.exe -lgdal -L/usr/local/lib -lpng -lz -lgdal
g++ -s ogrtindex.o -o ogrtindex.exe -lgdal -L/usr/local/lib -lpng -lz -lgdal
install ogrinfo.exe ogr2ogr.exe ogrtindex.exe /usr/local/bin
cd ../apps
g++ -s gdalinfo.o -o gdalinfo.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdal_translate.o -o gdal_translate.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdaladdo.o -o gdaladdo.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdalwarp.o -o gdalwarp.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdal_contour.o -o gdal_contour.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdaltindex.o -o gdaltindex.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdal_rasterize.o -o gdal_rasterize.exe -L/usr/local/lib -lpng -lz -lgdal
install gdalinfo.exe gdal_translate.exe gdaladdo.exe gdalwarp.exe gdal_contour.exe gdaltindex.exe gdal_rasterize.exe /usr/local/bin

Finally, manually edit ``gdal-config`` in ``c:\msys\local\bin`` to replace the static library reference with -lgdal:
CONFIG_LIBS="-L/usr/local/lib -lpng -lz -lgdal"

=== GRASS ===

Grab sources from CVS or use a weekly snapshot, see:

In MSYS console go to the directory where you've unpacked or checked out sources
(e.g. ``c:\msys\local\src\grass-6.3.cvs``)

Run these commands:
export PATH="/usr/local/bin:/usr/local/lib:$PATH"
./configure --prefix=/usr/local --bindir=/usr/local --with-includes=/usr/local/include --with-libs=/usr/local/lib --with-cxx --without-jpeg --without-tiff --without-postgres --with-opengl=windows --with-fftw --with-freetype --with-freetype-includes=/usr/local/include/freetype2 --without-x --without-tcltk --enable-x11=no --enable-shared=yes --with-proj-share=/usr/local/share/proj
make install

It should get installed to ``c:\msys\local\grass-6.3.cvs``

By the way, these pages might be useful:

=== GDAL level two ===

At this stage, we'll use GDAL sources we've used before, only the compilation will be a bit different.

But first in order to be able to compile GDAL sources with current GRASS CVS, you need to patch them, here's what you need to change:
(you can patch it by hand or use patch.exe in ``c:\msys\bin``)

Now in MSYS console go to the GDAL sources directory and run the same commands as in level one, only with these differences:

+ when running ``./configure`` add this argument: ``--with-grass=/usr/local/grass-6.3.cvs``
+ when calling ``g++`` on line 5 (which creates libgdal.dll), add these arguments: ``-L/usr/local/grass-6.3.cvs/lib -lgrass_vect -lgrass_dig2 -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase -lgrass_I -lgrass_gproj -lgrass_vask -lgrass_gmath -lgrass_gis -lgrass_datetime``

Then again, edit ``gdal-config`` and change line with CONFIG_LIBS
CONFIG_LIBS="-L/usr/local/lib -lpng -L/usr/local/grass-6.3.cvs/lib -lgrass_vect -lgrass_dig2 -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase -lgrass_I -lgrass_gproj -lgrass_vask -lgrass_gmath -lgrass_gis -lgrass_datetime -lz -L/usr/local/lib -lgdal"

Now, GDAL should be able to work also with GRASS raster layers.

=== GEOS ===

Download the sources:

Unpack to e.g. ``c:\msys\local\src``

To compile, I had to patch the sources: in file ``source/headers/timeval.h`` line 13.
Change it from:
#ifdef _WIN32
#if defined(_WIN32) && defined(_MSC_VER)

Now, in MSYS console, go to the source directory and run:

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

=== SQLITE ===

You can use precompiled DLL, no need to compile from source:

Download this archive:

and copy sqlite3.dll from it to ``c:\msys\local\lib``

Then download this archive:

and copy sqlite3.h to ``c:\msys\local\include``

=== GSL ===

Download sources:

Unpack to ``c:\msys\local\src``

Run from MSYS console in the source directory:

make install

=== EXPAT ===

Download sources:

Unpack to ``c:\msys\local\src``

Run from MSYS console in the source directory:

make install

=== POSTGRES ===

We're going to use precompiled binaries. Use the link below for download:

copy contents of pgsql directory from the archive to ``c:\msys\local``

== Cleanup ==

We're done with preparation of MSYS environment. Now you can delete all stuff in ``c:\msys\local\src`` - it takes quite a lot
of space and it's not necessary at all.

= Further help and information =

Expand Down

0 comments on commit 92b2cd3

Please sign in to comment.