Skip to content

Commit 3d18a20

Browse files
committed
meson: prereq: Add --outdir option to gen_node_support.pl
1 parent 8f1e441 commit 3d18a20

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

src/backend/nodes/gen_node_support.pl

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,19 @@
1919
use warnings;
2020

2121
use File::Basename;
22+
use Getopt::Long;
2223

2324
use FindBin;
2425
use lib "$FindBin::RealBin/../catalog";
2526

2627
use Catalog; # for RenameTempFile
2728

29+
my $output_path = '.';
30+
31+
GetOptions(
32+
'outdir:s' => \$output_path)
33+
or die "$0: wrong arguments";
34+
2835

2936
# Test whether first argument is element of the list in the second
3037
# argument
@@ -576,7 +583,7 @@ sub elem
576583
# nodetags.h
577584

578585
push @output_files, 'nodetags.h';
579-
open my $nt, '>', 'nodetags.h' . $tmpext or die $!;
586+
open my $nt, '>', "$output_path/nodetags.h$tmpext" or die "$output_path/nodetags.h$tmpext: $!";
580587

581588
printf $nt $header_comment, 'nodetags.h';
582589

@@ -620,13 +627,13 @@ sub elem
620627
# copyfuncs.c, equalfuncs.c
621628

622629
push @output_files, 'copyfuncs.funcs.c';
623-
open my $cff, '>', 'copyfuncs.funcs.c' . $tmpext or die $!;
630+
open my $cff, '>', "$output_path/copyfuncs.funcs.c$tmpext" or die $!;
624631
push @output_files, 'equalfuncs.funcs.c';
625-
open my $eff, '>', 'equalfuncs.funcs.c' . $tmpext or die $!;
632+
open my $eff, '>', "$output_path/equalfuncs.funcs.c$tmpext" or die $!;
626633
push @output_files, 'copyfuncs.switch.c';
627-
open my $cfs, '>', 'copyfuncs.switch.c' . $tmpext or die $!;
634+
open my $cfs, '>', "$output_path/copyfuncs.switch.c$tmpext" or die $!;
628635
push @output_files, 'equalfuncs.switch.c';
629-
open my $efs, '>', 'equalfuncs.switch.c' . $tmpext or die $!;
636+
open my $efs, '>', "$output_path/equalfuncs.switch.c$tmpext" or die $!;
630637

631638
printf $cff $header_comment, 'copyfuncs.funcs.c';
632639
printf $eff $header_comment, 'equalfuncs.funcs.c';
@@ -819,13 +826,13 @@ sub elem
819826
# outfuncs.c, readfuncs.c
820827

821828
push @output_files, 'outfuncs.funcs.c';
822-
open my $off, '>', 'outfuncs.funcs.c' . $tmpext or die $!;
829+
open my $off, '>', "$output_path/outfuncs.funcs.c$tmpext" or die $!;
823830
push @output_files, 'readfuncs.funcs.c';
824-
open my $rff, '>', 'readfuncs.funcs.c' . $tmpext or die $!;
831+
open my $rff, '>', "$output_path/readfuncs.funcs.c$tmpext" or die $!;
825832
push @output_files, 'outfuncs.switch.c';
826-
open my $ofs, '>', 'outfuncs.switch.c' . $tmpext or die $!;
833+
open my $ofs, '>', "$output_path/outfuncs.switch.c$tmpext" or die $!;
827834
push @output_files, 'readfuncs.switch.c';
828-
open my $rfs, '>', 'readfuncs.switch.c' . $tmpext or die $!;
835+
open my $rfs, '>', "$output_path/readfuncs.switch.c$tmpext" or die $!;
829836

830837
printf $off $header_comment, 'outfuncs.funcs.c';
831838
printf $rff $header_comment, 'readfuncs.funcs.c';
@@ -1130,7 +1137,7 @@ sub elem
11301137
# now rename the temporary files to their final names
11311138
foreach my $file (@output_files)
11321139
{
1133-
Catalog::RenameTempFile($file, $tmpext);
1140+
Catalog::RenameTempFile("$output_path/$file", $tmpext);
11341141
}
11351142

11361143

@@ -1144,7 +1151,7 @@ END
11441151
{
11451152
foreach my $file (@output_files)
11461153
{
1147-
unlink($file . $tmpext);
1154+
unlink("$output_path/$file$tmpext");
11481155
}
11491156
}
11501157

src/tools/msvc/Solution.pm

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -864,15 +864,12 @@ EOF
864864
utils/rel.h
865865
);
866866

867-
chdir('src/backend/nodes');
867+
my @node_files = map { "src/include/$_" } @node_headers;
868868

869-
my @node_files = map { "../../../src/include/$_" } @node_headers;
870-
871-
system("perl gen_node_support.pl @node_files");
872-
open(my $f, '>', 'node-support-stamp')
869+
system("perl src/backend/nodes/gen_node_support.pl --outdir src/backend/nodes @node_files");
870+
open(my $f, '>', 'src/backend/nodes/node-support-stamp')
873871
|| confess "Could not touch node-support-stamp";
874872
close($f);
875-
chdir('../../..');
876873
}
877874

878875
if (IsNewer(

0 commit comments

Comments
 (0)