From b3a0d8324cf1f02c04a7099a436cfd68cfbf4566 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Mon, 18 Jul 2022 12:11:34 -0700 Subject: 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 Author: Andres Freund Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com --- src/tools/msvc/Install.pm | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'src/tools') 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; } -- cgit v1.2.3