Support for installing NLS files, and update support to use gettext

from gnuwin32.
This commit is contained in:
Magnus Hagander 2007-03-24 22:16:49 +00:00
parent 36d35a14df
commit 8ca1571665
3 changed files with 57 additions and 4 deletions

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/install-win32.sgml,v 1.36 2007/03/23 09:57:55 mha Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/install-win32.sgml,v 1.37 2007/03/24 22:16:49 mha Exp $ -->
<chapter id="install-win32">
<title>Installation on <productname>Windows</productname></title>
@ -114,6 +114,15 @@
</para></listitem>
</varlistentry>
<varlistentry>
<term><productname>Gettext</productname></term>
<listitem><para>
Gettext is required to build with NLS support, and can be downloaded
from <ulink url="http://gnuwin32.sourceforge.net"></>. Note that binaries,
dependencies and developer files are all needed.
</para></listitem>
</varlistentry>
<varlistentry>
<term><productname>Microsoft Platform SDK</productname></term>
<listitem><para>

View File

@ -3,7 +3,7 @@ package Install;
#
# Package that provides 'make install' functionality for msvc builds
#
# $PostgreSQL: pgsql/src/tools/msvc/Install.pm,v 1.3 2007/03/24 15:28:48 mha Exp $
# $PostgreSQL: pgsql/src/tools/msvc/Install.pm,v 1.4 2007/03/24 22:16:49 mha Exp $
#
use strict;
use warnings;
@ -21,6 +21,8 @@ sub Install
$| = 1;
my $target = shift;
our $config;
require 'config.pl';
chdir("../../..") if (-f "../../../configure");
my $conf = "";
@ -57,6 +59,8 @@ sub Install
GenerateConversionScript($target);
GenerateTimezoneFiles($target,$conf);
CopyContribFiles($target);
GenerateNLSFiles($target,$config->{nls}) if ($config->{nls});
}
sub EnsureDirectories
@ -274,6 +278,46 @@ sub ParseAndCleanRule
return $flist;
}
sub GenerateNLSFiles
{
my $target = shift;
my $nlspath = shift;
my $D;
print "Installing NLS files...";
EnsureDirectories($target, "share/locale");
open($D,"dir /b /s nls.mk|") || croak "Could not list nls.mk\n";
while (<$D>)
{
chomp;
s/nls.mk/po/;
my $dir = $_;
next unless ($dir =~ /([^\\]+)\\po$/);
my $prgm = $1;
$prgm = 'postgres' if ($prgm eq 'backend');
my $E;
open($E,"dir /b $dir\\*.po|") || croak "Could not list contents of $_\n";
while (<$E>)
{
chomp;
my $lang;
next unless /^(.*)\.po/;
$lang = $1;
EnsureDirectories($target, "share/locale/$lang", "share/locale/$lang/LC_MESSAGES");
system(
"$nlspath\\bin\\msgfmt -o $target\\share\\locale\\$lang\\LC_MESSAGES\\$prgm.mo $dir\\$_"
)
&& croak("Could not run msgfmt on $dir\\$_");
print ".";
}
close($E);
}
close($D);
print "\n";
}
sub read_file
{
my $filename = shift;

View File

@ -2,7 +2,7 @@ package Solution;
#
# Package that encapsulates a Visual C++ solution file generation
#
# $PostgreSQL: pgsql/src/tools/msvc/Solution.pm,v 1.18 2007/03/23 08:43:51 mha Exp $
# $PostgreSQL: pgsql/src/tools/msvc/Solution.pm,v 1.19 2007/03/24 22:16:49 mha Exp $
#
use Carp;
use strict;
@ -313,7 +313,7 @@ sub AddProject
if ($self->{options}->{nls})
{
$proj->AddIncludeDir($self->{options}->{nls} . '\include');
$proj->AddLibrary($self->{options}->{nls} . '\lib\intl.lib');
$proj->AddLibrary($self->{options}->{nls} . '\lib\libintl.lib');
}
if ($self->{options}->{krb5})
{