]> granicus.if.org Git - postgresql/commitdiff
Teach pgxs.mk and Install.pm how to install files from a contrib module
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 16 Oct 2007 16:00:00 +0000 (16:00 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 16 Oct 2007 16:00:00 +0000 (16:00 +0000)
into SHAREDIR/tsearch_data.  Use this instead of ad-hoc coding in
dict_xsyn/Makefile.  Should fix current ContribCheck failures on MSVC.

contrib/dict_xsyn/Makefile
src/makefiles/pgxs.mk
src/tools/msvc/Install.pm

index 563f039e468e3842c2d0b98daa8e327765ff3397..dd47e85b9f87ece4e3e893c9b478366308800ceb 100644 (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
index 7b5683f6211400ac323f01c1f8eaf7b23467f239..67eef5dd7147d99d45cf7214d6b58a112009fc2e 100644 (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
index 7a9acb244296c3e93066e2c1aeeb6662c8f8847e..57815a2dc878c662d5cf9ab3a83025af6ec72717 100644 (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 '')