🌻 alienfile.org - Home of the Perl Alien Project

The Perl Alien Project is dedicated to making external, non-Perl dependencies available for CPAN modules. This is for both libraries (potentially any language) and tools (such as code generators). To this end the Alien:: namespace on CPAN has been reserved for modules that provide such dependencies. A well behaved Alien should probe the system to see if the library or tool is already installed. If not, it should download it from the internet and install it into a private share location so that it can be used by other Perl modules. Installing in a private share location is an important part of the Alien philosophy as we do not want to replace or corrupt system libraries.

The original manifesto developed by Artur Bergman imposes no frameworks, which adds to the flexability of the Alien concept. Joel Berger created Alien::Base which is a framework for developing Aliens with support for the most common build tools. This evolved into Alien::Build which provides powerful tools for creating and maintaining Aliens. It is very easy to build an Alien::Build based Alien that alienizes a package that uses common build tools like autotools and CMake.

The key architectural philosophy of the Alien::Base / Alien::Build system is that the bulk of the work is done in the build phase of the Alien, and the runtime is delegated mostly or entirely to the Alien::Base base class. In the Alien::Build system the build time recipe for finding or building the alienized library is in the alienfile. Here is an example alienfile for libarchive:

use alienfile;
plugin 'PkgConfig' => 'libarchive';
share {
  start_url 'http://libarchive.org/downloads/';
  plugin Download => (
    filter => qr/^libarchive-.*\.tar\.gz$/,
    version => qr/([0-9\.]+)/,
  );
  plugin Extract => 'tar.gz';
  plugin 'Build::Autoconf';
  plugin 'Gather::IsolateDynamic';
  build [
    '%{configure}',
    '%{make}',
    '%{make} install',
  ];
};

The runtime is simply an empty subclass that inherrits from Alien::Base:

package Alien::libarchive;
use strict;
use warnings;
use parent qw( Alien::Base );
1;

Alien::Build is also extensible through its plugin system allowing other build systems to be added. The Alien::Build project also comes with a large and growing manual. The manual has three main sections depending on how you need to use Alien::Build and a FAQ.

Resources hosted here

Slides

External Links