The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Alien::GSL - Easy installation of the GSL library

DESCRIPTION

This module is meant to ease the install of the Gnu Scientific Library (GSL). It also provides version checking and build flags via the gsl-config utility.

SYNOPSIS

 use Alien::GSL;

 unless (Alien::GSL::require_gsl_version('1.15')) {
   die "This module requires at least GSL 1.15";
 }

INSTALLATION

Alien::GSL uses the Module::Build system for installation. Therefore the usual build process is

 perl Build.PL
 ./Build
 ./Build test
 ./Build install

N.B. the ./ is not needed on some platforms, notably Windows.

During its build phase (i.e. ./Build or more properly ./Build build or most properly ./Build code) it will attempt the following, more or less in order (also depends on platform and availability):

  • Use a system installed copy of the GSL libraries, using the information provided by calling gsl-config.

  • Download pre-compiled binaries of the GSL library and store using File::ShareDir.

  • Download and build GSL libraries from source. This build process does not require the Build script to be run with root privaledges. Then either:

    • Install system-wide if possible (only for Linux, when run as root).

    • Store using File::ShareDir.

The above behaviors may be manipulated by passing ...

Build Flags

When running ./Build, certain command line flags may be passed, i.e. ./Build --ShareDir.

--Version 1.15

Specify a version of the GSL library to be installed (here 1.15). Without this flag, the highest (read: newest) version available will be used. If a supplied version cannot be found, the install will croak.

--ShareDir

When this flag is given, File::ShareDir will be used, even if a system install was possible (i.e. on Linux as root).

--Force

When this flad is given, action will be taken, even if a system install of GSL is found. Note that this flag is not needed if --ShareDir is used.

--Dir dir

Specify a directory (here dir) to download and build the library. This directory will not be removed later.

--TempDir /dev/shm

Specify a location for the temporary build directory (here /dev/shm/, the ramdisk on Ubuntu Linux).

--GSLCheck

When this flag is given, if GSL is to be built from source, also include make check in the build phase (before make install). Has no effect if GSL is not going to be built from source.

NO EXPORTS

Currently this module does not export any functions or variables. Use instead the fully qualified symbol name, i.e. Alien::GSL::gsl_version().

INTERFACE STABILITY

This module is in an alpha state. The author hopes that major functionality will remain. The module now uses Module::Build which allows the install functionality (download, build, install) to be platform specific and separated from the usage functionality described in the "MODULE FUNCTIONS" section.

MODULE FUNCTIONS

These functions are basically a functional interface to the gsl-config utility command.

gsl_version

Takes no options, returns the version number of the installed GSL library.

require_gsl_version( [$version] )

A wrapper around gsl_version() which (optionally) takes a number specifying a minimum GSL version, returns the GSL version if it is greater than or equal to that specified. Returns zero otherwise. May also be called with zero as the version parameter, or no parameter at all, in which case the behavior is the same as gsl_version().

gsl_prefix

Takes no options, returns the "GSL installation prefix".

gsl_libs( [opts hash or hash reference] )

Takes an optional hash or hash reference, returns "library linking information". A hash key cblas, whose value is false will return the "library linking information, without cblas", though by default the cblas information is included.

gsl_cflags

Takes no options, returns the "pre-processor and compiler flags".

gsl_pkgconfig_location

Returns the path the folder containing gsl.pc for use with the pkg-config command. This file should be setup during installation, however, it must make a few guesses while doing so. Better to use the other gsl_* commands provided herein when possible.

TODO

  • gsl-config script (replaces executable for File::ShareDir installs)

    • Document with POD rather than usage statement (pod2usage?).

    • Figure out how to handle script and executable both being in path.

    • Figure out how to launch script on Windows using a gsl-config.bat.

  • Find a better download site for the compiled libraries.

  • Provide 64 bit libraries.

  • Allow build when make exists (i.e. on strawberry).

  • Clean the share_dir directory when ACTION_clean is run.

  • Improve tests for Alien::GSL.

  • Are tests possible for Module::Build subclasses?

SEE ALSO

Math::GSL
Math::GSLx::ODEIV2
GSL
PDL, website

SOURCE REPOSITORY

http://github.com/jberger/Alien-GSL

AUTHOR

Joel Berger, <joel.a.berger@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2011 by Joel Berger

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.