Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 91f03ba

Browse files
committed
MSVC: Recognize PGFILEDESC in contrib and conversion_procs modules.
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.
1 parent 52be3aa commit 91f03ba

File tree

2 files changed

+16
-56
lines changed

2 files changed

+16
-56
lines changed

src/tools/msvc/Mkvcbuild.pm

+14-56
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,10 @@ sub mkvcbuild
474474
push @contrib_excludes, 'uuid-ossp';
475475
}
476476

477-
# Pgcrypto makefile too complex to parse....
478-
my $pgcrypto = $solution->AddProject('pgcrypto', 'dll', 'crypto');
477+
# AddProject() does not recognize the constructs used to populate OBJS in
478+
# the pgcrypto Makefile, so it will discover no files.
479+
my $pgcrypto =
480+
$solution->AddProject('pgcrypto', 'dll', 'crypto', 'contrib\\pgcrypto');
479481
$pgcrypto->AddFiles(
480482
'contrib\pgcrypto', 'pgcrypto.c',
481483
'px.c', 'px-hmac.c',
@@ -527,18 +529,9 @@ sub mkvcbuild
527529
|| die 'Could not match in conversion makefile' . "\n";
528530
foreach my $sub (split /\s+/, $1)
529531
{
530-
my $mf = Project::read_file(
531-
'src\backend\utils\mb\conversion_procs\\' . $sub . '\Makefile');
532-
my $p = $solution->AddProject($sub, 'dll', 'conversion procs');
533-
$p->AddFile('src\backend\utils\mb\conversion_procs\\'
534-
. $sub . '\\'
535-
. $sub
536-
. '.c');
537-
if ($mf =~ m{^SRCS\s*\+=\s*(.*)$}m)
538-
{
539-
$p->AddFile(
540-
'src\backend\utils\mb\conversion_procs\\' . $sub . '\\' . $1);
541-
}
532+
my $dir = 'src\backend\utils\mb\conversion_procs\\' . $sub;
533+
my $p = $solution->AddProject($sub, 'dll', 'conversion procs', $dir);
534+
$p->AddFile("$dir\\$sub.c"); # implicit source file
542535
$p->AddReference($postgres);
543536
}
544537

@@ -646,62 +639,26 @@ sub AddContrib
646639
if ($mf =~ /^MODULE_big\s*=\s*(.*)$/mg)
647640
{
648641
my $dn = $1;
649-
$mf =~ s{\\\s*[\r\n]+}{}mg;
650-
my $proj = $solution->AddProject($dn, 'dll', 'contrib');
651-
$mf =~ /^OBJS\s*=\s*(.*)$/gm
652-
|| croak "Could not find objects in MODULE_big for $n\n";
653-
my $objs = $1;
654-
while ($objs =~ /\b([\w-]+\.o)\b/g)
655-
{
656-
my $o = $1;
657-
$o =~ s/\.o$/.c/;
658-
$proj->AddFile('contrib\\' . $n . '\\' . $o);
659-
}
642+
my $proj =
643+
$solution->AddProject($dn, 'dll', 'contrib', 'contrib\\' . $n);
660644
$proj->AddReference($postgres);
661-
if ($mf =~ /^SUBDIRS\s*:?=\s*(.*)$/mg)
662-
{
663-
foreach my $d (split /\s+/, $1)
664-
{
665-
my $mf2 = Project::read_file(
666-
'contrib\\' . $n . '\\' . $d . '\Makefile');
667-
$mf2 =~ s{\\\s*[\r\n]+}{}mg;
668-
$mf2 =~ /^SUBOBJS\s*=\s*(.*)$/gm
669-
|| croak
670-
"Could not find objects in MODULE_big for $n, subdir $d\n";
671-
$objs = $1;
672-
while ($objs =~ /\b([\w-]+\.o)\b/g)
673-
{
674-
my $o = $1;
675-
$o =~ s/\.o$/.c/;
676-
$proj->AddFile('contrib\\' . $n . '\\' . $d . '\\' . $o);
677-
}
678-
}
679-
}
680645
AdjustContribProj($proj);
681646
}
682647
elsif ($mf =~ /^MODULES\s*=\s*(.*)$/mg)
683648
{
684649
foreach my $mod (split /\s+/, $1)
685650
{
686-
my $proj = $solution->AddProject($mod, 'dll', 'contrib');
651+
my $proj =
652+
$solution->AddProject($mod, 'dll', 'contrib', 'contrib\\' . $n);
687653
$proj->AddFile('contrib\\' . $n . '\\' . $mod . '.c');
688654
$proj->AddReference($postgres);
689655
AdjustContribProj($proj);
690656
}
691657
}
692658
elsif ($mf =~ /^PROGRAM\s*=\s*(.*)$/mg)
693659
{
694-
my $proj = $solution->AddProject($1, 'exe', 'contrib');
695-
$mf =~ s{\\\s*[\r\n]+}{}mg;
696-
$mf =~ /^OBJS\s*=\s*(.*)$/gm
697-
|| croak "Could not find objects in PROGRAM for $n\n";
698-
my $objs = $1;
699-
while ($objs =~ /\b([\w-]+\.o)\b/g)
700-
{
701-
my $o = $1;
702-
$o =~ s/\.o$/.c/;
703-
$proj->AddFile('contrib\\' . $n . '\\' . $o);
704-
}
660+
my $proj =
661+
$solution->AddProject($1, 'exe', 'contrib', 'contrib\\' . $n);
705662
AdjustContribProj($proj);
706663
}
707664
else
@@ -717,6 +674,7 @@ sub GenerateContribSqlFiles
717674
{
718675
my $n = shift;
719676
my $mf = shift;
677+
$mf =~ s{\\\s*[\r\n]+}{}mg;
720678
if ($mf =~ /^DATA_built\s*=\s*(.*)$/mg)
721679
{
722680
my $l = $1;

src/tools/msvc/clean.bat

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ if exist pgsql.suo del /q /a:H pgsql.suo
1919
del /s /q src\bin\win32ver.rc 2> NUL
2020
del /s /q src\interfaces\win32ver.rc 2> NUL
2121
if exist src\backend\win32ver.rc del /q src\backend\win32ver.rc
22+
for /d %%f in (contrib\*) do if exist %%f\win32ver.rc del /q %%f\win32ver.rc
23+
for /d %%f in (src\backend\utils\mb\conversion_procs\*) do if exist %%f\win32ver.rc del /q %%f\win32ver.rc
2224

2325
REM Delete files created with GenerateFiles() in Solution.pm
2426
if exist src\include\pg_config.h del /q src\include\pg_config.h

0 commit comments

Comments
 (0)