git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c8a9246)
Add output directory option to gen_node_support.pl
2022年7月18日 19:32:26 +0000 (12:32 -0700)
2022年7月18日 19:32:53 +0000 (12:32 -0700)
This is in preparation for building postgres with meson / ninja.

When building with meson, commands are run at the root of the build tree. Add
an option to put build output into the appropriate place. This can be utilized
by src/tools/msvc/ for a minor simplification, which also provides some
coverage for the new option.

Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com


diff --git a/src/backend/nodes/gen_node_support.pl b/src/backend/nodes/gen_node_support.pl
index 975e456ee2dfef63ed863f8ba2418d9ea5190db0..f3309c300015e1a6ac45ce78d4d8c4a724249a9a 100644 (file)
--- a/src/backend/nodes/gen_node_support.pl
+++ b/src/backend/nodes/gen_node_support.pl
@@ -19,12 +19,19 @@ use strict;
use warnings;
use File::Basename;
+use Getopt::Long;
use FindBin;
use lib "$FindBin::RealBin/../catalog";
use Catalog; # for RenameTempFile
+my $output_path = '.';
+
+GetOptions(
+ 'outdir:s' => \$output_path)
+ or die "0ドル: wrong arguments";
+
# Test whether first argument is element of the list in the second
# argument
@@ -576,7 +583,7 @@ my $header_comment =
# nodetags.h
push @output_files, 'nodetags.h';
-open my $nt, '>', 'nodetags.h' . $tmpext or die $!;
+open my $nt, '>', "$output_path/nodetags.h$tmpext" or die "$output_path/nodetags.h$tmpext: $!";
printf $nt $header_comment, 'nodetags.h';
@@ -620,13 +627,13 @@ foreach my $infile (sort @ARGV)
# copyfuncs.c, equalfuncs.c
push @output_files, 'copyfuncs.funcs.c';
-open my $cff, '>', 'copyfuncs.funcs.c' . $tmpext or die $!;
+open my $cff, '>', "$output_path/copyfuncs.funcs.c$tmpext" or die $!;
push @output_files, 'equalfuncs.funcs.c';
-open my $eff, '>', 'equalfuncs.funcs.c' . $tmpext or die $!;
+open my $eff, '>', "$output_path/equalfuncs.funcs.c$tmpext" or die $!;
push @output_files, 'copyfuncs.switch.c';
-open my $cfs, '>', 'copyfuncs.switch.c' . $tmpext or die $!;
+open my $cfs, '>', "$output_path/copyfuncs.switch.c$tmpext" or die $!;
push @output_files, 'equalfuncs.switch.c';
-open my $efs, '>', 'equalfuncs.switch.c' . $tmpext or die $!;
+open my $efs, '>', "$output_path/equalfuncs.switch.c$tmpext" or die $!;
printf $cff $header_comment, 'copyfuncs.funcs.c';
printf $eff $header_comment, 'equalfuncs.funcs.c';
@@ -819,13 +826,13 @@ close $efs;
# outfuncs.c, readfuncs.c
push @output_files, 'outfuncs.funcs.c';
-open my $off, '>', 'outfuncs.funcs.c' . $tmpext or die $!;
+open my $off, '>', "$output_path/outfuncs.funcs.c$tmpext" or die $!;
push @output_files, 'readfuncs.funcs.c';
-open my $rff, '>', 'readfuncs.funcs.c' . $tmpext or die $!;
+open my $rff, '>', "$output_path/readfuncs.funcs.c$tmpext" or die $!;
push @output_files, 'outfuncs.switch.c';
-open my $ofs, '>', 'outfuncs.switch.c' . $tmpext or die $!;
+open my $ofs, '>', "$output_path/outfuncs.switch.c$tmpext" or die $!;
push @output_files, 'readfuncs.switch.c';
-open my $rfs, '>', 'readfuncs.switch.c' . $tmpext or die $!;
+open my $rfs, '>', "$output_path/readfuncs.switch.c$tmpext" or die $!;
printf $off $header_comment, 'outfuncs.funcs.c';
printf $rff $header_comment, 'readfuncs.funcs.c';
@@ -1130,7 +1137,7 @@ close $rfs;
# now rename the temporary files to their final names
foreach my $file (@output_files)
{
- Catalog::RenameTempFile($file, $tmpext);
+ Catalog::RenameTempFile("$output_path/$file", $tmpext);
}
@@ -1144,7 +1151,7 @@ END
{
foreach my $file (@output_files)
{
- unlink($file . $tmpext);
+ unlink("$output_path/$file$tmpext");
}
}
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index a66b04c242df6f6eff208d52146cf11d7b25361e..1e125aef942cd40dfebe50d2d3c38ff1dab68443 100644 (file)
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -865,15 +865,12 @@ EOF
utils/rel.h
);
- chdir('src/backend/nodes');
+ my @node_files = map { "src/include/$_" } @node_headers;
- my @node_files = map { "../../../src/include/$_" } @node_headers;
-
- system("perl gen_node_support.pl @node_files");
- open(my $f, '>', 'node-support-stamp')
+ system("perl src/backend/nodes/gen_node_support.pl --outdir src/backend/nodes @node_files");
+ open(my $f, '>', 'src/backend/nodes/node-support-stamp')
|| confess "Could not touch node-support-stamp";
close($f);
- chdir('../../..');
}
if (IsNewer(
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /