Thread: [Module-build-general] [comments please] module installation paths
Status: Beta
Brought to you by:
kwilliams
|
From: Ken W. <ke...@ma...> - 2003-06-30 17:11:53
|
Hi all,
I've decided on some semantics for how to specify installation paths
using Module::Build. Here's the POD I've written for it, please give
me feedback if you have any.
Thanks.
-Ken
-----------------------------------------------------------
=head2 How Installation Works
When you invoke Module::Build's C<build> action, it needs to figure
out where to install things. The nutshell version of how this works
is that default installation locations are determined from
F<Config.pm>, and they may be overridden by using the C<install_path>
parameter. An C<install_base> parameter lets you specify an
alternative installation root like F</home/foo>, and a C<destdir> lets
you specify a temporary installation directory like F</tmp/install> in
case you want to create bundled-up installable packages.
Natively, Module::Build provides default installation locations for
the following types of installable items:
=over 4
=item lib
Usually pure-Perl module files ending in F<.pm>.
=item arch
"Architecture-dependent" module files, usually produced by compiling
XS, Inline, or similar code.
=item script
Programs written in pure Perl. Try to make these as small as possible
- put the code into modules whenever possible.
=item bin
"Architecture-dependent" programs, i.e. compiled C code or something.
Pretty rare to see this in a perl distribution, but it happens.
=item libdoc
Documentation for the stuff in C<lib> and C<arch>. This is usually
generated from the POD in F<.pm> files. Under Unix, these are manual
pages belonging to the 'man3' category.
=item bindoc
Documentation for the stuff in C<script> and C<bin>. Usually
generated from the POD in those files. Under Unix, these are manual
pages belonging to the 'man1' category.
=back
The default destinations for these installable things come from
entries in your system's C<Config.pm>. You can select from three
different sets of default locations by setting the C<installdirs>
parameter as follows:
'installdirs' set to:
core site vendor
uses the following defaults from Config.pm:
lib => installprivlib installsitelib installvendorlib
arch => installarchlib installsitearch installvendorarch
script => installscript installsitebin installvendorbin
bin => installbin installsitebin installvendorbin
libdoc => installman3dir installsiteman3dir installvendorman3dir
bindoc => installman1dir installsiteman1dir installvendorman1dir
(Note that the 'script' line is different from MakeMaker -
unfortunately there's no such thing as "installsitescript" or
"installvendorscript" entry in C<Config.pm>, so we use the
"installsitebin" and "installvendorbin" entries to at least get the
general location right. In the future, if C<Config.pm> adds some more
appropriate entries, we'll start using those.)
=item install_path
Once the defaults have been set, you can override them. You can set
individual entries by using the C<install_path> parameter:
my $m = Module::Build->new
(...other options...,
install_path => {lib => '/foo/lib',
arch => '/foo/lib/arch'});
On the command line, that would look like this:
perl Build.PL install_path=lib=/foo/lib install_path=arch=/foo/lib/arch
or this:
Build install install_path=lib=/foo/lib install_path=arch=/foo/lib/arch
=item install_base
You can also set the whole bunch of installation paths by supplying the
C<install_base> parameter to point to a directory on your system. For
instance, if you set C<install_base> to "/home/ken" on a Linux
system, you'll install as follows:
lib => /home/ken/lib
arch => /home/ken/lib/i386-linux
script => /home/ken/scripts
bin => /home/ken/bin
libdoc => /home/ken/man/man1
bindoc => /home/ken/man/man3
Note that this is I<different> from how MakeMaker's C<PREFIX>
parameter works. C<PREFIX> tries to create a mini-replica of a
C<site>-style installation under the directory you specify, which is
not always possible (and the results are not always pretty in this
case). C<install_base> just gives you a default layout under the
directory you specify, which may have little to do with the
C<installdirs=site> layout.
The exact layout under the directory you specify may vary by system -
we try to do the "sensible" thing on each platform.
=item destdir
If you want to install everything into a temporary directory first
(for instance, if you want to create a directory tree that a package
manager like C<rpm> or C<dpkg> could create a package from), you can
use the C<destdir> parameter:
perl Build.PL destdir=/tmp/foo
or
Build install destdir=/tmp/foo
This will effectively install to "$destdir/$sitelib",
"$destdir/$sitearch", and the like, except that it will use
C<File::Spec> to make the pathnames work correctly on whatever
platform you're installing on.
=item uninst
If you want the installation process to look around in C<@INC> for
other versions of the stuff you're installing and try to delete it,
you can use the C<uninst> parameter, which tells C<Module::Install> to
do so:
Build install uninst=1
This can be a good idea, as it helps prevent multiple versions of a
module from being present on your system, which can be a confusing
situation indeed.
=back
|
|
From: Nicholas C. <ni...@cc...> - 2003-06-30 17:52:01
|
On Mon, Jun 30, 2003 at 12:11:41PM -0500, Ken Williams wrote: > I've decided on some semantics for how to specify installation paths > using Module::Build. Here's the POD I've written for it, please give > me feedback if you have any. Seems good, and seems to make sense on a quick read through Nicholas Clark |
|
From: Dave R. <au...@ur...> - 2003-06-30 18:05:09
|
On Mon, 30 Jun 2003, Ken Williams wrote: > I've decided on some semantics for how to specify installation paths > using Module::Build. Here's the POD I've written for it, please give > me feedback if you have any. Looks good to me. I actually understand it, which is something I can't say for MM's PREFIX and LIB stuff ;) -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ |
|
From: Uri G. <ur...@st...> - 2003-06-30 19:15:23
|
>>>>> "KW" == Ken Williams <ke...@ma...> writes: KW> =item script KW> Programs written in pure Perl. Try to make these as small as possible KW> - put the code into modules whenever possible. why do scripts have to be small? is there a real size limit? if not, you shouldn't editorialize on how to write scripts. some scripts just need to be long or not use many modules. KW> =item bin KW> "Architecture-dependent" programs, i.e. compiled C code or something. KW> Pretty rare to see this in a perl distribution, but it happens. xs (or now inline::) code isn't that rare. i would drop the last line. you could make a comment about these programs use XS or inline::c/cpp or other cpu architecture dependent stuff. also what compiler will be chosen for that? i didn't see any override options in this doc. KW> =item bindoc KW> Documentation for the stuff in C<script> and C<bin>. Usually KW> generated from the POD in those files. Under Unix, these are manual KW> pages belonging to the 'man1' category. can the pod be generated from another command? stem will have a stem2pod command that needs to be run since some of the pod is autogenerated from attribute specifications. KW> The default destinations for these installable things come from KW> entries in your system's C<Config.pm>. You can select from three KW> different sets of default locations by setting the C<installdirs> KW> parameter as follows: this needs to be explained a litte more i think. make it clear in the text that the choices are core/site/vendor and not lib/arch/etc/. the chart shows that but it could be more explicit. never underestimate the dumbnitude of people doing cpan installs. :) KW> 'installdirs' set to: KW> core site vendor KW> uses the following defaults from Config.pm: KW> lib => installprivlib installsitelib installvendorlib KW> arch => installarchlib installsitearch installvendorarch KW> script => installscript installsitebin installvendorbin KW> bin => installbin installsitebin installvendorbin KW> libdoc => installman3dir installsiteman3dir installvendorman3dir KW> bindoc => installman1dir installsiteman1dir installvendorman1dir KW> perl Build.PL destdir=/tmp/foo KW> or KW> Build install destdir=/tmp/foo this is the first time you show how these params are set. you should have an example at the top and examples of each param as you get to them. when i first read this i was asking 'where do i set these? in the Build.PL or what? overall, i like it a lot. it is the best high level picture of build.pl i have seen so far. uri -- Uri Guttman ------ ur...@st... -------- http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org |
|
From: Dave R. <au...@ur...> - 2003-06-30 19:28:15
|
On Mon, 30 Jun 2003, Uri Guttman wrote: > KW> =item bin > > KW> "Architecture-dependent" programs, i.e. compiled C code or something. > KW> Pretty rare to see this in a perl distribution, but it happens. > > xs (or now inline::) code isn't that rare. i would drop the last > line. you could make a comment about these programs use XS or > inline::c/cpp or other cpu architecture dependent stuff. also what > compiler will be chosen for that? i didn't see any override options in > this doc. He means that compiling binary _executable_ is a rarity in Perl module distros, as opposed to compiled modules. > KW> =item bindoc > > KW> Documentation for the stuff in C<script> and C<bin>. Usually > KW> generated from the POD in those files. Under Unix, these are manual > KW> pages belonging to the 'man1' category. > > can the pod be generated from another command? stem will have a stem2pod > command that needs to be run since some of the pod is autogenerated from > attribute specifications. Module::Build is very flexible, so doing extra stuff is always possible at each stage of the build/test/install process (as well as during distro generation, etc.) -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ |
|
From: Ken W. <ke...@ma...> - 2003-06-30 19:37:16
|
On Monday, June 30, 2003, at 02:14 PM, Uri Guttman wrote: >>>>>> "KW" == Ken Williams <ke...@ma...> writes: > > KW> =item script > > KW> Programs written in pure Perl. Try to make these as small as > possible > KW> - put the code into modules whenever possible. > > why do scripts have to be small? is there a real size limit? if not, > you > shouldn't editorialize on how to write scripts. some scripts just need > to be long or not use many modules. Yup, it's an editorial. I don't feel bad about editorializing here, but I should maybe make it more clear - "in order to promote reuse" or something. > > KW> =item bin > > KW> "Architecture-dependent" programs, i.e. compiled C code or > something. > KW> Pretty rare to see this in a perl distribution, but it happens. > > xs (or now inline::) code isn't that rare. This isn't XS code. It's binary executables, not binary libraries. That's pretty rare as far as I've seen. > also what > compiler will be chosen for that? i didn't see any override options in > this doc. Yeah, the compiler all comes from Config.pm , and any Config.pm entry can be overridden. The docs for that are elsewhere. Maybe I should rename this section to "How installation paths are determined" or something. > > KW> =item bindoc > > KW> Documentation for the stuff in C<script> and C<bin>. Usually > KW> generated from the POD in those files. Under Unix, these are > manual > KW> pages belonging to the 'man1' category. > > can the pod be generated from another command? stem will have a > stem2pod > command that needs to be run since some of the pod is autogenerated > from > attribute specifications. You'd probably just subclass Module::Build for that. > KW> The default destinations for these installable things come from > KW> entries in your system's C<Config.pm>. You can select from three > KW> different sets of default locations by setting the C<installdirs> > KW> parameter as follows: > > this needs to be explained a litte more i think. make it clear in the > text that the choices are core/site/vendor and not lib/arch/etc/. the > chart shows that but it could be more explicit. never underestimate the > dumbnitude of people doing cpan installs. :) Yeah, you're right. I also need to say that 'site' is the default. > KW> perl Build.PL destdir=/tmp/foo > KW> or > KW> Build install destdir=/tmp/foo > > > this is the first time you show how these params are set. That's because this is just an excerpt from the much larger pod in Module/Build.pm . > overall, i like it a lot. it is the best high level picture of build.pl > i have seen so far. Thanks. -Ken |
|
From: Uri G. <ur...@st...> - 2003-06-30 20:10:22
|
>>>>> "KW" == Ken Williams <ke...@ma...> writes: KW> On Monday, June 30, 2003, at 02:14 PM, Uri Guttman wrote: >>>>>>> "KW" == Ken Williams <ke...@ma...> writes: KW> Yup, it's an editorial. I don't feel bad about editorializing here, KW> but I should maybe make it more clear - "in order to promote reuse" or KW> something. better but i would drop the editorial. KW> =item bin >> KW> "Architecture-dependent" programs, i.e. compiled C code or >> something. KW> Pretty rare to see this in a perl distribution, but it happens. >> KW> This isn't XS code. It's binary executables, not binary libraries. KW> That's pretty rare as far as I've seen. ahh, hen make it clearer that these are standalone binary exectuables. KW> Maybe I should rename this section to "How installation paths are KW> determined" or something. good idea. KW> perl Build.PL destdir=/tmp/foo KW> or KW> Build install destdir=/tmp/foo >> >> >> this is the first time you show how these params are set. KW> That's because this is just an excerpt from the much larger pod in KW> Module/Build.pm . i would still show a couple of one line examples at the top so the reader gets a feel of what the rest of the doc means. i didn't know where i would put those params until i saw those two lines. and a one line example for each section would be good too. uri -- Uri Guttman ------ ur...@st... -------- http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org |
|
From: Ken W. <ke...@ma...> - 2003-06-30 20:15:23
|
On Monday, June 30, 2003, at 02:52 PM, Uri Guttman wrote: >>>>>> "KW" == Ken Williams <ke...@ma...> writes: > KW> Yup, it's an editorial. I don't feel bad about editorializing > here, > KW> but I should maybe make it more clear - "in order to promote > reuse" or > KW> something. > > better but i would drop the editorial. So noted. =) > > ahh, hen make it clearer that these are standalone binary exectuables. > Done. > KW> Maybe I should rename this section to "How installation paths are > KW> determined" or something. > > good idea. Done. > i would still show a couple of one line examples at the top so the > reader gets a feel of what the rest of the doc means. i didn't know > where i would put those params until i saw those two lines. and a one > line example for each section would be good too. More examples on the way. There's also a new Module::Build::Cookbook that I started creating at YAPC. -Ken |