Skip to content

Commit

Permalink
Support for INSTALLDIRS=vendor
Browse files Browse the repository at this point in the history
INSTALLDIRS=vendor will install the module into the configured
$RT::PluginPath variable in RT::Generated.

Heavily inspired by Kai Storbeck's patch against an older version
of Module::Install::RTx
  • Loading branch information
jmdh committed Apr 24, 2015
1 parent 28f0958 commit 89a9c6c
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion lib/Module/Install/RTx.pm
Expand Up @@ -36,6 +36,13 @@ sub RTx {
}
$self->add_metadata("x_module_install_rtx_version", $VERSION );

my $installdirs = $ENV{INSTALLDIRS};
for ( @ARGV ) {
if ( /INSTALLDIRS=(.*)/ ) {
$installdirs = $1;
}
}

# Try to find RT.pm
my @prefixes = qw( /opt /usr/local /home /usr /sw /usr/share/request-tracker4);
$ENV{RTHOME} =~ s{/RT\.pm$}{} if defined $ENV{RTHOME};
Expand Down Expand Up @@ -70,7 +77,13 @@ sub RTx {

# Installation locations
my %path;
$path{$_} = $RT::LocalPluginPath . "/$name/$_"
my $plugin_path;
if ( $installdirs && $installdirs eq 'vendor' ) {
$plugin_path = $RT::PluginPath;
} else {
$plugin_path = $RT::LocalPluginPath;
}
$path{$_} = $plugin_path . "/$name/$_"
foreach @DIRS;

# Copy RT 4.2.0 static files into NoAuth; insufficient for
Expand Down Expand Up @@ -130,6 +143,7 @@ install ::
if ( $path{lib} ) {
$self->makemaker_args( INSTALLSITELIB => $path{'lib'} );
$self->makemaker_args( INSTALLARCHLIB => $path{'lib'} );
$self->makemaker_args( INSTALLVENDORLIB => $path{'lib'} )
} else {
$self->makemaker_args( PM => { "" => "" }, );
}
Expand All @@ -138,6 +152,13 @@ install ::
$self->makemaker_args( INSTALLSITEMAN3DIR => "$RT::LocalPath/man/man3" );
$self->makemaker_args( INSTALLSITEARCH => "$RT::LocalPath/man" );

# INSTALLDIRS=vendor should install manpages into /usr/share/man.
# That is the default path in most distributions. Need input from
# Redhat, Centos etc.
$self->makemaker_args( INSTALLVENDORMAN1DIR => "/usr/share/man/man1" );
$self->makemaker_args( INSTALLVENDORMAN3DIR => "/usr/share/man/man3" );
$self->makemaker_args( INSTALLVENDORARCH => "/usr/share/man" );

if (%has_etc) {
print "For first-time installation, type 'make initdb'.\n";
my $initdb = '';
Expand Down Expand Up @@ -348,6 +369,23 @@ Path to the RT installation that contains a valid F<lib/RT.pm>.
=back
=head1 EXAMPLES
To install an extension which makes use of this installer:
perl Makefile.PL RTHOME=/opt/rt4
This will install all subdirs into the $RT::LocalPluginPath dir
as configured in RT::Generated.
To install an extension into the (vendor) plugin path:
perl Makefile.PL RTHOME=/opt/rt4 INSTALLDIRS=vendor
This will install all subdirs into the $RT::PluginPath which is specifically
meant for plugins that are installed through other packaging utils like
APT or RPM.
=head1 SEE ALSO
L<Module::Install>
Expand Down

0 comments on commit 89a9c6c

Please sign in to comment.