Hi, On 2021-10-12 15:55:22 -0400, John Naylor wrote: > Also, could utility makefile targets be made to work? I'm thinking in > particular of update-unicode and reformat-dat-files, for example.
Implementing reformat-dat-files was trivial: https://github.com/anarazel/postgres/commit/29c1ce1ad4731290714978da5ce81e99ef051bec However, update-unicode is a bit harder. Partially not directly because of meson, but because update-unicode as-is afaict doesn't support VPATH builds, and meson enforces those. make update-unicode ... make -C src/common/unicode update-unicode '/usr/bin/perl' generate-unicode_norm_table.pl Can't open perl script "generate-unicode_norm_table.pl": No such file or directory It's not too hard to fix. See attached for the minimal stuff that I immediately found to be needed. There's likely more, e.g. src/backend/utils/mb/Unicode - but I didn't immediately see where that's invoked from. The slightly bigger issue making update-unicode work with meson is that meson doesn't provide support for invoking build targets in specific directories (because it doesn't map nicely to e.g. msbuild). But scripts like src/common/unicode/generate-unicode_norm_table.pl rely on CWD. It's not hard to work around that, but IMO it's better for such scripts to not rely on CWD. Greetings, Andres Freund
diff --git i/src/common/unicode/Makefile w/src/common/unicode/Makefile index a3683dd86b9..e69054d4671 100644 --- i/src/common/unicode/Makefile +++ w/src/common/unicode/Makefile @@ -12,14 +12,14 @@ subdir = src/common/unicode top_builddir = ../../.. include $(top_builddir)/src/Makefile.global -override CPPFLAGS := -DFRONTEND $(CPPFLAGS) +override CPPFLAGS := -DFRONTEND -I$(abs_top_builddir)/src/common/unicode $(CPPFLAGS) LIBS += $(PTHREAD_LIBS) # By default, do nothing. all: update-unicode: unicode_norm_table.h unicode_combining_table.h unicode_east_asian_fw_table.h unicode_normprops_table.h unicode_norm_hashfunc.h - mv $^ ../../../src/include/common/ + mv $^ $(top_srcdir)/src/include/common/ $(MAKE) normalization-check # These files are part of the Unicode Character Database. Download @@ -33,7 +33,7 @@ UnicodeData.txt EastAsianWidth.txt DerivedNormalizationProps.txt CompositionExcl unicode_norm_hashfunc.h: unicode_norm_table.h unicode_norm_table.h: generate-unicode_norm_table.pl UnicodeData.txt CompositionExclusions.txt - $(PERL) generate-unicode_norm_table.pl + $(PERL) $^ unicode_combining_table.h: generate-unicode_combining_table.pl UnicodeData.txt $(PERL) $^ >$@ @@ -58,7 +58,7 @@ submake-common: $(MAKE) -C .. all norm_test_table.h: generate-norm_test_table.pl NormalizationTest.txt - perl generate-norm_test_table.pl NormalizationTest.txt $@ + perl $^ $@ .PHONY: normalization-check diff --git i/contrib/unaccent/Makefile w/contrib/unaccent/Makefile index b8307d1601e..d6c466e07ad 100644 --- i/contrib/unaccent/Makefile +++ w/contrib/unaccent/Makefile @@ -27,12 +27,12 @@ include $(top_builddir)/src/Makefile.global include $(top_srcdir)/contrib/contrib-global.mk endif -update-unicode: unaccent.rules +update-unicode: $(srcdir)/unaccent.rules # Allow running this even without --with-python PYTHON ?= python -unaccent.rules: generate_unaccent_rules.py ../../src/common/unicode/UnicodeData.txt Latin-ASCII.xml +$(srcdir)/unaccent.rules: generate_unaccent_rules.py ../../src/common/unicode/UnicodeData.txt Latin-ASCII.xml $(PYTHON) $< --unicode-data-file $(word 2,$^) --latin-ascii-file $(word 3,$^) >$@ # Only download it once; dependencies must match src/common/unicode/