summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorAndres Freund2022-07-18 19:11:34 +0000
committerAndres Freund2022-07-18 19:24:27 +0000
commitb3a0d8324cf1f02c04a7099a436cfd68cfbf4566 (patch)
tree9104fe6176100e2e300bfb86f1657b73ac1dc7dd /src/tools
parentdb0a272d123b8d7f4d4acbeb54f27682a566be83 (diff)
Move snowball_create.sql creation into perl file
This is in preparation for building postgres with meson / ninja. We already have duplicated code for this between the make and msvc builds. Adding a third copy seems like a bad plan, thus move the generation into a perl script. As we don't want to rely on perl being available for builds from tarballs, generate the file during distprep. Author: Peter Eisentraut <peter@eisentraut.org> Author: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/msvc/Install.pm36
1 files changed, 3 insertions, 33 deletions
diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm
index 8de79c618cb..5da299476eb 100644
--- a/src/tools/msvc/Install.pm
+++ b/src/tools/msvc/Install.pm
@@ -389,39 +389,9 @@ sub GenerateTsearchFiles
my $target = shift;
print "Generating tsearch script...";
- my $F;
- my $tmpl = read_file('src/backend/snowball/snowball.sql.in');
- my $mf = read_file('src/backend/snowball/Makefile');
- $mf =~ s{\\\r?\n}{}g;
- $mf =~ /^LANGUAGES\s*=\s*(.*)$/m
- || die "Could not find LANGUAGES line in snowball Makefile\n";
- my @pieces = split /\s+/, $1;
- open($F, '>', "$target/share/snowball_create.sql")
- || die "Could not write snowball_create.sql";
- print $F read_file('src/backend/snowball/snowball_func.sql.in');
-
- while ($#pieces > 0)
- {
- my $lang = shift @pieces || last;
- my $asclang = shift @pieces || last;
- my $txt = $tmpl;
- my $stop = '';
-
- if (-s "src/backend/snowball/stopwords/$lang.stop")
- {
- $stop = ", StopWords=$lang";
- }
-
- $txt =~ s#_LANGNAME_#${lang}#gs;
- $txt =~ s#_DICTNAME_#${lang}_stem#gs;
- $txt =~ s#_CFGNAME_#${lang}#gs;
- $txt =~ s#_ASCDICTNAME_#${asclang}_stem#gs;
- $txt =~ s#_NONASCDICTNAME_#${lang}_stem#gs;
- $txt =~ s#_STOPWORDS_#$stop#gs;
- print $F $txt;
- print ".";
- }
- close($F);
+ system('perl', 'src/backend/snowball/snowball_create.pl',
+ '--input', 'src/backend/snowball/',
+ '--outdir', "$target/share/");
print "\n";
return;
}