2
# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*-
5
# The Intltool Message Updater
7
# Copyright (C) 2000-2003 Free Software Foundation.
9
# Intltool is free software; you can redistribute it and/or
10
# modify it under the terms of the GNU General Public License
11
# version 2 published by the Free Software Foundation.
13
# Intltool is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
# General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
# As a special exception to the GNU General Public License, if you
23
# distribute this file as part of a program that contains a
24
# configuration script generated by Autoconf, you may include it under
25
# the same distribution terms that you use for the rest of that program.
27
# Authors: Kenneth Christiansen <kenneth@gnu.org>
29
# Darin Adler <darin@bentspoon.com>
31
## Release information
32
my $PROGRAM = "intltool-update";
33
my $VERSION = "0.31.2";
34
my $PACKAGE = "intltool";
43
## Scalars used by the option stuff
52
my $GETTEXT_PACKAGE = "";
57
my %po_files_by_lang = ();
59
# Regular expressions to categorize file types.
60
# FIXME: Please check if the following is correct
63
"xml(?:\\.in)*|". # http://www.w3.org/XML/ (Note: .in is not required)
64
"ui|". # Bonobo specific - User Interface desc. files
66
"glade2?(?:\\.in)*|". # Glade specific - User Interface desc. files (Note: .in is not required)
67
"scm(?:\\.in)*|". # ? (Note: .in is not required)
68
"oaf(?:\\.in)+|". # DEPRECATED: Replaces by Bonobo .server files
70
"server(?:\\.in)+|". # Bonobo specific
71
"sheet(?:\\.in)+|". # ?
72
"schemas(?:\\.in)+|". # GConf specific
73
"pong(?:\\.in)+|". # DEPRECATED: PONG is not used [by GNOME] any longer.
74
"kbd(?:\\.in)+"; # GOK specific.
77
"desktop(?:\\.in)+|". # http://www.freedesktop.org/Standards/menu-spec
78
"caves(?:\\.in)+|". # GNOME Games specific
79
"directory(?:\\.in)+|". # http://www.freedesktop.org/Standards/menu-spec
80
"soundlist(?:\\.in)+|". # GNOME specific
81
"keys(?:\\.in)+|". # GNOME Mime database specific
82
"theme(?:\\.in)+"; # http://www.freedesktop.org/Standards/icon-theme-spec
84
my $buildin_gettext_support =
85
"c|y|cs|cc|cpp|c\\+\\+|h|hh|gob|py";
87
## Always flush buffer when printing
90
## Sometimes the source tree will be rooted somewhere else.
94
$SRCDIR = $ENV{"srcdir"} if $ENV{"srcdir"};
95
$POTFILES_in = "<$SRCDIR/POTFILES.in";
100
"help" => \$HELP_ARG,
101
"version" => \$VERSION_ARG,
102
"dist|d" => \$DIST_ARG,
103
"pot|p" => \$POT_ARG,
104
"headers|s" => \$HEADERS_ARG,
105
"maintain|m" => \$MAINTAIN_ARG,
106
"report|r" => \$REPORT_ARG,
107
"verbose|x" => \$VERBOSE,
108
"gettext-package|g=s" => \$GETTEXT_PACKAGE,
109
"output-file|o=s" => \$OUTPUT_FILE,
110
) or &Console_WriteError_InvalidOption;
112
&Console_Write_IntltoolHelp if $HELP_ARG;
113
&Console_Write_IntltoolVersion if $VERSION_ARG;
115
my $arg_count = ($DIST_ARG > 0)
118
+ ($MAINTAIN_ARG > 0)
121
&Console_Write_IntltoolHelp if $arg_count > 1;
123
# --version and --help don't require a module name
124
my $MODULE = $GETTEXT_PACKAGE || &FindPackageName;
135
elsif ($MAINTAIN_ARG)
143
&Console_Write_CoverageReport;
145
elsif ((defined $ARGV[0]) && $ARGV[0] =~ /^[a-z]/)
149
## Report error if the language file supplied
150
## to the command line is non-existent
151
&Console_WriteError_NotExisting("$lang.po") if ! -s "$lang.po";
155
print "Working, please wait..." if $VERBOSE;
159
&POFile_Update ($lang, $OUTPUT_FILE);
160
&Console_Write_TranslationStatus ($lang, $OUTPUT_FILE);
164
&Console_Write_IntltoolHelp;
171
sub Console_Write_IntltoolVersion
174
${PROGRAM} (${PACKAGE}) $VERSION
175
Written by Kenneth Christiansen, Maciej Stachowiak, and Darin Adler.
177
Copyright (C) 2000-2003 Free Software Foundation, Inc.
178
This is free software; see the source for copying conditions. There is NO
179
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
184
sub Console_Write_IntltoolHelp
187
Usage: ${PROGRAM} [OPTION]... LANGCODE
188
Updates PO template files and merge them with the translations.
190
Mode of operation (only one is allowed):
191
-p, --pot generate the PO template only
192
-s, --headers generate the header files in POTFILES.in
193
-m, --maintain search for left out files from POTFILES.in
194
-r, --report display a status report for the module
195
-d, --dist merge LANGCODE.po with existing PO template
198
-g, --gettext-package=NAME override PO template name, useful with --pot
199
-o, --output-file=FILE write merged translation to FILE
200
-x, --verbose display lots of feedback
201
--help display this help and exit
202
--version output version information and exit
205
${PROGRAM} --pot just create a new PO template
206
${PROGRAM} xy create new PO template and merge xy.po with it
208
Report bugs to http://bugzilla.gnome.org/ (product name "$PACKAGE")
209
or send email to <xml-i18n-tools\@gnome.org>.
214
sub POFile_DetermineType ($)
219
my $xml_regex = "(?:" . $xml_support . ")";
220
my $ini_regex = "(?:" . $ini_support . ")";
221
my $buildin_regex = "(?:" . $buildin_gettext_support . ")";
223
if ($type =~ /\[type: gettext\/([^\]].*)]/)
227
elsif ($type =~ /schemas(\.in)+$/)
229
$gettext_type="schemas";
231
elsif ($type =~ /glade2?(\.in)*$/)
233
$gettext_type="glade";
235
elsif ($type =~ /scm(\.in)*$/)
237
$gettext_type="scheme";
239
elsif ($type =~ /keys(\.in)+$/)
241
$gettext_type="keys";
246
elsif ($type =~ /$xml_regex$/)
250
elsif ($type =~ /$ini_regex$/)
254
elsif ($type =~ /$buildin_regex$/)
256
$gettext_type="buildin";
260
$gettext_type="unknown";
263
return "gettext\/$gettext_type";
266
sub TextFile_DetermineEncoding ($)
268
my $gettext_code="ASCII"; # All files are ASCII by default
269
my $filetype=`file $_ | cut -d ' ' -f 2`;
273
if ($filetype =~ /^(ISO|UTF)/)
275
chomp ($gettext_code = $filetype);
277
elsif ($filetype =~ /^XML/)
279
$gettext_code="UTF-8"; # We asume that .glade and other .xml files are UTF-8
283
return $gettext_code;
291
@buf_i18n_xml_unmarked,
294
@buf_potfiles_ignore,
296
@buf_allfiles_sorted,
300
## Search and find all translatable files
302
push @buf_i18n_plain, "$File::Find::name" if /\.($buildin_gettext_support)$/;
303
push @buf_i18n_xml, "$File::Find::name" if /\.($xml_support)$/;
304
push @buf_i18n_ini, "$File::Find::name" if /\.($ini_support)$/;
305
push @buf_i18n_xml_unmarked, "$File::Find::name" if /\.(schemas(\.in)+)$/;
309
open POTFILES, $POTFILES_in or die "$PROGRAM: there's no POTFILES.in!\n";
310
@buf_potfiles = grep !/^(#|\s*$)/, <POTFILES>;
313
foreach (@buf_potfiles) {
317
print "Searching for missing translatable files...\n" if $VERBOSE;
319
## Check if we should ignore some found files, when
320
## comparing with POTFILES.in
321
foreach my $ignore ("POTFILES.skip", "POTFILES.ignore")
323
(-s $ignore) or next;
325
if ("$ignore" eq "POTFILES.ignore")
327
print "The usage of POTFILES.ignore is deprecated. Please consider moving the\n".
328
"content of this file to POTFILES.skip.\n";
331
print "Found $ignore: Ignoring files...\n" if $VERBOSE;
332
open FILE, "<$ignore" or die "ERROR: Failed to open $ignore!\n";
336
push @buf_potfiles_ignore, $_ unless /^(#|\s*$)/;
340
@buf_potfiles = (@buf_potfiles_ignore, @buf_potfiles);
343
foreach my $file (@buf_i18n_plain)
351
# Handle continued multi-line comment.
354
next unless s-.*\*/--;
358
# Handle continued macro.
361
$in_macro = 0 unless /\\$/;
365
# Handle start of macro (or any preprocessor directive).
368
$in_macro = 1 if /^([^\\]|\\.)*\\$/;
372
# Handle comments and quoted text.
373
while (m-(/\*|//|\'|\")-) # \' and \" keep emacs perl mode happy
384
elsif ($match eq "//")
390
if (!s-$match([^\\]|\\.)*?$match-QUOTEDTEXT-)
392
warn "mismatched quotes at line $. in $file\n";
398
if (/\.GetString ?\(QUOTEDTEXT/)
400
## Remove the first 3 chars and add newline
401
push @buf_allfiles, unpack("x3 A*", $file) . "\n";
407
## Remove the first 3 chars and add newline
408
push @buf_allfiles, unpack("x3 A*", $file) . "\n";
415
foreach my $file (@buf_i18n_xml)
421
# FIXME: share the pattern matching code with intltool-extract
422
if (/\s_(.*)=\"/ || /<_[^>]+>/ || /translatable=\"yes\"/)
424
push @buf_allfiles, unpack("x3 A*", $file) . "\n";
431
foreach my $file (@buf_i18n_ini)
438
push @buf_allfiles, unpack("x3 A*", $file) . "\n";
445
foreach my $file (@buf_i18n_xml_unmarked)
447
push @buf_allfiles, unpack("x3 A*", $file) . "\n";
451
@buf_allfiles_sorted = sort (@buf_allfiles);
452
@buf_potfiles_sorted = sort (@buf_potfiles);
455
foreach (@buf_potfiles_sorted)
462
foreach (@buf_allfiles_sorted)
464
if (!exists($in2{$_}))
470
my @buf_potfiles_notexist;
472
foreach (@buf_potfiles_sorted)
474
chomp (my $dummy = $_);
475
if ("$dummy" ne "" and ! -f "../$dummy")
477
push @buf_potfiles_notexist, $_;
481
## Save file with information about the files missing
482
## if any, and give information about this procedure.
483
if (@result + @buf_potfiles_notexist > 0)
487
print "\n" if $VERBOSE;
489
open OUT, ">missing";
492
warn "\e[1mThe following files contain translations and are currently not in use. Please\e[0m\n".
493
"\e[1mconsider adding these to the POTFILES.in file, located in the po/ directory.\e[0m\n\n";
494
print STDERR @result, "\n";
495
warn "If some of these files are left out on purpose then please add them to\n".
496
"POTFILES.skip instead of POTFILES.in. A file \e[1m'missing'\e[0m containing this list\n".
497
"of left out files has been written in the current directory.\n";
499
if (@buf_potfiles_notexist)
502
open OUT, ">notexist";
503
print OUT @buf_potfiles_notexist;
505
warn "\n" if ($VERBOSE or @result);
506
warn "\e[1mThe following files do not exist anymore:\e[0m\n\n";
507
warn @buf_potfiles_notexist, "\n";
508
warn "Please remove them from POTFILES.in or POTFILES.skip. A file \e[1m'notexist'\e[0m\n".
509
"containing this list of absent files has been written in the current directory.\n";
513
## If there is nothing to complain about, notify the user
515
print "\nAll files containing translations are present in POTFILES.in.\n" if $VERBOSE;
519
sub Console_WriteError_InvalidOption
521
## Handle invalid arguments
522
print STDERR "Try `${PROGRAM} --help' for more information.\n";
528
my $EXTRACT = `which intltool-extract 2>/dev/null`;
531
$EXTRACT = $ENV{"INTLTOOL_EXTRACT"} if $ENV{"INTLTOOL_EXTRACT"};
533
## Generate the .h header files, so we can allow glade and
534
## xml translation support
537
print STDERR "\n *** The intltool-extract script wasn't found!"
538
."\n *** Without it, intltool-update can not generate files.\n";
543
open (FILE, $POTFILES_in) or die "$PROGRAM: POTFILES.in not found.\n";
548
next if /^\[\s*encoding/;
550
## Find xml files in POTFILES.in and generate the
551
## files with help from the extract script
553
my $gettext_type= &POFile_DetermineType ($1);
555
if (/\.($xml_support|$ini_support)$/ || /^\[/)
559
my $filename = "../$_";
563
system ($EXTRACT, "--update", "--srcdir=$SRCDIR",
564
"--type=$gettext_type", $filename);
568
system ($EXTRACT, "--update", "--type=$gettext_type",
569
"--srcdir=$SRCDIR", "--quiet", $filename);
578
# Generate .pot file from POTFILES.in
580
sub GeneratePOTemplate
582
my $XGETTEXT = `which xgettext 2>/dev/null`;
583
my $XGETTEXT_ARGS = '';
586
$XGETTEXT = $ENV{"XGETTEXT"} if $ENV{"XGETTEXT"};
587
$XGETTEXT_ARGS = $ENV{"XGETTEXT_ARGS"} if $ENV{"XGETTEXT_ARGS"};
591
print STDERR " *** xgettext is not found on this system!\n".
592
" *** Without it, intltool-update can not extract strings.\n";
596
print "Building $MODULE.pot...\n" if $VERBOSE;
598
open INFILE, $POTFILES_in;
599
unlink "POTFILES.in.temp";
600
open OUTFILE, ">POTFILES.in.temp";
602
my $gettext_support_nonascii = 0;
604
# checks for GNU gettext >= 0.12
605
my $dummy = `$XGETTEXT --version --from-code=UTF-8 >/dev/null 2>/dev/null`;
608
$gettext_support_nonascii = 1;
612
# urge everybody to upgrade gettext
613
print STDERR "WARNING: This version of gettext does not support extracting non-ASCII\n".
614
" strings. That means you should install a version of gettext\n".
615
" that supports non-ASCII strings (such as GNU gettext >= 0.12),\n".
616
" or have to let non-ASCII strings untranslated. (If there is any)\n";
619
my $encoding = "ASCII";
620
my $forced_gettext_code;
622
my $encoding_problem_is_reported = 0;
626
next if (/^#/ or /^\s*$/);
632
if (/^\[\s*encoding:\s*(.*)\s*\]/)
634
$forced_gettext_code=$1;
636
elsif (/\.($xml_support|$ini_support)$/ || /^\[/)
639
print OUTFILE "$_.h\n";
640
push @temp_headers, "../$_.h";
641
$gettext_code = &TextFile_DetermineEncoding ("../$_.h") if ($gettext_support_nonascii and not defined $forced_gettext_code);
645
if ($SRCDIR eq ".") {
646
print OUTFILE "$_\n";
648
print OUTFILE "$SRCDIR/../$_\n";
650
$gettext_code = &TextFile_DetermineEncoding ("../$_") if ($gettext_support_nonascii and not defined $forced_gettext_code);
653
next if (! $gettext_support_nonascii);
655
if (defined $forced_gettext_code)
657
$encoding=$forced_gettext_code;
659
elsif (defined $gettext_code and "$encoding" ne "$gettext_code")
661
if ($encoding eq "ASCII")
663
$encoding=$gettext_code;
665
elsif ($gettext_code ne "ASCII")
667
# Only report once because the message is quite long
668
if (! $encoding_problem_is_reported)
670
print STDERR "WARNING: You should use the same file encoding for all your project files,\n".
671
" but $PROGRAM thinks that most of the source files are in\n".
672
" $encoding encoding, while \"$_\" is (likely) in\n".
673
" $gettext_code encoding. If you are sure that all translatable strings\n".
674
" are in same encoding (say UTF-8), please \e[1m*prepend*\e[0m the following\n".
675
" line to POTFILES.in:\n\n".
676
" [encoding: UTF-8]\n\n".
677
" and make sure that configure.in/ac checks for $PACKAGE >= 0.27 .\n".
678
"(such warning message will only be reported once.)\n";
679
$encoding_problem_is_reported = 1;
688
unlink "$MODULE.pot";
689
my @xgettext_argument=("$XGETTEXT",
692
"--output\=$MODULE\.pot",
693
"--files-from\=\.\/POTFILES\.in\.temp");
694
my $XGETTEXT_KEYWORDS = &FindPOTKeywords;
695
push @xgettext_argument, $XGETTEXT_KEYWORDS;
696
push @xgettext_argument, "--from-code\=$encoding" if ($gettext_support_nonascii);
697
push @xgettext_argument, $XGETTEXT_ARGS if $XGETTEXT_ARGS;
698
my $xgettext_command = join ' ', @xgettext_argument;
700
# intercept xgettext error message
701
print "Running $xgettext_command\n" if $VERBOSE;
702
my $xgettext_error_msg = `$xgettext_command 2>\&1`;
703
my $command_failed = $?;
705
unlink "POTFILES.in.temp";
707
print "Removing generated header (.h) files..." if $VERBOSE;
708
unlink foreach (@temp_headers);
709
print "done.\n" if $VERBOSE;
711
if (! $command_failed)
713
if (! -e "$MODULE.pot")
715
print "None of the files in POTFILES.in contain strings marked for translation.\n" if $VERBOSE;
719
print "Wrote $MODULE.pot\n" if $VERBOSE;
724
if ($xgettext_error_msg =~ /--from-code/)
726
# replace non-ASCII error message with a more useful one.
727
print STDERR "ERROR: xgettext failed to generate PO template file because there is non-ASCII\n".
728
" string marked for translation. Please make sure that all strings marked\n".
729
" for translation are in uniform encoding (say UTF-8), then \e[1m*prepend*\e[0m the\n".
730
" following line to POTFILES.in and rerun $PROGRAM:\n\n".
731
" [encoding: UTF-8]\n\n";
735
print STDERR "$xgettext_error_msg";
736
if (-e "$MODULE.pot")
739
print STDERR "ERROR: xgettext failed but still managed to generate PO template file.\n".
740
" Please consult error message above if there is any.\n";
744
print STDERR "ERROR: xgettext failed to generate PO template file. Please consult\n".
745
" error message above if there is any.\n";
754
-f "$MODULE.pot" or die "$PROGRAM: $MODULE.pot does not exist.\n";
756
my ($lang, $outfile) = @_;
758
print "Merging $lang.po with $MODULE.pot..." if $VERBOSE;
760
my $infile = "$lang.po";
761
$outfile = "$lang.po" if ($outfile eq "");
763
# I think msgmerge won't overwrite old file if merge is not successful
764
system ("msgmerge", "-o", $outfile, $infile, "$MODULE.pot");
767
sub Console_WriteError_NotExisting
771
## Report error if supplied language file is non-existing
772
print STDERR "$PROGRAM: $file does not exist!\n";
773
print STDERR "Try '$PROGRAM --help' for more information.\n";
779
my @po_files = glob ("./*.po");
781
@languages = map (&POFile_GetLanguage, @po_files);
783
foreach my $lang (@languages)
785
$po_files_by_lang{$lang} = shift (@po_files);
789
sub POFile_GetLanguage ($)
791
s/^(.*\/)?(.+)\.po$/$2/;
795
sub Console_Write_TranslationStatus
797
my ($lang, $output_file) = @_;
799
$output_file = "$lang.po" if ($output_file eq "");
801
system ("msgfmt", "-o", "/dev/null", "--statistics", $output_file);
804
sub Console_Write_CoverageReport
808
foreach my $lang (@languages)
811
&POFile_Update ($lang, "");
814
print "\n\n * Current translation support in $MODULE \n\n";
816
foreach my $lang (@languages)
819
system ("msgfmt", "-o", "/dev/null", "--statistics", "$lang.po");
823
sub SubstituteVariable
827
# always need to rewind file whenever it has been accessed
830
# cache each variable. varhash is global to we can add
831
# variables elsewhere.
836
($varhash{$1} = $2) =~ s/^["'](.*)["']$/$1)/;
840
if ($str =~ /^(.*)\${?([A-Z_]+)}?(.*)$/)
844
my $sub = $varhash{$2};
846
return SubstituteVariable ("$untouched$sub$rest");
853
my $base_dirname = getcwd();
854
$base_dirname =~ s@.*/@@;
856
my ($conf_in, $src_dir);
858
if ($base_dirname =~ /^po(-.+)?$/)
865
open (IN, "<Makevars") || die "can't open Makevars: $!";
869
if (/^top_builddir[ \t]*=/)
872
$src_dir =~ s/^top_builddir[ \t]*=[ \t]*([^ \t\n\r]*)/$1/;
875
if (-f "$src_dir" . "/configure.ac") {
876
$conf_in = "$src_dir" . "/configure.ac" . "\n";
878
$conf_in = "$src_dir" . "/configure.in" . "\n";
885
$conf_in || die "Cannot find top_builddir in Makevars.";
887
elsif (-f "../configure.ac")
889
$conf_in = "../configure.ac";
891
elsif (-f "../configure.in")
893
$conf_in = "../configure.in";
900
open (IN, "<Makefile") || return;
904
if (/^top_srcdir[ \t]*=/)
907
$src_dir =~ s/^top_srcdir[ \t]*=[ \t]*([^ \t\n\r]*)/$1/;
910
$conf_in = "$src_dir" . "/configure.in" . "\n";
917
$conf_in || die "Cannot find top_srcdir in Makefile.";
920
open (CONF, "<$conf_in");
924
print STDERR "$PROGRAM: Unable to proceed.\n" .
925
"Make sure to run this script inside the po directory.\n";
933
my $domain = &FindMakevarsDomain;
934
my $name = $domain || "untitled";
940
open (IN, "<&CONF") || return $name;
942
local $/; # slurp mode
947
# priority for getting package name:
949
# 2. first argument of AC_INIT (with >= 2 arguments)
950
# 3. first argument of AM_INIT_AUTOMAKE (with >= 2 argument)
952
# /^AM_INIT_AUTOMAKE\([\s\[]*([^,\)\s\]]+)/m
953
# the \s makes this not work, why?
954
if ($conf_source =~ /^AM_INIT_AUTOMAKE\(([^,\)]+),([^,\)]+)/m)
956
($name, $version) = ($1, $2);
957
$name =~ s/[\[\]\s]//g;
958
$version =~ s/[\[\]\s]//g;
959
$varhash{"AC_PACKAGE_NAME"} = $name;
960
$varhash{"PACKAGE"} = $name;
961
$varhash{"AC_PACKAGE_VERSION"} = $version;
962
$varhash{"VERSION"} = $version;
965
if ($conf_source =~ /^AC_INIT\(([^,\)]+),([^,\)]+)/m)
967
($name, $version) = ($1, $2);
968
$name =~ s/[\[\]\s]//g;
969
$version =~ s/[\[\]\s]//g;
970
$varhash{"AC_PACKAGE_NAME"} = $name;
971
$varhash{"PACKAGE"} = $name;
972
$varhash{"AC_PACKAGE_VERSION"} = $version;
973
$varhash{"VERSION"} = $version;
976
# \s makes this not work, why?
977
$name = $1 if $conf_source =~ /^GETTEXT_PACKAGE=\[?([^\n\]]+)/m;
979
# prepend '$' to auto* internal variables, usually they are
980
# used in configure.in/ac without the '$'
981
$name =~ s/AC_/\$AC_/g;
982
$name =~ s/\$\$/\$/g;
984
$name = $domain if $domain;
986
$name = SubstituteVariable ($name);
987
$name =~ s/^["'](.*)["']$/$1/;
989
return $name if $name;
996
my $keywords = "--keyword\=\_ --keyword\=N\_ --keyword\=U\_";
997
my $varname = "XGETTEXT_OPTIONS";
1000
open (IN, "<Makevars") || (open(IN, "<Makefile.in.in") && ($varname = "XGETTEXT_KEYWORDS")) || return $keywords;
1002
local $/; # slurp mode
1003
$make_source = <IN>;
1007
$keywords = $1 if $make_source =~ /^$varname[ ]*=\[?([^\n\]]+)/m;
1012
sub FindMakevarsDomain
1016
my $makevars_source; {
1018
open (IN, "<Makevars") || return $domain;
1020
local $/; # slurp mode
1021
$makevars_source = <IN>;
1025
$domain = $1 if $makevars_source =~ /^DOMAIN[ ]*=\[?([^\n\]\$]+)/m;
1026
$domain =~ s/^\s+//;
1027
$domain =~ s/\s+$//;