<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<article>
  <title>PostGIS 1.1.0 Windows Builds Intructions</title>

  <abstract>
    <para>These article deals with compiling PostGIS 1.1.0 on Windows. The
    tests have been done on a SONY VAIO PCG FR215E and a SONY VAIO VGN FS315H.
    These article has been written by a French guy. So excuse-me for my bad
    English.</para>
  </abstract>

  <section>
    <title>Requirements.</title>

    <para>We need a complete MinGW/Msys distribution on Windows in order to
    build our tools. </para>

    <section>
      <title>MinGW,Msys and MsysDTK</title>

      <para>Donwload the following tools:</para>

      <itemizedlist>
        <listitem>
          <para>MinGW: http://www.mingw.org/download.html (Get version
          5.0.0.exe or 4.0.1.exe)</para>
        </listitem>

        <listitem>
          <para>Msys: http://www.mingw.org/download.html (Get
          version1.0.8.exe)</para>
        </listitem>

        <listitem>
          <para>MsysDTK http://www.mingw.org/download.html (Get
          version1.0.1.exe)</para>
        </listitem>
      </itemizedlist>

      <para>When you install Msys, you will be prompted for free questions (a
      DOS windows will open). Answer by</para>

      <itemizedlist>
        <listitem>
          <para>question 1: y</para>
        </listitem>

        <listitem>
          <para>question 2: y</para>
        </listitem>

        <listitem>
          <para>question 3: c:/MinGW</para>
        </listitem>
      </itemizedlist>

      <para>There are others tools to install</para>
    </section>

    <section>
      <title>Other tools</title>

      <para>Go to the following URL
      http://gnuwin32.sourceforge.net/packages.html. In order to compil
      PostgreSQL, I'm used to using the following tools:</para>

      <itemizedlist>
        <listitem>
          <para>bison</para>
        </listitem>

        <listitem>
          <para>zlib</para>
        </listitem>

        <listitem>
          <para>Flex</para>
        </listitem>

        <listitem>
          <para>GetText</para>
        </listitem>

        <listitem>
          <para>LibIconv</para>
        </listitem>
      </itemizedlist>

      <para>Install them to c:\MinGW.</para>
    </section>

    <section>
      <title>Resume</title>

      <para>The versions used here for the tools above are</para>

      <itemizedlist>
        <listitem>
          <para>MinGW MinGW-5.0.0.exe</para>
        </listitem>

        <listitem>
          <para>Msys MSYS-1.0.8.exe </para>
        </listitem>

        <listitem>
          <para>MsysDTK msysDTK-1.0.1.exe</para>
        </listitem>

        <listitem>
          <para>bison bison-2.1.exe</para>
        </listitem>

        <listitem>
          <para>zlib zlib-?.exe</para>
        </listitem>

        <listitem>
          <para>Flex flex-2.5.4a-1.exe</para>
        </listitem>

        <listitem>
          <para>Gettext gettext-0.14.4.exe</para>
        </listitem>

        <listitem>
          <para>libiconv libiconv-1.8.1-bin.exe</para>
        </listitem>
      </itemizedlist>

      <para></para>
    </section>
  </section>

  <section>
    <title>Compilations</title>

    <para>Here, we will install our GIS tools. First, we are going to make the
    directory where our tools will be installed. So double-clcik on
    c:\msys</para>

    <programlisting>mkdir </programlisting>

    <section>
      <title>PostgreSQL 8.1.1</title>

      <para>Download PostgreSQL from
      ftp://ftp.fr.postgresql.org/source/v8.1.1/postgresql-8.1.1.tar.gz and do
      </para>

      <programlisting>cd /path/where/you/have/downloaded/postgresql-8.1.1.tar.gz

tar xvzf postgresql-8.1.1.tar.gz

cd postgresql-8.1.1

configure --prefix=/c/PostgreSQL/8.1.1 --with-CXX --enable-multibyte --enable-nls

make

make install</programlisting>
    </section>

    <section>
      <title>Geos 2.2.1</title>

      <para>Download Geos from http://geos.refractions.net/geos-2.2.1.tar.bz2
      and do</para>

      <programlisting>tar xvjf geos-2.2.1.tar.bz2

cd geos-2.2.1

configure --prefix=/c/PostgreSQL/8.1.1 &amp;&amp; make &amp;&amp; make install</programlisting>
    </section>

    <section>
      <title>Proj 4.4.9</title>

      <para>Download Proj from
      ftp://ftp.remotesensing.org/proj/proj-4.4.9.tar.gz then do</para>

      <programlisting>tar xvzf proj-4.4.9.tar.gz

cd proj-4.4.9

configure --prefix=/c/PostgreSQL/8.1.1 &amp;&amp; make &amp;&amp; make install</programlisting>

      <para>We need to create libproj.dll. So we do</para>

      <programlisting>cd /c/PostgreSQL/8.1.1/lib

gcc -shared -o libproj.dll -Wl,--out-implib=libproj.dll.a -Wl,--export-all-symbols -Wl,\
--enable-auto-import -Wl,--whole-archive libproj.a -Wl,--no-whole-archive /c/mingw/lib/libmingw32.a</programlisting>
    </section>

    <section>
      <title>PostGIS 1.1.0</title>

      <para>Donwload PostGIS from
      http://postgis.refractions.net/download/postgis-1.1.0.tar.gz then
      do</para>

      <programlisting>tar xvzf postgis-1.1.0.tar.gz</programlisting>

      <para>We need to modify our PATH environment variable</para>

      <programlisting>export PATH=/c/PostgreSQL/8.1.1/bin:/c/PostgreSQL/8.1.1/lib:$PATH</programlisting>

      <para>We have to modify postgis-1.1.0/configure.in. Open this file, and
      replace on line 455 the following line </para>

      <programlisting>PGFELIBS="`${PGCONFIG} --libdir`/libpq.dll"</programlisting>

      <para>by this one:</para>

      <programlisting>PGFELIBS="$(echo $(${PG_CONFIG} --libdir)/libpq.dll)"</programlisting>

      <para>Then from MinGW, do</para>

      <programlisting>configure

make

make install</programlisting>
    </section>
  </section>

  <section>
    <title>About this document</title>

    <para>This document was written by Jean David TECHER. First release on
    2006-01-01 / 00:15. The PDF version of this document was got by using
    dblatex (http://dblatex.sourceforge.net)</para>
  </section>
</article>
