bcrowell2 has asked for the wisdom of the Perl Monks concerning the following question:

I have an open-source Perl/Tk app (http://www.lightandmatter.com/ogr/ogr.html) that doesn't really care where you put it, but I'm finally getting around to writing a proper ``make install'' that will put it someplace reasonable. To complicate things, I've switched from Linux to FreeBSD recently, so I don't have access to a Linux system to test this on. Where is the right place to install such an application on Linux? I'm thinking that all my modules should go in their own subdirectory somewhere under /usr/local/.../, and I should create a symbolic link from, say, /usr/local/bin/opengrade (the name of my app) to the main module. Does this sound right? What should the subdirectory of /usr/local be? Should I be looking at any environment variables in order to choose where to put the stuff? Once I set it up, is there anyone who would be willing to test my makefile for me on a Linux machine?

My program doesn't use any XS or anything, so really the installation is pretty simple. I realize that most perl applications use Makemaker and Makefile.PL, but I'm trying to avoid learning it :-)

TIA!

Replies are listed 'Best First'.
Re: where to install Perl apps on Linux?
by Zaxo (Archbishop) on May 27, 2003 at 00:54 UTC

    If you let ExtUtils::MakeMaker handle your installation, you get the INSTALLDIRS family of environment variables. They are customized for each perl installation. That way, your users each get things installed where they expect, according to local customs.

    After Compline,
    Zaxo

Re: where to install Perl apps on Linux?
by jepri (Parson) on May 27, 2003 at 00:55 UTC
    Given your heavy cross-platform emphasis, I would consider writng my own installer (this is a project I've been half-considering for a while). I found MakeMaker less than ideal for installing binaries (while being brilliant at installing modules).

    You should look through the File:: series of modules to give yourself a chance at cross-platform compatibility.

    Also consider using one of the free 'InstallShield' clones to package your windows version.

    And to make life easier for anyone who's packaging it, make sure you keep all your install variables in one easily accessable place.

    Having said all that, your planned locations sound fine, that's the sort of thing that I do with mine. It works, but people are likely to have opinions on the correctness and efficiency of that approach.

    ____________________
    Jeremy
    I didn't believe in evil until I dated it.

Re: where to install Perl apps on Linux?
by tedrek (Pilgrim) on May 27, 2003 at 04:59 UTC

    I'd suggest using autoconf or something like it eg ./configure --prefix=/my/nifty/programs

    as for directory structure probably something like
    /usr/local/bin/opengrade (symlink or not)
    /usr/local/share/opengrade/ (data files and modules)
    /usr/local/doc/opengrade-<version>/ ( Readme and such)

    That is assuming you don't want to share your modules. If you do want the users to use your modules then use Makemaker and friends to install your modules wherever the local site_perl is. And use that dir structure for the rest of your files

Re: where to install Perl apps on Linux?
by theorbtwo (Prior) on May 27, 2003 at 04:12 UTC

    The executable belongs in /usr/local/bin. The modules go someplace preferably under /usr/local, under site_bin, and in the user's default @INC. I'd really recommend letting MakeMaker install the modules; it knows how to do it better then I do.


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

      What do you mean "the executable belongs in /usr/local/bin"? Where an executable belongs is a matter of site policy. It's the admins of the site that determine that. For all you know, the application is going to be shared amongst several machines, and it ends up in /usr/share. Other common places to install third party software are in /opt and /app.

      Abigail

        The OP wanted a general place where the executable, modules, and auxilary files should go on a generic general linux install. The advice I gave him (to the best of my knowlage, of course) matches the Linux Filesystem Higherachy Standard, the standard on how linux machines should be orginized in terms of what goes where in the file namespace.

        Of course, like everything else, if an individual site doesn't want to follow the standards, it should be free to. An individual installing on such a site shouldn't be using a make install target, and in such a case the OP's question is moot.


        Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).