MSVC: Recognize PGFILEDESC in contrib and conversion_procs modules.
authorNoah Misch <noah@leadboat.com>
Mon, 14 Jul 2014 18:07:21 +0000 (14:07 -0400)
committerNoah Misch <noah@leadboat.com>
Mon, 14 Jul 2014 18:07:21 +0000 (14:07 -0400)
Achieve this by consistently using four-argument Solution::AddProject()
calls.  Remove ad hoc Makefile parsing made redundant by doing that.

Michael Paquier and Noah Misch, reviewed by MauMau.

src/tools/msvc/Mkvcbuild.pm
src/tools/msvc/clean.bat

index 8002f2348775d4456c97e59b93a8cf68769e930b..71450f47739c405106686d54f974a0b0c57b8d50 100644 (file)
@@ -474,8 +474,10 @@ sub mkvcbuild
                push @contrib_excludes, 'uuid-ossp';
        }
 
-       # Pgcrypto makefile too complex to parse....
-       my $pgcrypto = $solution->AddProject('pgcrypto', 'dll', 'crypto');
+       # AddProject() does not recognize the constructs used to populate OBJS in
+       # the pgcrypto Makefile, so it will discover no files.
+       my $pgcrypto =
+         $solution->AddProject('pgcrypto', 'dll', 'crypto', 'contrib\\pgcrypto');
        $pgcrypto->AddFiles(
                'contrib\pgcrypto', 'pgcrypto.c',
                'px.c',             'px-hmac.c',
@@ -527,18 +529,9 @@ sub mkvcbuild
          || die 'Could not match in conversion makefile' . "\n";
        foreach my $sub (split /\s+/, $1)
        {
-               my $mf = Project::read_file(
-                       'src\backend\utils\mb\conversion_procs\\' . $sub . '\Makefile');
-               my $p = $solution->AddProject($sub, 'dll', 'conversion procs');
-               $p->AddFile('src\backend\utils\mb\conversion_procs\\'
-                         . $sub . '\\'
-                         . $sub
-                         . '.c');
-               if ($mf =~ m{^SRCS\s*\+=\s*(.*)$}m)
-               {
-                       $p->AddFile(
-                               'src\backend\utils\mb\conversion_procs\\' . $sub . '\\' . $1);
-               }
+               my $dir = 'src\backend\utils\mb\conversion_procs\\' . $sub;
+               my $p = $solution->AddProject($sub, 'dll', 'conversion procs', $dir);
+               $p->AddFile("$dir\\$sub.c");    # implicit source file
                $p->AddReference($postgres);
        }
 
@@ -646,44 +639,17 @@ sub AddContrib
        if ($mf =~ /^MODULE_big\s*=\s*(.*)$/mg)
        {
                my $dn = $1;
-               $mf =~ s{\\\s*[\r\n]+}{}mg;
-               my $proj = $solution->AddProject($dn, 'dll', 'contrib');
-               $mf =~ /^OBJS\s*=\s*(.*)$/gm
-                 || croak "Could not find objects in MODULE_big for $n\n";
-               my $objs = $1;
-               while ($objs =~ /\b([\w-]+\.o)\b/g)
-               {
-                       my $o = $1;
-                       $o =~ s/\.o$/.c/;
-                       $proj->AddFile('contrib\\' . $n . '\\' . $o);
-               }
+               my $proj =
+                 $solution->AddProject($dn, 'dll', 'contrib', 'contrib\\' . $n);
                $proj->AddReference($postgres);
-               if ($mf =~ /^SUBDIRS\s*:?=\s*(.*)$/mg)
-               {
-                       foreach my $d (split /\s+/, $1)
-                       {
-                               my $mf2 = Project::read_file(
-                                       'contrib\\' . $n . '\\' . $d . '\Makefile');
-                               $mf2 =~ s{\\\s*[\r\n]+}{}mg;
-                               $mf2 =~ /^SUBOBJS\s*=\s*(.*)$/gm
-                                 || croak
-                                 "Could not find objects in MODULE_big for $n, subdir $d\n";
-                               $objs = $1;
-                               while ($objs =~ /\b([\w-]+\.o)\b/g)
-                               {
-                                       my $o = $1;
-                                       $o =~ s/\.o$/.c/;
-                                       $proj->AddFile('contrib\\' . $n . '\\' . $d . '\\' . $o);
-                               }
-                       }
-               }
                AdjustContribProj($proj);
        }
        elsif ($mf =~ /^MODULES\s*=\s*(.*)$/mg)
        {
                foreach my $mod (split /\s+/, $1)
                {
-                       my $proj = $solution->AddProject($mod, 'dll', 'contrib');
+                       my $proj =
+                         $solution->AddProject($mod, 'dll', 'contrib', 'contrib\\' . $n);
                        $proj->AddFile('contrib\\' . $n . '\\' . $mod . '.c');
                        $proj->AddReference($postgres);
                        AdjustContribProj($proj);
@@ -691,17 +657,8 @@ sub AddContrib
        }
        elsif ($mf =~ /^PROGRAM\s*=\s*(.*)$/mg)
        {
-               my $proj = $solution->AddProject($1, 'exe', 'contrib');
-               $mf =~ s{\\\s*[\r\n]+}{}mg;
-               $mf =~ /^OBJS\s*=\s*(.*)$/gm
-                 || croak "Could not find objects in PROGRAM for $n\n";
-               my $objs = $1;
-               while ($objs =~ /\b([\w-]+\.o)\b/g)
-               {
-                       my $o = $1;
-                       $o =~ s/\.o$/.c/;
-                       $proj->AddFile('contrib\\' . $n . '\\' . $o);
-               }
+               my $proj =
+                 $solution->AddProject($1, 'exe', 'contrib', 'contrib\\' . $n);
                AdjustContribProj($proj);
        }
        else
@@ -717,6 +674,7 @@ sub GenerateContribSqlFiles
 {
        my $n  = shift;
        my $mf = shift;
+       $mf =~ s{\\\s*[\r\n]+}{}mg;
        if ($mf =~ /^DATA_built\s*=\s*(.*)$/mg)
        {
                my $l = $1;
index e06838cc1ef12c92b2bc9bc51ab1df91608cc86f..4671f30e50c4eaba8e139c8abf6d7d0120dd6670 100755 (executable)
@@ -19,6 +19,8 @@ if exist pgsql.suo del /q /a:H pgsql.suo
 del /s /q src\bin\win32ver.rc 2> NUL
 del /s /q src\interfaces\win32ver.rc 2> NUL
 if exist src\backend\win32ver.rc del /q src\backend\win32ver.rc
+for /d %%f in (contrib\*) do if exist %%f\win32ver.rc del /q %%f\win32ver.rc
+for /d %%f in (src\backend\utils\mb\conversion_procs\*) do if exist %%f\win32ver.rc del /q %%f\win32ver.rc
 
 REM Delete files created with GenerateFiles() in Solution.pm
 if exist src\include\pg_config.h del /q src\include\pg_config.h