Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Installing lots of things in different places with MakeMaker

by danb (Friar)
on Jan 17, 2004 at 19:44 UTC ( [id://322065]=note: print w/replies, xml ) Need Help??


in reply to Installing lots of things in different places with MakeMaker

It seems that MakeMaker (and CPAN in general) are not geared for anything except binaries and libraries installation.

I think that it really is a shame, because it would not be very hard to extend them so that they would have more features of general application installation programs (rpm, etc.).

The result of this is that CPAN discourages anyone from using it for programs that are even remotely complex (e.g., programs that have template files, configuration files, data files, etc.).

All that said, I *do* use E:MM in the very way that I'm saying you can't (and probably shouldn't), because I don't want to distribute my program via rpm, etc. Here is what I do for Business::Shipping...

my %my_globals = ( SUPPORT_FILES_DIR => '/var/perl/Business-Shipping' ); WriteMakefile( CONFIGURE => \&extra_WriteMakefile_options, ); # # Override the standard "install" target, so that it calls "support_fi +les_install" # sub MY::install { package MY; my $inherited = shift->SUPER::install(@_); my $new; for ( split( "\n", $inherited ) ) { if ( /^install :: / ) { $_ .= " support_files_install"; } $new .= "$_\n"; } return $new; } sub MY::postamble { return qq{ support_files_install : \@echo "Installing support files (database, configuration, etc.) t +o $my_globals{SUPPORT_FILES_DIR}" \@\$(MKPATH) $my_globals{SUPPORT_FILES_DIR}/data \@\$(MKPATH) $my_globals{SUPPORT_FILES_DIR}/config \@\$(CP) --recursive --force data/* $my_globals{SUPPORT_FILES_DI +R}/data/ \@\$(CP) --recursive --force config/* $my_globals{SUPPORT_FILES_DI +R}/config/ }; } sub extra_WriteMakefile_options { $my_globals{SUPPORT_FILES_DIR} = prompt( "\n" . " --- Business::Shipping support files directory --- +\n" . "\n" . "Business::Shipping has various support files for configu +ration, database, etc.\n" . "(The path to these files can be overridden later on a pe +r-user basis.)\n" . "I need to know the path to the \'system\' level, or \'de +fault\' files.\n" . "On many systems, this directory will only be accessible +by root.\n" . "\n" . "Business::Shipping default support files directory:", $my_globals{SUPPORT_FILES_DIR}, ); $my_globals{SUPPORT_FILES_DIR} =~ s:[\\/]\s*$::; $my_globals{SUPPORT_FILES_DIR} =~ s:^\s*::; my %X; #$X{ EXTRA_CONFIG_OPTION } = "value"; return \%X; }

I don't know if that helps you at all. It shows that you *can* do some stuff with E:MM, in a hacked sort of way (but you're probably not supposed to). I heard that you can do the above using Module::Build in a less-hacked sort of way.

-Dan

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://322065]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (1)
As of 2024-04-25 03:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found