Update Makefile for extension only
authorCΓ©dric Villemain <cedric@2ndquadrant.fr>
Thu, 8 Aug 2013 17:11:01 +0000 (19:11 +0200)
committerCΓ©dric Villemain <cedric@2ndquadrant.fr>
Thu, 8 Aug 2013 17:11:01 +0000 (19:11 +0200)
Thus this work only for postgresql >= 9.1

Makefile
debian/pgversions
pgfincore.unpackaged.sql [new file with mode: 0644]
uninstall_pgfincore.sql [deleted file]

index ca387c58a404e9ef32e522e673aa0a6c4ae88741..75b53dd01d8255e692317be341fb0fd992e2d768 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,57 +3,34 @@ EXTVERSION   = 1.1.1
 EXTCOMMENT   = examine and manage the os buffer cache
 
 MODULES      = $(EXTENSION)
-MODULE_DIR   = $(EXTENSION)
+MODULEDIR    = $(EXTENSION)
 DOCS         = README.rst
+DATA_built   = $(EXTENSION)--$(EXTVERSION).sql $(EXTENSION)--unpackaged--$(EXTVERSION).sql
+REGRESS      = $(EXTENSION).ext
+EXTRA_CLEAN  = $(EXTENSION).control
 
 PG_CONFIG    = pg_config
-BUILD_EXTENSION = $(shell $(PG_CONFIG) --version | grep -qE "8\.|9\.0" && echo no || echo yes)
 
-# Default (no Extension support)
-DATA         = $(EXTENSION).sql uninstall_$(EXTENSION).sql
-REGRESS      = $(EXTENSION)
-pgext_files   := $(DOCS) $(DATA)
+PGXS := $(shell $(PG_CONFIG) --pgxs)
+include $(PGXS)
 
-# we need to build with Extension support:
-ifeq ($(BUILD_EXTENSION),yes)
-all: $(EXTENSION)--$(EXTVERSION).sql $(EXTENSION)--unpackaged--$(EXTVERSION).sql
+# pgxs is included after variable definition and before targets, so the
+# PostgreSQL default target is used (all:)
+
+# build the extension--unpackaged--version.sql from extension.unpackaged.sql
+# this assumes that the extension was installed via sql script instead of
+# CREATE EXTENSION.
+# This won't upgrade from a previous version to the current one.
+$(EXTENSION)--unpackaged--$(EXTVERSION).sql: $(EXTENSION).unpackaged.sql
+       cp $< $@
 
 # this copy the extension.sql to extension--version.sql
 $(EXTENSION)--$(EXTVERSION).sql: $(EXTENSION).sql
-                       cp $< $@
-
-# this build the extension--unpackaged--version.sql from uninstall_extension.sql
-$(EXTENSION)--unpackaged--$(EXTVERSION).sql: uninstall_$(EXTENSION).sql
-                       sed 's/DROP /ALTER EXTENSION $(EXTENSION) ADD /' $< > $@
+       cp $< $@
 
 # this build extension.control from extension.control.in
 $(EXTENSION).control: $(EXTENSION).control.in
-                       sed 's/EXTVERSION/$(EXTVERSION)/;s/EXTENSION/$(EXTENSION)/;s/EXTCOMMENT/$(EXTCOMMENT)/' $< > $@
-
-DATA        = $(EXTENSION)--unpackaged--$(EXTVERSION).sql $(EXTENSION)--$(EXTVERSION).sql
-REGRESS     = $(EXTENSION).ext
-EXTRA_CLEAN = $(DATA) $(EXTENSION).control
-pgext_files  := $(DOCS)
-endif
-
-# Workaround for lack of good VPATH support in pgxs for extension/contrib
-ifdef VPATH
-pgext_files_build:= $(addprefix $(CURDIR)/, $(pgext_files))
-pgext_reg_files  := $(addprefix $(CURDIR)/sql/, $(notdir $(wildcard $(VPATH)/sql/*.sql)))
-pgext_reg_exp    := $(addprefix $(CURDIR)/expected/, $(notdir $(wildcard $(VPATH)/expected/*.out)))
-all: $(pgext_files_build) $(pgext_reg_files) $(pgext_reg_exp)
-$(pgext_files_build): $(CURDIR)/%: $(VPATH)/%
-       cp $< $@
-$(pgext_reg_files): $(CURDIR)/sql/%: $(VPATH)/sql/%
-       mkdir -p $(dir $(pgext_reg_files))
-       cp $< $@
-$(pgext_reg_exp): $(CURDIR)/expected/%: $(VPATH)/expected/%
-       mkdir -p $(dir $(pgext_reg_exp))
-       cp $< $@
-endif # VPATH
-
-PGXS := $(shell $(PG_CONFIG) --pgxs)
-include $(PGXS)
+       sed 's/EXTVERSION/$(EXTVERSION)/;s/EXTENSION/$(EXTENSION)/;s/EXTCOMMENT/$(EXTCOMMENT)/' $< > $@
 
 pgfoundry:
        git archive --prefix=$(EXTENSION)-$(EXTVERSION)/ -o $(EXTENSION)-v$(EXTVERSION).tar.gz HEAD
index bfd30e3b8ff9ddc77e12f49e3e0a581bb8fb6876..961d53c09698bc0970f4c3965d50b88534ad3e5c 100644 (file)
@@ -1,5 +1,3 @@
-8.3
-8.4
-9.0
 9.1
 9.2
+9.3
diff --git a/pgfincore.unpackaged.sql b/pgfincore.unpackaged.sql
new file mode 100644 (file)
index 0000000..f160f60
--- /dev/null
@@ -0,0 +1,16 @@
+ALTER EXTENSION pgfincore ADD FUNCTION pgsysconf();
+ALTER EXTENSION pgfincore ADD FUNCTION pgsysconf_pretty();
+
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise(regclass, text, int);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise_willneed(regclass);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise_dontneed(regclass);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise_normal(regclass);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise_sequential(regclass);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise_random(regclass);
+
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise_loader(regclass, text, int, bool, bool, varbit);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfadvise_loader(regclass, int, bool, bool, varbit);
+
+ALTER EXTENSION pgfincore ADD FUNCTION pgfincore(regclass, text, bool);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfincore(regclass, bool);
+ALTER EXTENSION pgfincore ADD FUNCTION pgfincore(regclass);
diff --git a/uninstall_pgfincore.sql b/uninstall_pgfincore.sql
deleted file mode 100644 (file)
index 99c627b..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-
-DROP FUNCTION pgsysconf_pretty();
-DROP FUNCTION pgsysconf();
-
-DROP FUNCTION pgfadvise_willneed(regclass);
-DROP FUNCTION pgfadvise_dontneed(regclass);
-DROP FUNCTION pgfadvise_normal(regclass);
-DROP FUNCTION pgfadvise_sequential(regclass);
-DROP FUNCTION pgfadvise_random(regclass);
-DROP FUNCTION pgfadvise(regclass, text, int);
-
-DROP FUNCTION pgfadvise_loader(regclass, text, int, bool, bool, varbit);
-DROP FUNCTION pgfadvise_loader(regclass, int, bool, bool, varbit);
-
-DROP FUNCTION pgfincore(regclass);
-DROP FUNCTION pgfincore(regclass, bool);
-DROP FUNCTION pgfincore(regclass, text, bool);
-