Add support for DESTDIR
Distributions (such as Debian) needs a staging area when building the package Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
parent
98dc396b9b
commit
908724984a
1 changed files with 20 additions and 3 deletions
23
Makefile.PL
23
Makefile.PL
|
@ -608,8 +608,9 @@ WriteMakefile(
|
|||
PM => $file_map,
|
||||
|
||||
# Man pages generated from POD
|
||||
INSTALLMAN1DIR => File::Spec->catdir($target_directories->{'MAN_DIR'}, 'man1'),
|
||||
INSTALLMAN3DIR => File::Spec->catdir($target_directories->{'MAN_DIR'}, 'man3'),
|
||||
# ExtUtils::MakeMaker already manage $(DESTDIR)
|
||||
INSTALLMAN1DIR => File::Spec->catdir(_strip_destdir($target_directories->{'MAN_DIR'}), 'man1'),
|
||||
INSTALLMAN3DIR => File::Spec->catdir(_strip_destdir($target_directories->{'MAN_DIR'}), 'man3'),
|
||||
|
||||
PL_FILES => $pl_files,
|
||||
);
|
||||
|
@ -1275,6 +1276,7 @@ sub get_target_directories {
|
|||
|
||||
_get_env_overrides(\%dirmap);
|
||||
_get_argv_overrides(\%dirmap);
|
||||
_add_destdir(\%dirmap);
|
||||
|
||||
return \%dirmap, \%skipdirs;
|
||||
}
|
||||
|
@ -1323,6 +1325,20 @@ sub _get_argv_overrides {
|
|||
@ARGV = @new_argv;
|
||||
}
|
||||
|
||||
sub _strip_destdir {
|
||||
my $dir = shift;
|
||||
$dir =~ s/^\$\(DESTDIR\)//;
|
||||
return $dir;
|
||||
}
|
||||
|
||||
sub _add_destdir {
|
||||
my $dirmap = shift;
|
||||
|
||||
foreach my $key (keys %$dirmap) {
|
||||
$dirmap->{$key} = '$(DESTDIR)'.$dirmap->{$key};
|
||||
}
|
||||
}
|
||||
|
||||
sub display_configuration {
|
||||
my $config = shift;
|
||||
my $dirmap = shift;
|
||||
|
@ -1420,9 +1436,10 @@ install :: all install_koha set_koha_ownership set_koha_permissions warn_koha_en
|
|||
|
||||
$install .= "\n";
|
||||
$install .= "set_koha_ownership ::\n";
|
||||
# Do not try to change ownership if DESTDIR is set
|
||||
if ($config{'INSTALL_MODE'} eq 'standard' and $config{'KOHA_USER'} ne "root") {
|
||||
foreach my $key (sort keys %$target_directories) {
|
||||
$install .= "\t\$(NOECHO) chown -R $config{'KOHA_USER'}:$config{'KOHA_GROUP'} \$(KOHA_DEST_$key)\n"
|
||||
$install .= "\t\$(NOECHO) if test -z \"\$(DESTDIR)\"; then chown -R $config{'KOHA_USER'}:$config{'KOHA_GROUP'} \$(KOHA_DEST_$key); fi\n"
|
||||
unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or exists $skip_directories->{$key};
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue