Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit245de48

Browse files
committed
Adjust MSVC build scripts to parse Makefiles for defines
This adjusts the MSVC build scripts to look at the compile flags mentionedin the Makefile to look for -D arguments in order to determine whichconstants should be defined in Visual Studio builds.One small anomaly that appeared as a result of this change is that theMakefile for the ltree contrib module defined LOWER_NODE, but this wasnot properly defined in the MSVC build scripts. This meant that MSVCbuilds would differ in case sensitivity in the ltree module whencompared to builds using a make build environment. To maintain the samebehavior here we remove the -DLOWER_NODE from the Makefile and just alwaysdefine it in ltree.h for non-MSVC builds. We need to maintain the oldbehavior here as this affects the on-disk compatibility of GiST indexeswhen using the ltree type.The only other resulting change here is that REFINT_VERBOSE is now definedfor the autoinc, insert_username and moddatetime contrib modules.Previously on MSVC, this was only defined for the refint module. Thisaligns the behavior to build environments using make as all 4 of thesemodules share the same Makefile.Reviewed-by: Tom LaneDiscussion:https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com
1 parent15f16ec commit245de48

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

‎contrib/ltree/Makefile‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ OBJS = \
1212
ltree_op.o\
1313
ltxtquery_io.o\
1414
ltxtquery_op.o
15-
PG_CPPFLAGS = -DLOWER_NODE
1615

1716
EXTENSION = ltree
1817
DATA = ltree--1.1--1.2.sql ltree--1.1.sql ltree--1.0--1.1.sql

‎contrib/ltree/crc32.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
#include"postgres.h"
11+
#include"ltree.h"
1112

1213
#ifdefLOWER_NODE
1314
#include<ctype.h>

‎contrib/ltree/ltree.h‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@
1717
*/
1818
#defineLTREE_LABEL_MAX_CHARS 255
1919

20+
/*
21+
* LOWER_NODE used to be defined in the Makefile via the compile flags.
22+
* However the MSVC build scripts neglected to do the same which resulted in
23+
* MSVC builds not using LOWER_NODE. Since then, the MSVC scripts have been
24+
* modified to look for -D compile flags in Makefiles, so here, in order to
25+
* get the historic behavior of LOWER_NODE not being defined on MSVC, we only
26+
* define it when not building in that environment. This is important as we
27+
* want to maintain the same LOWER_NODE behavior after a pg_update.
28+
*/
29+
#ifndef_MSC_VER
30+
#defineLOWER_NODE
31+
#endif
32+
2033
typedefstruct
2134
{
2235
uint16len;/* label string length in bytes */

‎src/tools/msvc/Mkvcbuild.pm‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ my $libpq;
3535
my@unlink_on_exit;
3636

3737
# Set of variables for modules in contrib/ and src/test/modules/
38-
my$contrib_defines = {'refint'=>'REFINT_VERBOSE'};
38+
my$contrib_defines = {};
3939
my@contrib_uselibpq =
4040
('dblink','oid2name','postgres_fdw','vacuumlo','libpq_pipeline');
4141
my@contrib_uselibpgport = ('libpq_pipeline','oid2name','vacuumlo');
@@ -964,13 +964,15 @@ sub AddContrib
964964
my$subdir =shift;
965965
my$n =shift;
966966
my$mf = Project::read_file("$subdir/$n/Makefile");
967+
my@projects = ();
967968

968969
if ($mf =~/^MODULE_big\s*=\s*(.*)$/mg)
969970
{
970971
my$dn =$1;
971972
my$proj =$solution->AddProject($dn,'dll','contrib',"$subdir/$n");
972973
$proj->AddReference($postgres);
973974
AdjustContribProj($proj);
975+
push@projects,$proj;
974976
}
975977
elsif ($mf =~/^MODULES\s*=\s*(.*)$/mg)
976978
{
@@ -982,18 +984,35 @@ sub AddContrib
982984
$proj->AddFile("$subdir/$n/$filename");
983985
$proj->AddReference($postgres);
984986
AdjustContribProj($proj);
987+
push@projects,$proj;
985988
}
986989
}
987990
elsif ($mf =~/^PROGRAM\s*=\s*(.*)$/mg)
988991
{
989992
my$proj =$solution->AddProject($1,'exe','contrib',"$subdir/$n");
990993
AdjustContribProj($proj);
994+
push@projects,$proj;
991995
}
992996
else
993997
{
994998
croak"Could not determine contrib module type for$n\n";
995999
}
9961000

1001+
# Process custom compiler flags
1002+
if ($mf =~/^PG_CPPFLAGS\s*=\s*(.*)$/mg ||$mf =~/^override\s*CPPFLAGS\s*[+:]?=\s*(.*)$/mg)
1003+
{
1004+
foreachmy$flag (split /\s+/,$1)
1005+
{
1006+
if ($flag =~/^-D(.*)$/)
1007+
{
1008+
foreachmy$proj (@projects)
1009+
{
1010+
$proj->AddDefine($1);
1011+
}
1012+
}
1013+
}
1014+
}
1015+
9971016
# Are there any output data files to build?
9981017
GenerateContribSqlFiles($n,$mf);
9991018
return;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp