Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9a4b29d

Browse files
committed
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.
1 parent 4fef90d commit 9a4b29d

File tree

3 files changed

+31
-22
lines changed

3 files changed

+31
-22
lines changed

contrib/dict_xsyn/Makefile

+2-20
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
# $PostgreSQL: pgsql/contrib/dict_xsyn/Makefile,v 1.1 2007/10/15 21:36:50 tgl Exp $
1+
# $PostgreSQL: pgsql/contrib/dict_xsyn/Makefile,v 1.2 2007/10/16 15:59:59 tgl Exp $
22

33
MODULE_big = dict_xsyn
44
OBJS = dict_xsyn.o
55
DATA_built = dict_xsyn.sql
66
DATA = uninstall_dict_xsyn.sql
7+
DATA_TSEARCH = xsyn_sample.rules
78
DOCS = README.dict_xsyn
89
REGRESS = dict_xsyn
910

10-
DICTDIR = tsearch_data
11-
DICTFILES = xsyn_sample.rules
12-
1311
ifdef USE_PGXS
1412
PG_CONFIG = pg_config
1513
PGXS := $(shell $(PG_CONFIG) --pgxs)
@@ -20,19 +18,3 @@ top_builddir = ../..
2018
include $(top_builddir)/src/Makefile.global
2119
include $(top_srcdir)/contrib/contrib-global.mk
2220
endif
23-
24-
install: install-data
25-
26-
.PHONY: install-data
27-
install-data: $(DICTFILES)
28-
for i in $(DICTFILES); \
29-
do $(INSTALL_DATA) $(srcdir)/$$i '$(DESTDIR)$(datadir)/$(DICTDIR)/'$$i; \
30-
done
31-
32-
uninstall: uninstall-data
33-
34-
.PHONY: uninstall-data
35-
uninstall-data:
36-
for i in $(DICTFILES); \
37-
do rm -rf '$(DESTDIR)$(datadir)/$(DICTDIR)/'$$i ; \
38-
done

src/makefiles/pgxs.mk

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PGXS: PostgreSQL extensions makefile
22

3-
# $PostgreSQL: pgsql/src/makefiles/pgxs.mk,v 1.10 2007/06/26 22:05:04 tgl Exp $
3+
# $PostgreSQL: pgsql/src/makefiles/pgxs.mk,v 1.11 2007/10/16 15:59:59 tgl Exp $
44

55
# This file contains generic rules to build many kinds of simple
66
# extension modules. You only need to set a few variables and include
@@ -22,6 +22,7 @@
2222
# DATA -- random files to install into $PREFIX/share/contrib
2323
# DATA_built -- random files to install into $PREFIX/share/contrib,
2424
# which need to be built first
25+
# DATA_TSEARCH -- random files to install into $PREFIX/share/tsearch_data
2526
# DOCS -- random files to install under $PREFIX/doc/contrib
2627
# SCRIPTS -- script files (not binaries) to install into $PREFIX/bin
2728
# SCRIPTS_built -- script files (not binaries) to install into $PREFIX/bin,
@@ -97,6 +98,12 @@ ifneq (,$(DATA)$(DATA_built))
9798
$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/contrib'; \
9899
done
99100
endif # DATA
101+
ifneq (,$(DATA_TSEARCH))
102+
@for file in $(addprefix $(srcdir)/, $(DATA_TSEARCH)); do \
103+
echo "$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/tsearch_data'"; \
104+
$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/tsearch_data'; \
105+
done
106+
endif # DATA_TSEARCH
100107
ifdef MODULES
101108
@for file in $(addsuffix $(DLSUFFIX), $(MODULES)); do \
102109
echo "$(INSTALL_SHLIB) $$file '$(DESTDIR)$(pkglibdir)'"; \
@@ -135,6 +142,9 @@ installdirs:
135142
ifneq (,$(DATA)$(DATA_built))
136143
$(mkinstalldirs) '$(DESTDIR)$(datadir)/contrib'
137144
endif
145+
ifneq (,$(DATA_TSEARCH))
146+
$(mkinstalldirs) '$(DESTDIR)$(datadir)/tsearch_data'
147+
endif
138148
ifneq (,$(MODULES)$(MODULE_big))
139149
$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
140150
endif
@@ -152,6 +162,9 @@ uninstall:
152162
ifneq (,$(DATA)$(DATA_built))
153163
rm -f $(addprefix '$(DESTDIR)$(datadir)'/contrib/, $(notdir $(DATA) $(DATA_built)))
154164
endif
165+
ifneq (,$(DATA_TSEARCH))
166+
rm -f $(addprefix '$(DESTDIR)$(datadir)'/tsearch_data/, $(notdir $(DATA_TSEARCH)))
167+
endif
155168
ifdef MODULES
156169
rm -f $(addprefix '$(DESTDIR)$(pkglibdir)'/, $(addsuffix $(DLSUFFIX), $(MODULES)))
157170
endif

src/tools/msvc/Install.pm

+15-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package Install;
33
#
44
# Package that provides 'make install' functionality for msvc builds
55
#
6-
# $PostgreSQL: pgsql/src/tools/msvc/Install.pm,v 1.23 2007/10/03 13:20:40 mha Exp $
6+
# $PostgreSQL: pgsql/src/tools/msvc/Install.pm,v 1.24 2007/10/16 16:00:00 tgl Exp $
77
#
88
use strict;
99
use warnings;
@@ -317,6 +317,20 @@ sub CopyContribFiles
317317
}
318318
}
319319

320+
$flist = '';
321+
if ($mf =~ /^DATA_TSEARCH\s*=\s*(.*)$/m) {$flist .= $1}
322+
if ($flist ne '')
323+
{
324+
$flist = ParseAndCleanRule($flist, $mf);
325+
326+
foreach my $f (split /\s+/,$flist)
327+
{
328+
lcopy('contrib/' . $d . '/' . $f,$target . '/share/tsearch_data/' . basename($f))
329+
|| croak("Could not copy file $f in contrib $d");
330+
print '.';
331+
}
332+
}
333+
320334
$flist = '';
321335
if ($mf =~ /^DOCS\s*=\s*(.*)$/mg) {$flist .= $1}
322336
if ($flist ne '')

0 commit comments

Comments
 (0)