Hi, I'm trying to install custom files to a specific location which should be relative to the given prefix/install_base/.. In this case into share/locale. So e.g. if --prefix=/usr/local then it should install into /usr/local/share/locale/.
I'm using Module::Build 0.340201 on Debian Squeeze. I tried the following ($class has a method process_locale_files() which creates the files in blib/locale, that part works just fine): my $build = $class->new( ... ); $build->add_build_element('locale'); $build->install_base_relpaths(locale => 'locale'); $build->create_build_script; But no files get installed. After some testing it looks like $build->install_base_relpaths() doesn't work at all - $build->install_base_relpaths(lib => 'whatever') does nothing for me, my .pm files are still installed in the same place. I could use $build->install_path(locale => '...') but that requires an absolute path. At the moment I'm using the following hack to get the real installation path (I'm not sure if that's even correct all the time): sub install_base_path { my $self = shift; if (defined $self->install_base) { return $self->install_base; } elsif (defined $self->prefix) { return $self->prefix; } else { return $self->original_prefix->{$self->installdirs}; } } It seems to work, but doesn't look like a good solution. Is there a variable which returns the absolute installation prefix? I couldn't find any in the documentation. Btw. the real reason why I need this is to install .po/.mo files in share/locale. Is there a simple way to do that? I attached my current solution (including the hack above). If there's a better way to handle that, please tell me. Regards, Simon -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9
#!/usr/bin/perl use strict; use warnings; use Module::Build; my $class = Module::Build->subclass(code => <<'EOF'); use File::Path (); # Convert .po files to .mo and install them. sub process_locale_files { my $self = shift; my $pos = $self->rscan_dir('po/', '.*\.po$'); foreach my $po (@$pos) { $po =~ /^po\/(.+)\.po$/; my $path = "blib/locale/$1/LC_MESSAGES"; my $mo = "$path/pabook.mo"; if (not $self->up_to_date($po, $mo)) { File::Path::mkpath($path); $self->do_system("msgfmt -o $mo $po"); } } } # Get the prefix (or whatever Module::Build calls it) of the current # installation. sub install_base_path { my $self = shift; if (defined $self->install_base) { return $self->install_base; } elsif (defined $self->prefix) { return $self->prefix; } else { return $self->original_prefix->{$self->installdirs}; } } EOF my $build = $class->new( ... ); # Install .mo files in share/locale. $build->add_build_element('locale'); $build->install_path(locale => $build->install_base_path . "/share/locale"); $build->create_build_script;
pgp9XQl3PmAxw.pgp
Description: PGP signature