NAME

Alien::SWIG - Provides installation and config information for SWIG

SYNOPSIS

use Alien::SWIG;

my $swig       = Alien::SWIG->new();

my $path       = $swig->path();
my $version    = $swig->version();
my $executable = $swig->executable();
my $includes   = $swig->includes();
my $module_dir = $swig->module_dir();
my $cmd_line   = $swig->cmd_line();

DESCRIPTION

This module automates the installation of SWIG - The Simplified Wrapper and Interface Generator, building from source code (downloading if necessary), and provides accessor functions to describe its location, module paths, etc.

This module comes distributed with and installs SWIG version 2.0.1 by default, but you can specify a different version to build and install, and it will do its best to find, download, build, and install that version, as long as it's available in the SWIG SourceForge repository at http://sourceforge.net/projects/swig/files/swig/.

Please see Alien for an explanation of the Alien namespace.

BUILD ARGUMENTS

Alien::SWIG has a few build arguments for customizing the build process. These are all passed as perl Build.PL [[ARG] [ARG ...].

--swigver=VERNUM

You can specify an alternate version of SWIG to build and install by using the --swigver=X.X.X argument to Build.PL, e.g.:

perl Build.PL --swigver=1.3.40
./Build
./Build test
./Build install

This would download swig-1.3.40.tar.gz and build and install that, instead.

This module has been tested with SWIG versions 1.3.28 - 2.0.1. I don't think anything prior to that will work with it, due to the lack of typemaps before then.

--with-pcre-prefix=PATH
--with-pcre-exec-prefix=PATH
perl Build.PL --with-pcre-prefix=/opt/pcre --with-pcre-exec-prefix=/opt/pcre

These are passed directly to SWIG's configure script, and are only needed if PCRE (the "Perl-Compatible" Regular Expression library) is installed in a non-standard location (i.e. the pcre-config program is not in your PATH).

PCRE is not needed for this Perl module's functionality, but SWIG uses it for its source code parser and preprocessor.

It is recommended that you have it installed, or the version of SWIG built by this module may have reduced functionality or performance.

It can be found at http://www.pcre.org, or probably in your distribution's package repository.

--without-pcre
perl Build.PL --without-pcre

You can use this to disable PCRE from the outset. Read the above for reasons why you shouldn't disable PCRE.

This also disables the --with-pcre-prefix and --with-pcre-exec-prefix options.

CONSTRUCTOR

new()

my $swig = Alien::SWIG->new();

Create a new Alien::SWIG object for querying the installed configuration.

ARGUMENTS: None.

RETURNS: blessed $object, or undef on failure.

METHODS

path()

my $path = $swig->path();

Get the base install path of the SWIG installation.

ARGUMENTS: None.

RETURNS: Directory $name, with no trailing path separator.

version()

my $version = $swig->version();

Get the version of the copy of SWIG that was installed.

(Not to be confused with Alien::SWIG $VERSION, which is this Perl wrapper's version number.)

ARGUMENTS: None.

RETURNS: The SWIG $version as a string, e.g. '2.0.1'.

executable()

my $executable = $swig->executable();

Get the location of the swig executable program, that was compiled during the installation of this module.

ARGUMENTS: None.

RETURNS: Absolute path to swig, ready for executing.

includes()

# As string
my $includes = $swig->includes();

# As list
my @includes = $swig->includes();

Get the SWIG -I include directives needed to run SWIG against the installed version. swig has the base path compiled into it, but if for any reason the path doesn't work, you can use this to manually specify the -I directives.

ARGUMENTS: None.

RETURNS: Depending on context, returns a $scalar containing all the paths joined with spaces, as -I/path, or an @array containing all the paths, as -I/path, one-per-element.

module_dir()

my $module_dir = $swig->module_dir();

Get the base directory of the installed SWIG modules. This can be used to set the SWIG_LIB environment variable, as detailed in the SWIG docs.

ARGUMENTS: None.

RETURNS: Absolute $path to modules base directory.

cmd_line()

my $cmd_line = $swig->cmd_line();

Get a full, working command line, with all the -I directives included, that you can use to run the installed copy of SWIG.

ARGUMENTS: None.

RETURNS: $string containing a runnable command, with all -I directives appended.

EXPORTS

use Alien::SWIG qw( path version executable module_dir includes );

This module OPTIONALLY exports the following subs:

SEE ALSO

http://www.swig.org/ - SWIG, the Simplified Wrapper and Interface Generator

http://www.swig.org/doc.html - The SWIG Documentation

http://www.pcre.org - The "Perl-Compatible" Regular Expression library (only needed for SWIG; this module doesn't use it).

The bin/ directory of this module's distribution

AUTHORS

Jason McManus, <infidel at cpan.org>

ACKNOWLEDGEMENTS

Many of the build scripts in this module were modelled on Alien::IE7.

BUGS

  • configure in SWIG doesn't disable multiple language support.

    As of 2.0.1, and back as far as this module works with, the configure script in all SWIG versions support --disable-LANG options for all of the other languages, but they don't actually seem to disable the other languages, only the checks during make check. Not my fault.

    See this mailing list post if you'd like more information: https://sourceforge.net/mailarchive/forum.php?thread_name=4D444651.8050303%40fultondesigns.co.uk&forum_name=swig-user

    This module already passes the options, so if it becomes possible at some point, it will work automagically.

Please report any bugs or feature requests to bug-alien-swig at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Alien-SWIG. The authors will be notified, and then you'll automatically be notified of progress on your bug as changes are made.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Alien::SWIG

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright (c) 2011 Jason McManus

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.