OSDN Git Service

Support for installing NLS files, and update support to use gettext
authorMagnus Hagander <magnus@hagander.net>
Sat, 24 Mar 2007 22:16:49 +0000 (22:16 +0000)
committerMagnus Hagander <magnus@hagander.net>
Sat, 24 Mar 2007 22:16:49 +0000 (22:16 +0000)
from gnuwin32.

doc/src/sgml/install-win32.sgml
src/tools/msvc/Install.pm
src/tools/msvc/Solution.pm

index 8889496..4244a0e 100644 (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>
     </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>
       It is recommended that you upgrade to the latest available version
index 707006d..181ff6f 100644 (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;
index d63d9e9..e665b49 100644 (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})
     {