[Israel.pm] Installer for a Perl and Web Meta Language based program.

Mikhael Goikhman migo at homemail.com
Mon Apr 12 15:41:36 PDT 2004


On 12 Apr 2004 05:55:22 +0300, Shlomi Fish wrote:
> 
> I have developed Quad-Pres, which is a presentation tool based on Perl and Web 
> Meta Language (http://thewml.org/) first for my own use and now distribute as 
> open source software.
> 
> Now, up to now, after I revamped the program to be centralized in the system, 
> I used GNU Autoconf and Automake to manage the program's "compilation" and 
> installation. The problem is that now I have several tests and the process 
> I'm using to invoke them from Autoconf is "icky": it's slow, cumbersome and 
> unfit for a Perl program.
> 
> I'm looking for a nice alternative installer, preferablly written in Perl 
> (which I can already assume is installed there), that I can use to perform 
> the preparation, testing and installation. Rolling something on my own should 
> not be too hard, but I'd rather use an available solution if possible. 
> 
[requirements skipped]

I would go autoconf/automake, since this solution is pretty powerful and
configurable and may solve your requirements nicely. I know this, because
it solves build/install requirements of even more complex projects.

Basically, you want to install standard things, like:

  --bindir      defaults to ${prefix}/bin     - executables
  --mandir      defaults to ${prefix}/man     - man pages
  --datadir     defaults to ${prefix}/share   - perl, wml stuff

Where --prefix defaults to /usr/local, but may be anything, /usr, /opt.
Several different things may be installed relatively to $datadir, like:

  ${datadir}/quadpres/perllib  - Perl modules, in @INC
  ${datadir}/quadpres/wml      - WML stuff if needed
  ${datadir}/quadpres/scripts  - Perl scripts that are not in $bindir

Here is how to easily manage the last 3 directories given you already
have the same structure in your source tree. Create, for example, this
perllib/Makefile.am file:

  SUBDIRS = QuadPres
  configdir = @QUADPRES_PERLLIB_DIR@
  config_DATA = QuadPres.pm
  EXTRA_DIST = $(config_DATA)

Each subdir is similar, for example perllib/QuadPres/Makefile.am may be:

  SUBDIRS = OneMoreLevel1 OneMoreLevel2
  configdir = @QUADPRES_PERLLIB_DIR@/QuadPres
  config_DATA = Module1.pm Module2.pm
  EXTRA_DIST = $(config_DATA)

And here is how bin/quadpres.in may look like (that the main quadpres
script is automatically generated from by ./configure):

  BEGIN {
    our $prefix = '@prefix@';
    our $bindir = "@bindir@";
    our $datadir = "@datadir@";
    our $perllib_dir = "@QUADPRES_PERLLIB_DIR@";
  }
  use lib $perllib_dir;
  use QuadPres::Module1;

Now, add these lines to configure.in (or configure.ac):

  QUADPRES_DATADIR='${datadir}'"/${PACKAGE}"
  QUADPRES_PERLLIBDIR='${datadir}'"${PACKAGE}/perllib"

  AC_SUBST(QUADPRES_DATADIR)
  AC_SUBST(QUADPRES_PERLLIBDIR)

  AC_OUTPUT(
    Makefile
    bin/Makefile
    bin/quadpres
    perllib/Makefile
    ...
  )

These are mostly the key things needed for quadpres or a similar project.
Of course, this assumes some initial experience with autoconf/automake.
Finally, there is no built-in support for --docdir, but you wrote it is
not critical for you; and you may always add a custom --with-docdir
option to ./configure if needed.

Regards,
Mikhael.

-- 
perl -e 'print+chr(64+hex)for+split//,d9b815c07f9b8d1e'



More information about the Perl mailing list