Makefile experiments again, VPATH works !
authorCΓ©dric Villemain <cedric@2ndquadrant.fr>
Fri, 2 Dec 2011 13:37:34 +0000 (14:37 +0100)
committerCΓ©dric Villemain <cedric@2ndquadrant.fr>
Fri, 2 Dec 2011 13:37:34 +0000 (14:37 +0100)
PostgreSQL does not support make VPATH for extension properly, so I copy all
requested files to builddir (if they don't exist).

I also make extension.control generated by extension.control.in and Makefile
variables and extension--unpackaged--version.sql now built from
uninstall_extension.sql

some updates to .gitignore and Changelog. Next commti should be the version
bump and release for 1.1.1 (bugfix)

16 files changed:
.gitignore
ChangeLog
Makefile
debian/postgresql-8.4-pgfincore.dirs [deleted file]
debian/postgresql-8.4-pgfincore.docs [deleted file]
debian/postgresql-8.4-pgfincore.install [deleted file]
debian/postgresql-9.0-pgfincore.dirs [deleted file]
debian/postgresql-9.0-pgfincore.docs [deleted file]
debian/postgresql-9.0-pgfincore.install [deleted file]
debian/postgresql-9.1-pgfincore.dirs [deleted file]
debian/postgresql-9.1-pgfincore.docs [deleted file]
debian/postgresql-9.1-pgfincore.install [deleted file]
debian/rules
pgfincore--unpackaged--1.1.sql [deleted file]
pgfincore.control [deleted file]
pgfincore.control.in [new file with mode: 0644]

index dd17d6a729edf8b65a8038299c0acb8c90180e72..fc3e2f21bc2a6ab76f329f170952df490b42f2f8 100644 (file)
@@ -3,3 +3,6 @@ debian/control
 debian/files
 debian/pgfincore-*
 debian/postgresql-*
+results/
+*.so
+pgfincore*.tar.gz
index 512ad2abd107bd85b2e1a094e10b327c7946a043..eadab3f75118e19dc4952642a5673a24e9ce07ef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+09//2011 CΓ©dric Villemain <cedric@2ndQuadrant.fr>
+  * 1.1.1 - Fix Makefile again, as well as debian scripts (VPATH)
+                 - Add checks (make installcheck)
+                 - Improve .gitignore
+
 09/07/2011 CΓ©dric Villemain <cedric@2ndQuadrant.fr>
   * 1.1.0 - Fix Makefile and remove the dir sql/ (useless and error prone)
                  - Fix the printf of int64 by casting to long long int (i386 and
index bc75ed88980223ffc3f2a6616de13ac311df36a5..6326d8969187c55e88fc9dce4065d3e55d0b23f1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,48 @@
 EXTENSION    = pgfincore
 EXTVERSION   = 1.1
+EXTCOMMENT   = examine and manage the os buffer cache
 
 MODULES      = $(EXTENSION)
-DATA         = $(EXTENSION).sql uninstall_$(EXTENSION).sql
 DOCS         = README.rst
-REGRESS      = $(EXTENSION)
 
 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)
+pgf_files   := $(DOCS) $(DATA)
+
+# we need to build with Extension support:
 ifeq ($(BUILD_EXTENSION),yes)
-all: $(EXTENSION)--$(EXTVERSION).sql
+all: $(EXTENSION)--$(EXTVERSION).sql $(EXTENSION)--unpackaged--$(EXTVERSION).sql
 
+# this copy the extension.sql to extension--version.sql
 $(EXTENSION)--$(EXTVERSION).sql: $(EXTENSION).sql
-       cp $< $@
+                       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 /' $< > $@
+
+# 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 = $(EXTENSION)--$(EXTVERSION).sql
+EXTRA_CLEAN = $(DATA) $(EXTENSION).control
+pgf_files  := $(DOCS)
 endif
 
+# Workaround for lack of good VPATH support in pgxs for extension/contrib
+ifdef VPATH
+pgf_files_build:= $(addprefix $(CURDIR)/, $(pgf_files))
+all: $(pgf_files_build)
+$(pgf_files_build): $(CURDIR)/%: $(VPATH)/%
+       cp $< $@
+endif # VPATH
+
 PGXS := $(shell $(PG_CONFIG) --pgxs)
 include $(PGXS)
 
diff --git a/debian/postgresql-8.4-pgfincore.dirs b/debian/postgresql-8.4-pgfincore.dirs
deleted file mode 100644 (file)
index 8b6e244..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-usr/lib/postgresql/8.4/lib
-usr/share/postgresql/8.4/contrib
diff --git a/debian/postgresql-8.4-pgfincore.docs b/debian/postgresql-8.4-pgfincore.docs
deleted file mode 100644 (file)
index a1320b1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-README.rst
diff --git a/debian/postgresql-8.4-pgfincore.install b/debian/postgresql-8.4-pgfincore.install
deleted file mode 100644 (file)
index b9788b8..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-debian/pgfincore-8.4/pgfincore.so usr/lib/postgresql/8.4/lib
-pgfincore.sql usr/share/postgresql/8.4/contrib
-uninstall_pgfincore.sql usr/share/postgresql/8.4/contrib
diff --git a/debian/postgresql-9.0-pgfincore.dirs b/debian/postgresql-9.0-pgfincore.dirs
deleted file mode 100644 (file)
index b383444..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-usr/lib/postgresql/9.0/lib
-usr/share/postgresql/9.0/contrib
diff --git a/debian/postgresql-9.0-pgfincore.docs b/debian/postgresql-9.0-pgfincore.docs
deleted file mode 100644 (file)
index a1320b1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-README.rst
diff --git a/debian/postgresql-9.0-pgfincore.install b/debian/postgresql-9.0-pgfincore.install
deleted file mode 100644 (file)
index fa2acbd..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-debian/pgfincore-9.0/pgfincore.so usr/lib/postgresql/9.0/lib
-pgfincore.sql usr/share/postgresql/9.0/contrib
-uninstall_pgfincore.sql usr/share/postgresql/9.0/contrib
diff --git a/debian/postgresql-9.1-pgfincore.dirs b/debian/postgresql-9.1-pgfincore.dirs
deleted file mode 100644 (file)
index e96fc14..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-usr/lib/postgresql/9.1/lib
-usr/share/postgresql/9.1/extension
diff --git a/debian/postgresql-9.1-pgfincore.docs b/debian/postgresql-9.1-pgfincore.docs
deleted file mode 100644 (file)
index a1320b1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-README.rst
diff --git a/debian/postgresql-9.1-pgfincore.install b/debian/postgresql-9.1-pgfincore.install
deleted file mode 100644 (file)
index 3e2e7c2..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-debian/pgfincore-9.1/pgfincore.so usr/lib/postgresql/9.1/lib
-debian/pgfincore-9.1/pgfincore*.sql usr/share/postgresql/9.1/extension
-pgfincore--unpackaged--1.1.sql usr/share/postgresql/9.1/extension
-pgfincore.control usr/share/postgresql/9.1/extension
index 1bfea2f70ef0d7a6b050513ae854db4201429870..c419de791baf72ec5903ed49b56f0aeaec9c88f9 100755 (executable)
@@ -35,10 +35,7 @@ override_dh_auto_build:
 
 override_dh_auto_install: 
        # then install each of them
-       for v in `pg_buildext supported-versions $(SRCDIR)`; do \
-               ls;\
-               dh_install -ppostgresql-$$v-$(EXTNAME) ;\
-       done
+       +pg_buildext install $(SRCDIR) $(TARGET) postgresql-%v-$(EXTNAME)
 
 orig: clean
        cd .. && tar czf $(EXTNAME)_$(PKGVERS).orig.tar.gz $(EXCLUDE) $(EXTNAME)
diff --git a/pgfincore--unpackaged--1.1.sql b/pgfincore--unpackaged--1.1.sql
deleted file mode 100644 (file)
index afd1f62..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-
-ALTER EXTENSION pgfincore ADD  FUNCTION pgsysconf_pretty();
-ALTER EXTENSION pgfincore ADD  FUNCTION pgsysconf();
-
-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(regclass, text, int);
-
-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);
-ALTER EXTENSION pgfincore ADD  FUNCTION pgfincore(regclass, bool);
-ALTER EXTENSION pgfincore ADD  FUNCTION pgfincore(regclass, text, bool);
-
diff --git a/pgfincore.control b/pgfincore.control
deleted file mode 100644 (file)
index 31a3403..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# pgfincore extension
-comment = 'examine and manage the os buffer cache'
-default_version = '1.1'
-module_pathname = '$libdir/pgfincore'
-relocatable = true
diff --git a/pgfincore.control.in b/pgfincore.control.in
new file mode 100644 (file)
index 0000000..8fc385c
--- /dev/null
@@ -0,0 +1,5 @@
+# EXTENSION extension
+comment = 'EXTCOMMENT'
+default_version = 'EXTVERSION'
+module_pathname = '$libdir/EXTENSION'
+relocatable = true