Installing on Win32
===================

For instructions relating to the installation of PDL
binaries (PPM packages) see the wiki:
https://github.com/PDLPorters/pdl/wiki/Installing-PDL-on-Windows

########################################################################
########################################################################

If you would like, instead, to build PDL from source,
that's (generally) fairly straight forward.

Certain parts of PDL (eg PDL::Slatec and PDL::Minuit)
can't be built without a fortran compiler. In the docs
that follow I call these parts (somewhat loosely) "the
fortran stuff".
The absence of a fortran compiler does not prevent one
from building PDL - it simply means that the PDL that
gets built does not include "the fortran stuff".



To Build from Source
--------------------
1) You'll need a make utility and a compiler -
   dmake/MinGW provides best mileage.  To install them onto
   32-bit ActivePerl (if you don't already have them) simply:

   ppm install MinGW

   Sadly, this approach won't currently work at all
   with 64-bit ActivePerl. The best way to get MinGW
   support with 64-bit ActivePerl is to install one of the
   "Personal Builds" of the MinGW64 compiler available from

   http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/

   and install ExtUtils::FakeConfig from CPAN. But while
   this is not all that difficult for those who are
   well acquainted with compilers and perl, it's not as
   straightforward as most novice programmers would like.
   (If you need to take this approach and have difficulty
   getting it configured, asking for help at somewhere like
   http://www.perlmonks.org is probably your best bet.)

   Another option with ActivePerl (both 32-bit and 64-bit)
   is to use an appropriate Microsoft Compiler. This may
   come at the cost of reduced mileage wrt "the fortran
   stuff" and external libraries support.

   Strawberry Perl (either 32-bit or 64-bit) is probably
   the easiest path to take, as it comes with a ready-to-go
   dmake utility and MinGW compiler. And, as of the perl-5.16.0
   builds, it now includes a fortran compiler. For earlier
   versions of Strawberry Perl a fortran compiler (suitable
   for building "the fortran stuff") is readily available
   as a separate download that can be installed straight
   over the top of the Strawberry Perl installation. If
   you have difficulty locating that fortran compiler
   just ask on the Vanilla Perl mailing list. (See
   http://lists.perl.org/list/win32-vanilla.html )

2) Then, run:

   cpan -i ExtUtils::F77    # Optional - this is for "the fortran stuff".
                            # It will fail if it can't find a g77 or gfortran
                            # compiler. If using a Microsoft compiler see
                            # "Other Options" below.
                            # Note that failure here does not prevent you from
                            # from building PDL. It just means that the PDL
                            # you build will be missing "the fortran stuff".

   cpan -i PGPLOT           # Optional - for PGPLOT graphics support.
                            # This will fail if the pgplot C library can't
                            # be found.
			          # It will also fail if no Fortran compiler is
			          # found---simpler to install using ppm
			          # (see above).

   cpan -i OpenGL           # Optional, but recommended - this is for PDL's
                            # TriD support.
                            # Also available via ppm (see above) if there
                            # is any problem building.

   cpan -i PDL              # Will first install any missing pre-requisites.
                            # This should succeed, but the PDL that's built
                            # will be missing some features if any of the
                            # above 'cpan -i ..' commands failed.

If it's a developer release that you're trying to install
then you'll need to specify the full distribution path info,
e.g.:

   cpan -i CHM/PDL-2.004_997.tar.gz



Other Options
-------------
1) Using an MS compiler and f2c instead of MinGW/g77/gfortran

   The capability of building "the fortran stuff" with an MS
   compiler, f2c, and associated libraries libi77.lib and
   libf77.lib probably still exists (but none of the current
   PDL developers have any knowledge or experience with this option).

   According to mythology, if you want to use f2c you need
   to edit win32/win32f77.pl to reflect the location of f2c,
   the libs and the include file f2c.h.

  Then, you'll also need to run:

    perl Makefile.PL F77CONF=win32/win32f77.pl

  instead of simply:

    perl Makefile.PL


2) Building a "non-default" (custom) PDL

   If you don't want to accept a (basic) "default" build
   of PDL, download the source from CPAN, extract it
   to some location, cd to that location and edit (the
   self-documenting) perldl.conf accordingly.

   Then run, in succession:

      perl Makefile.PL
      dmake test
      dmake install

   This enables building of such extras as:
    a) PDL::IO::GD (needs the gd C library);
    b) PDL::GSL::* modules (needs the gsl C library);
    c) PDL::GIS::Proj & PDL::Transform::Proj4 (needs the proj4 C library);
