Teach pgxs.mk and Install.pm how to install files from a contrib module

into SHAREDIR/tsearch_data.  Use this instead of ad-hoc coding in
dict_xsyn/Makefile.  Should fix current ContribCheck failures on MSVC.
This commit is contained in:
Tom Lane 2007-10-16 16:00:00 +00:00
parent 4fef90dfed
commit 9a4b29d832
3 changed files with 31 additions and 22 deletions

View File

@ -1,15 +1,13 @@
# $PostgreSQL: pgsql/contrib/dict_xsyn/Makefile,v 1.1 2007/10/15 21:36:50 tgl Exp $
# $PostgreSQL: pgsql/contrib/dict_xsyn/Makefile,v 1.2 2007/10/16 15:59:59 tgl Exp $
MODULE_big = dict_xsyn
OBJS = dict_xsyn.o
DATA_built = dict_xsyn.sql
DATA = uninstall_dict_xsyn.sql
DATA_TSEARCH = xsyn_sample.rules
DOCS = README.dict_xsyn
REGRESS = dict_xsyn
DICTDIR = tsearch_data
DICTFILES = xsyn_sample.rules
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
@ -20,19 +18,3 @@ top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
install: install-data
.PHONY: install-data
install-data: $(DICTFILES)
for i in $(DICTFILES); \
do $(INSTALL_DATA) $(srcdir)/$$i '$(DESTDIR)$(datadir)/$(DICTDIR)/'$$i; \
done
uninstall: uninstall-data
.PHONY: uninstall-data
uninstall-data:
for i in $(DICTFILES); \
do rm -rf '$(DESTDIR)$(datadir)/$(DICTDIR)/'$$i ; \
done

View File

@ -1,6 +1,6 @@
# PGXS: PostgreSQL extensions makefile
# $PostgreSQL: pgsql/src/makefiles/pgxs.mk,v 1.10 2007/06/26 22:05:04 tgl Exp $
# $PostgreSQL: pgsql/src/makefiles/pgxs.mk,v 1.11 2007/10/16 15:59:59 tgl Exp $
# This file contains generic rules to build many kinds of simple
# extension modules. You only need to set a few variables and include
@ -22,6 +22,7 @@
# DATA -- random files to install into $PREFIX/share/contrib
# DATA_built -- random files to install into $PREFIX/share/contrib,
# which need to be built first
# DATA_TSEARCH -- random files to install into $PREFIX/share/tsearch_data
# DOCS -- random files to install under $PREFIX/doc/contrib
# SCRIPTS -- script files (not binaries) to install into $PREFIX/bin
# SCRIPTS_built -- script files (not binaries) to install into $PREFIX/bin,
@ -97,6 +98,12 @@ ifneq (,$(DATA)$(DATA_built))
$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/contrib'; \
done
endif # DATA
ifneq (,$(DATA_TSEARCH))
@for file in $(addprefix $(srcdir)/, $(DATA_TSEARCH)); do \
echo "$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/tsearch_data'"; \
$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/tsearch_data'; \
done
endif # DATA_TSEARCH
ifdef MODULES
@for file in $(addsuffix $(DLSUFFIX), $(MODULES)); do \
echo "$(INSTALL_SHLIB) $$file '$(DESTDIR)$(pkglibdir)'"; \
@ -135,6 +142,9 @@ installdirs:
ifneq (,$(DATA)$(DATA_built))
$(mkinstalldirs) '$(DESTDIR)$(datadir)/contrib'
endif
ifneq (,$(DATA_TSEARCH))
$(mkinstalldirs) '$(DESTDIR)$(datadir)/tsearch_data'
endif
ifneq (,$(MODULES)$(MODULE_big))
$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
endif
@ -152,6 +162,9 @@ uninstall:
ifneq (,$(DATA)$(DATA_built))
rm -f $(addprefix '$(DESTDIR)$(datadir)'/contrib/, $(notdir $(DATA) $(DATA_built)))
endif
ifneq (,$(DATA_TSEARCH))
rm -f $(addprefix '$(DESTDIR)$(datadir)'/tsearch_data/, $(notdir $(DATA_TSEARCH)))
endif
ifdef MODULES
rm -f $(addprefix '$(DESTDIR)$(pkglibdir)'/, $(addsuffix $(DLSUFFIX), $(MODULES)))
endif

View File

@ -3,7 +3,7 @@ package Install;
#
# Package that provides 'make install' functionality for msvc builds
#
# $PostgreSQL: pgsql/src/tools/msvc/Install.pm,v 1.23 2007/10/03 13:20:40 mha Exp $
# $PostgreSQL: pgsql/src/tools/msvc/Install.pm,v 1.24 2007/10/16 16:00:00 tgl Exp $
#
use strict;
use warnings;
@ -317,6 +317,20 @@ sub CopyContribFiles
}
}
$flist = '';
if ($mf =~ /^DATA_TSEARCH\s*=\s*(.*)$/m) {$flist .= $1}
if ($flist ne '')
{
$flist = ParseAndCleanRule($flist, $mf);
foreach my $f (split /\s+/,$flist)
{
lcopy('contrib/' . $d . '/' . $f,$target . '/share/tsearch_data/' . basename($f))
|| croak("Could not copy file $f in contrib $d");
print '.';
}
}
$flist = '';
if ($mf =~ /^DOCS\s*=\s*(.*)$/mg) {$flist .= $1}
if ($flist ne '')