~ubuntu-branches/ubuntu/wily/po4a/wily-proposed

« back to all changes in this revision

Viewing changes to Build.PL

  • Committer: Bazaar Package Importer
  • Author(s): Nicolas FRANCOIS (Nekral)
  • Date: 2009-04-05 13:45:49 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090405134549-vdbywl1krdhmv4bf
Tags: 0.36.1-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
            require ExtUtils::Install;
27
27
#           $self->depends_on('build');
28
28
 
29
 
            ExtUtils::Install::install($self->install_map, 1, 0, $self->{args}{uninst}||0); 
 
29
            my %install_map = %{$self->install_map};
 
30
 
 
31
            my $mandir = $self->install_map->{'blib/bindoc'};
 
32
            $mandir =~ s/\/man1$//;
 
33
            $install_map{'blib/man'} = $mandir;
 
34
 
 
35
            my $localedir = $mandir;
 
36
            $localedir =~ s/\/man$/\/locale/;
 
37
            $install_map{'blib/po'} = $localedir;
 
38
 
 
39
            ExtUtils::Install::install(\%install_map, 1, 0, $self->{args}{uninst}||0); 
30
40
        }
31
41
        sub ACTION_binpo {
32
42
            my $self = shift;
111
121
            my $self = shift;
112
122
 
113
123
            use Pod::Man;
 
124
            use Encode;
114
125
 
115
126
            # Translate binaries manpages
116
 
            my $parser = Pod::Man->new ();
 
127
            my %options;
 
128
            $options{utf8} = 1;
 
129
            my $parser = Pod::Man->new (%options);
117
130
 
118
131
            system("PERL5LIB=lib perl po4a --previous po/pod.cfg") and die;
119
132
            system("mkdir -p blib/man/man7") and die;
121
134
            system("cp doc/po4a.7.pod blib/man/man7") and die;
122
135
 
123
136
            foreach $file (@{$self->rscan_dir('blib/man',qr{\.pod$})}) {
 
137
                next if $file =~ m/^man7/;
124
138
                my $out = $file;
125
139
                $out =~ s/\.pod$//;
126
140
                $section = $2;
135
149
                my $lang = $out;
136
150
                $lang =~ s/^blib\/man\/([^\/]*)\/.*$/$1/;
137
151
 
138
 
                my $command;
139
 
                $command = "msggrep -K -E -e \"Po4a Tools\" po/pod/$lang.po |";
140
 
                $command .= "msgconv -t UTF-8 | ";
141
 
                $command .= "msgexec /bin/sh -c '[ -n \"\$MSGEXEC_MSGID\" ] ";
142
 
                $command .= "&& cat || cat > /dev/null'";
 
152
                if ($lang eq "man7") {
 
153
                        $parser->{release} = $parser->{center} = "Po4a Tools";
 
154
                } else {
 
155
                        my $command;
 
156
                        $command = "msggrep -K -E -e \"Po4a Tools\" po/pod/$lang.po |";
 
157
                        $command .= "msgconv -t UTF-8 | ";
 
158
                        $command .= "msgexec /bin/sh -c '[ -n \"\$MSGEXEC_MSGID\" ] ";
 
159
                        $command .= "&& cat || cat > /dev/null'";
143
160
 
144
 
                my $title = `$command 2> /dev/null`;
145
 
                $title = "Po4a Tools" unless length $title;
146
 
                $parser->{release} = $parser->{center} = $title;
 
161
                        my $title = `$command 2> /dev/null`;
 
162
                        $title = "Po4a Tools" unless length $title;
 
163
                        $title = Encode::decode_utf8($title);
 
164
                        $parser->{release} = $parser->{center} = $title;
 
165
                }
147
166
                $parser->parse_from_file ($file, $out);
148
167
 
149
168
                system("gzip -9 -f $out") and die;
224
243
          'Denis Barbier <barbier@linuxfr.org>']
225
244
  );
226
245
 
227
 
# Tweak the installation path
228
 
#  Retrieve the prefix (There should be a better way)
229
 
my $base = $b->install_destination("bindoc");
230
 
$base =~ s/\/man\/man1//;
231
 
#  Set the paths for the manpages and MO files
232
 
$b->{properties}{install_sets}{$b->installdirs}{man} = $base.'/man';
233
 
$b->{properties}{install_sets}{$b->installdirs}{po} = $base.'/locale';
234
 
 
235
246
$b->create_build_script;
236
247