OBS: fix NSIS template converter (again)
[siplcs.git] / contrib / opensuse-build-service / generate_nsi.pl
blobb50d083585820534b106652fa64dde4c9a9ab586
1 #!/usr/bin/perl
2 use 5.008;
3 use strict;
4 use warnings;
6 # check commandline arguments
7 die "Usage: $0 <LINGUAS file> < nsi-template > nsi-output\n"
8 if @ARGV < 1;
10 # process LINGUAS file
11 open(my $fh, "<", $ARGV[0])
12 or die "$0: can't open LINGUAS file '$ARGV[0]': $!\n";
13 my %languages = map { ($_, 1) } map { chomp; s/^\s+//; s/\s+$//; $_ } <$fh>;
14 close($fh)
15 or die "$0: error while reading LINGUAS file '$ARGV[0]': $!\n";
16 print STDERR "Found ", scalar(keys %languages), " language(s): ",
17 join(" ", sort keys %languages), "\n";
19 # read .nsi template from STDIN
20 # write .nsi file to STDOUT
21 while (<STDIN>) {
22 if (/^;;; INSTALL_FILES_LOCALE/) {
23 print map({
24 ("SetOutPath \"\$INSTDIR\\locale\\$_\\LC_MESSAGES\"\n",
25 "File \"\${MINGW_DATADIR}\\locale\\$_\\LC_MESSAGES\\pidgin-sipe.mo\"\n")
26 } sort keys %languages);
27 } elsif (/^;;; DELETE_FILES_LOCALE/) {
28 print map({
29 "Delete \"\$INSTDIR\\locale\\$_\\LC_MESSAGES\\pidgin-sipe.mo\"\n"
30 } sort keys %languages);
31 } else {
32 print;
36 # That's all folks...
37 exit 0;