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

Commitcbf9f0e

Browse files
committed
Fix MSVC builds for contrib transforms modules.
With this patch the MSVC build and installation will work correctly withthe transforms. However the python transform tests for hstore and ltreeare still disabled pending some further adjustments.Michael Paquier with some tweaks from me.
1 parentb69bf30 commitcbf9f0e

File tree

3 files changed

+211
-121
lines changed

3 files changed

+211
-121
lines changed

‎src/tools/msvc/Install.pm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,12 @@ sub CopyContribFiles
439439
while (my$d =readdir($D))
440440
{
441441
# These configuration-based exclusions must match vcregress.pl
442-
nextif ($deq"uuid-ossp" && !defined($config->{uuid}));
443-
nextif ($deq"sslinfo" && !defined($config->{openssl}));
444-
nextif ($deq"xml2" && !defined($config->{xml}));
442+
nextif ($deq"uuid-ossp" && !defined($config->{uuid}));
443+
nextif ($deq"sslinfo" && !defined($config->{openssl}));
444+
nextif ($deq"xml2" && !defined($config->{xml}));
445+
nextif ($deq"hstore_plperl" && !defined($config->{perl}));
446+
nextif ($deq"hstore_plpython" && !defined($config->{python}));
447+
nextif ($deq"ltree_plpython" && !defined($config->{python}));
445448
nextif ($deq"sepgsql");
446449

447450
CopySubdirFiles($subdir,$d,$config,$target);

‎src/tools/msvc/Mkvcbuild.pm

Lines changed: 199 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ my $contrib_extraincludes =
4646
my$contrib_extrasource = {
4747
'cube'=> ['contrib/cube/cubescan.l','contrib/cube/cubeparse.y' ],
4848
'seg'=> ['contrib/seg/segscan.l','contrib/seg/segparse.y' ], };
49-
my@contrib_excludes = ('pgcrypto','commit_ts','intagg','sepgsql');
49+
my@contrib_excludes = (
50+
'commit_ts','hstore_plperl',
51+
'hstore_plpython','intagg',
52+
'ltree_plpython','pgcrypto',
53+
'sepgsql');
5054

5155
# Set of variables for frontend modules
5256
my$frontend_defines = {'initdb'=>'FRONTEND' };
@@ -176,119 +180,6 @@ sub mkvcbuild
176180
$plpgsql->AddFiles('src/pl/plpgsql/src','pl_gram.y');
177181
$plpgsql->AddReference($postgres);
178182

179-
if ($solution->{options}->{perl})
180-
{
181-
my$plperlsrc ="src/pl/plperl/";
182-
my$plperl =
183-
$solution->AddProject('plperl','dll','PLs','src/pl/plperl');
184-
$plperl->AddIncludeDir($solution->{options}->{perl} .'/lib/CORE');
185-
$plperl->AddDefine('PLPERL_HAVE_UID_GID');
186-
foreachmy$xs ('SPI.xs','Util.xs')
187-
{
188-
(my$xsc =$xs) =~s/\.xs/.c/;
189-
if (Solution::IsNewer("$plperlsrc$xsc","$plperlsrc$xs"))
190-
{
191-
my$xsubppdir = first {-e"$_/ExtUtils/xsubpp" }@INC;
192-
print"Building$plperlsrc$xsc...\n";
193-
system($solution->{options}->{perl}
194-
.'/bin/perl'
195-
."$xsubppdir/ExtUtils/xsubpp -typemap"
196-
.$solution->{options}->{perl}
197-
.'/lib/ExtUtils/typemap'
198-
."$plperlsrc$xs"
199-
.">$plperlsrc$xsc");
200-
if ((!(-f"$plperlsrc$xsc")) ||-z"$plperlsrc$xsc")
201-
{
202-
unlink("$plperlsrc$xsc");# if zero size
203-
die"Failed to create$xsc.\n";
204-
}
205-
}
206-
}
207-
if (Solution::IsNewer(
208-
'src/pl/plperl/perlchunks.h',
209-
'src/pl/plperl/plc_perlboot.pl')
210-
|| Solution::IsNewer(
211-
'src/pl/plperl/perlchunks.h',
212-
'src/pl/plperl/plc_trusted.pl'))
213-
{
214-
print'Building src/pl/plperl/perlchunks.h ...' ."\n";
215-
my$basedir = getcwd;
216-
chdir'src/pl/plperl';
217-
system($solution->{options}->{perl}
218-
.'/bin/perl'
219-
.'text2macro.pl'
220-
.'--strip="^(\#.*|\s*)$$"'
221-
.'plc_perlboot.pl plc_trusted.pl'
222-
.'>perlchunks.h');
223-
chdir$basedir;
224-
if ((!(-f'src/pl/plperl/perlchunks.h'))
225-
||-z'src/pl/plperl/perlchunks.h')
226-
{
227-
unlink('src/pl/plperl/perlchunks.h');# if zero size
228-
die'Failed to create perlchunks.h' ."\n";
229-
}
230-
}
231-
if (Solution::IsNewer(
232-
'src/pl/plperl/plperl_opmask.h',
233-
'src/pl/plperl/plperl_opmask.pl'))
234-
{
235-
print'Building src/pl/plperl/plperl_opmask.h ...' ."\n";
236-
my$basedir = getcwd;
237-
chdir'src/pl/plperl';
238-
system($solution->{options}->{perl}
239-
.'/bin/perl'
240-
.'plperl_opmask.pl'
241-
.'plperl_opmask.h');
242-
chdir$basedir;
243-
if ((!(-f'src/pl/plperl/plperl_opmask.h'))
244-
||-z'src/pl/plperl/plperl_opmask.h')
245-
{
246-
unlink('src/pl/plperl/plperl_opmask.h');# if zero size
247-
die'Failed to create plperl_opmask.h' ."\n";
248-
}
249-
}
250-
$plperl->AddReference($postgres);
251-
my@perl_libs =
252-
grep {/perl\d+.lib$/ }
253-
glob($solution->{options}->{perl} .'\lib\CORE\perl*.lib');
254-
if (@perl_libs == 1)
255-
{
256-
$plperl->AddLibrary($perl_libs[0]);
257-
}
258-
else
259-
{
260-
die"could not identify perl library version";
261-
}
262-
}
263-
264-
if ($solution->{options}->{python})
265-
{
266-
267-
# Attempt to get python version and location.
268-
# Assume python.exe in specified dir.
269-
open(P,
270-
$solution->{options}->{python}
271-
."\\python -c\"import sys;print(sys.prefix);print(str(sys.version_info[0])+str(sys.version_info[1]))\" |"
272-
) ||die"Could not query for python version!\n";
273-
my$pyprefix = <P>;
274-
chomp($pyprefix);
275-
my$pyver = <P>;
276-
chomp($pyver);
277-
close(P);
278-
279-
# Sometimes (always?) if python is not present, the execution
280-
# appears to work, but gives no data...
281-
die"Failed to query python for version information\n"
282-
if (!(defined($pyprefix) &&defined($pyver)));
283-
284-
my$pymajorver =substr($pyver, 0, 1);
285-
my$plpython =$solution->AddProject('plpython' .$pymajorver,
286-
'dll','PLs','src/pl/plpython');
287-
$plpython->AddIncludeDir($pyprefix .'/include');
288-
$plpython->AddLibrary($pyprefix ."/Libs/python$pyver.lib");
289-
$plpython->AddReference($postgres);
290-
}
291-
292183
if ($solution->{options}->{tcl})
293184
{
294185
my$pltcl =
@@ -571,6 +462,138 @@ sub mkvcbuild
571462
closedir($D);
572463
}
573464

465+
# Build Perl and Python modules after contrib/ modules to satisfy some
466+
# dependencies with transform contrib modules, like hstore_plpython
467+
# ltree_plpython and hstore_plperl.
468+
if ($solution->{options}->{python})
469+
{
470+
# Attempt to get python version and location.
471+
# Assume python.exe in specified dir.
472+
my$pythonprog ="import sys;print(sys.prefix);" .
473+
"print(str(sys.version_info[0])+str(sys.version_info[1]))";
474+
my$prefixcmd =$solution->{options}->{python}
475+
."\\python -c\"$pythonprog\"";
476+
my$pyout =`$prefixcmd`;
477+
die"Could not query for python version!\n"if$?;
478+
my ($pyprefix,$pyver) =split(/\r?\n/,$pyout);
479+
480+
# Sometimes (always?) if python is not present, the execution
481+
# appears to work, but gives no data...
482+
die"Failed to query python for version information\n"
483+
if (!(defined($pyprefix) &&defined($pyver)));
484+
485+
my$pymajorver =substr($pyver, 0, 1);
486+
my$plpython =$solution->AddProject('plpython' .$pymajorver,
487+
'dll','PLs','src/pl/plpython');
488+
$plpython->AddIncludeDir($pyprefix .'/include');
489+
$plpython->AddLibrary($pyprefix ."/Libs/python$pyver.lib");
490+
$plpython->AddReference($postgres);
491+
492+
# Add transform modules dependent on plpython
493+
AddTransformModule('hstore_plpython' .$pymajorver,
494+
'contrib/hstore_plpython',
495+
'plpython' .$pymajorver,
496+
'src/pl/plpython','hstore',
497+
'contrib/hstore');
498+
AddTransformModule('ltree_plpython' .$pymajorver,
499+
'contrib/ltree_plpython',
500+
'plpython' .$pymajorver,
501+
'src/pl/plpython','ltree',
502+
'contrib/ltree');
503+
}
504+
505+
if ($solution->{options}->{perl})
506+
{
507+
my$plperlsrc ="src/pl/plperl/";
508+
my$plperl =
509+
$solution->AddProject('plperl','dll','PLs','src/pl/plperl');
510+
$plperl->AddIncludeDir($solution->{options}->{perl} .'/lib/CORE');
511+
$plperl->AddDefine('PLPERL_HAVE_UID_GID');
512+
foreachmy$xs ('SPI.xs','Util.xs')
513+
{
514+
(my$xsc =$xs) =~s/\.xs/.c/;
515+
if (Solution::IsNewer("$plperlsrc$xsc","$plperlsrc$xs"))
516+
{
517+
my$xsubppdir = first {-e"$_/ExtUtils/xsubpp" }@INC;
518+
print"Building$plperlsrc$xsc...\n";
519+
system($solution->{options}->{perl}
520+
.'/bin/perl'
521+
."$xsubppdir/ExtUtils/xsubpp -typemap"
522+
.$solution->{options}->{perl}
523+
.'/lib/ExtUtils/typemap'
524+
."$plperlsrc$xs"
525+
.">$plperlsrc$xsc");
526+
if ((!(-f"$plperlsrc$xsc")) ||-z"$plperlsrc$xsc")
527+
{
528+
unlink("$plperlsrc$xsc");# if zero size
529+
die"Failed to create$xsc.\n";
530+
}
531+
}
532+
}
533+
if (Solution::IsNewer(
534+
'src/pl/plperl/perlchunks.h',
535+
'src/pl/plperl/plc_perlboot.pl')
536+
|| Solution::IsNewer(
537+
'src/pl/plperl/perlchunks.h',
538+
'src/pl/plperl/plc_trusted.pl'))
539+
{
540+
print'Building src/pl/plperl/perlchunks.h ...' ."\n";
541+
my$basedir = getcwd;
542+
chdir'src/pl/plperl';
543+
system($solution->{options}->{perl}
544+
.'/bin/perl'
545+
.'text2macro.pl'
546+
.'--strip="^(\#.*|\s*)$$"'
547+
.'plc_perlboot.pl plc_trusted.pl'
548+
.'>perlchunks.h');
549+
chdir$basedir;
550+
if ((!(-f'src/pl/plperl/perlchunks.h'))
551+
||-z'src/pl/plperl/perlchunks.h')
552+
{
553+
unlink('src/pl/plperl/perlchunks.h');# if zero size
554+
die'Failed to create perlchunks.h' ."\n";
555+
}
556+
}
557+
if (Solution::IsNewer(
558+
'src/pl/plperl/plperl_opmask.h',
559+
'src/pl/plperl/plperl_opmask.pl'))
560+
{
561+
print'Building src/pl/plperl/plperl_opmask.h ...' ."\n";
562+
my$basedir = getcwd;
563+
chdir'src/pl/plperl';
564+
system($solution->{options}->{perl}
565+
.'/bin/perl'
566+
.'plperl_opmask.pl'
567+
.'plperl_opmask.h');
568+
chdir$basedir;
569+
if ((!(-f'src/pl/plperl/plperl_opmask.h'))
570+
||-z'src/pl/plperl/plperl_opmask.h')
571+
{
572+
unlink('src/pl/plperl/plperl_opmask.h');# if zero size
573+
die'Failed to create plperl_opmask.h' ."\n";
574+
}
575+
}
576+
$plperl->AddReference($postgres);
577+
my@perl_libs =
578+
grep {/perl\d+.lib$/ }
579+
glob($solution->{options}->{perl} .'\lib\CORE\perl*.lib');
580+
if (@perl_libs == 1)
581+
{
582+
$plperl->AddLibrary($perl_libs[0]);
583+
}
584+
else
585+
{
586+
die"could not identify perl library version";
587+
}
588+
589+
# Add transform module dependent on plperl
590+
my$hstore_plperl =
591+
AddTransformModule('hstore_plperl','contrib/hstore_plperl',
592+
'plperl','src/pl/plperl',
593+
'hstore','contrib/hstore');
594+
$hstore_plperl->AddDefine('PLPERL_HAVE_UID_GID');
595+
}
596+
574597
$mf =
575598
Project::read_file('src/backend/utils/mb/conversion_procs/Makefile');
576599
$mf =~s{\\\r?\n}{}g;
@@ -680,6 +703,68 @@ sub AddSimpleFrontend
680703
return$p;
681704
}
682705

706+
# Add a simple transform module
707+
subAddTransformModule
708+
{
709+
my$n =shift;
710+
my$n_src =shift;
711+
my$pl_proj_name =shift;
712+
my$pl_src =shift;
713+
my$transform_name =shift;
714+
my$transform_src =shift;
715+
716+
my$transform_proj =undef;
717+
foreachmy$proj (@{$solution->{projects}->{'contrib'} })
718+
{
719+
if ($proj->{name}eq$transform_name)
720+
{
721+
$transform_proj =$proj;
722+
last;
723+
}
724+
}
725+
die"could not find base module$transform_name for transform module$n"
726+
if (!defined($transform_proj));
727+
728+
my$pl_proj =undef;
729+
foreachmy$proj (@{$solution->{projects}->{'PLs'} })
730+
{
731+
if ($proj->{name}eq$pl_proj_name)
732+
{
733+
$pl_proj =$proj;
734+
last;
735+
}
736+
}
737+
die"could not find PL$pl_proj_name for transform module$n"
738+
if (!defined($pl_proj));
739+
740+
my$p =$solution->AddProject($n,'dll','contrib',$n_src);
741+
formy$file (glob("$n_src/*.c"))
742+
{
743+
$p->AddFile($file);
744+
}
745+
$p->AddReference($postgres);
746+
747+
# Add PL dependencies
748+
$p->AddIncludeDir($pl_src);
749+
$p->AddReference($pl_proj);
750+
$p->AddIncludeDir($pl_proj->{includes});
751+
foreachmy$pl_lib (@{$pl_proj->{libraries}})
752+
{
753+
$p->AddLibrary($pl_lib);
754+
}
755+
756+
# Add base module dependencies
757+
$p->AddIncludeDir($transform_src);
758+
$p->AddIncludeDir($transform_proj->{includes});
759+
foreachmy$trans_lib (@{$transform_proj->{libraries}})
760+
{
761+
$p->AddLibrary($trans_lib);
762+
}
763+
$p->AddReference($transform_proj);
764+
765+
return$p;
766+
}
767+
683768
# Add a simple contrib project
684769
subAddContrib
685770
{

‎src/tools/msvc/vcregress.pl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,12 @@ sub contribcheck
262262
foreachmy$module (glob("*"))
263263
{
264264
# these configuration-based exclusions must match Install.pm
265-
nextif ($moduleeq"uuid-ossp" && !defined($config->{uuid}));
266-
nextif ($moduleeq"sslinfo" && !defined($config->{openssl}));
267-
nextif ($moduleeq"xml2" && !defined($config->{xml}));
265+
nextif ($moduleeq"uuid-ossp" && !defined($config->{uuid}));
266+
nextif ($moduleeq"sslinfo" && !defined($config->{openssl}));
267+
nextif ($moduleeq"xml2" && !defined($config->{xml}));
268+
nextif ($moduleeq"hstore_plperl" && !defined($config->{perl}));
269+
nextif ($moduleeq"hstore_plpython");
270+
nextif ($moduleeq"ltree_plpython");
268271
nextif ($moduleeq"sepgsql");
269272

270273
subdircheck("$topdir/contrib",$module);
@@ -375,7 +378,6 @@ sub fetchRegressOpts
375378
$m =~s{\\\r?\n}{}g;
376379
if ($m =~/^\s*REGRESS_OPTS\s*=(.*)/m)
377380
{
378-
379381
# Substitute known Makefile variables, then ignore options that retain
380382
# an unhandled variable reference. Ignore anything that isn't an
381383
# option starting with "--".

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp