Perl/Geo-Proj4

From Devpit
Jump to: navigation, search

Compiling PROJ.4 and Geo::Proj4 in Windows

This is a quick guide to compiling the Geo::Proj4 module available on CPAN. It's intent is to provide supplemental information beyond that provided by Perl/MinGW.

First, a current copy of libproj is needed. The current version as of this writting, and the version that Geo::Proj4 expects is 4.4.9. The Windows binaries on the web site are 4.4.6, so it will be necessary to build the library from source. The source is available here.

Tools

MinGW, including at least the following components needs to be installed to begin compiling PROJ.4:

  • MSys (The Minimal System), which includes a small POSIX compatibility layer for Windows.
  • gcc-core
  • binutils
  • mingw-runtime
  • w32api
  • gcc-g++

For additional tools that will be required, please refer to Perl/MinGW.

Also make sure that MinGW's bin directory is in your Windows PATH. This can be done by right-clicking on My Computer, and selecting Properties, and clicking the Environment Variables button on the Advanced tab. After setting the PATH, you will need to reboot for the changes to take effect.

Compiling PROJ.4

The compilation process works much like an ordinary compilation on a Unix or Linux system. After extracting the source and cding into the source directory using the cmd program, run the command sh configure. Upon successful completion, build the library by running the commands make and make install.

After the make install finishes successfully, the files that it produces need to be placed in the correct locations for the compiler to find. The files are probably copied to <msys directory>/local/lib, and need to be placed in <msys directory>/lib. The files projects.h and proj_api.h need to be copied from the <proj source>/src directory to <msys directory>/include.

Compiling Geo::Proj4

Like most Perl modules, Geo::Proj4 uses a Makefile.PL script to build a Makefile. However, the script in Geo::Proj4 does not work in Windows because there is an extra line of output from cs2cs.exe. These checks can simply be removed from the Makefile.PL, and the resulting module should still work as long as you use version 4.4.9 of PROJ.4.

At this point, the compilation should simply be a matter of following the steps in the Perl/MinGW tutorial.