The following commit has been merged in the master branch:
commit e8dd40baa2e9380aa37e05b01d7fb23b6dbaa670
Author: Markus Wanner <mar...@bluegap.ch>
Date:   Wed Jun 12 20:47:49 2013 +0200

    Land the changes from the pgdg branch, allowing the postgis extension
    to be built against multiple Postgres versions.
    
    Add 'debian/control' as a dependency of the 'clean' target so we are
    sure it's up to date.

diff --git a/debian/changelog b/debian/changelog
index 3c48562..24e39c5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,8 +11,9 @@ postgis (2.0.3-1) unstable; urgency=low
     liblwgeom/lwout_wkt.c.
   * Ignore changes of some auto-updated files (via source/options). Let
     debian/rules cleanup some more generated files.
-  * rules: swap dh_makeshlibs and dh_installdeb, build in the appropriate
-    build targets, let install only install pre-built stuff.
+  * rules: use a separate build directory per Postgres version, swap
+    dh_makeshlibs and dh_installdeb, build in the appropriate build targets,
+    let install only install pre-built stuff.
   * Compile the postgis jdbc java library again, using maven directly. Add
     required Build-Depends-Indeps.
   * Separate large SQL scripts and perl utils. Put them in their own
diff --git a/debian/pgversions b/debian/pgversions
index 1d15182..6d3dbe3 100644
--- a/debian/pgversions
+++ b/debian/pgversions
@@ -1,3 +1,6 @@
 # Note that postgis-2.0 is not recommended for 8.4 and 9.0, works fine
 # with 9.1 and 9.2, but doesn't work with 9.3, yet.
+8.4
+9.0
 9.1
+9.2
diff --git a/debian/rules b/debian/rules
index 135f653..65d39c0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -53,19 +53,40 @@ ifeq ($(POSTGIS_VERSION),..)
 $(error Cannot detect Postgis version, fix debian/rules)
 endif
 
-# For plain Debian, we support only exactly one version at a time.
+# For the Postgres APT repository, we want to support multiple
+# Postgres versions. However, docs and the JDBC jar only need to be
+# built once - in the main directory.
 NEWEST_POSTGRES_VERSION = $(shell pg_buildext supported-versions 
$(CURDIR)|tail -1)
 ifeq ($(NEWEST_POSTGRES_VERSION),)
 $(error Cannot detect Postgres version, check debian/pgversions and 
pg_buildext)
 endif
 
+OTHER_POSTGRES_VERSIONS = $(shell pg_buildext supported-versions $(CURDIR)\
+       | grep -v "$(NEWEST_POSTGRES_VERSION)")
+
+COMMON_CONFIGURE_ARGS = --host=$(DEB_HOST_GNU_TYPE) \
+       --build=$(DEB_BUILD_GNU_TYPE) \
+       --prefix=/usr \
+       --exec-prefix=\$${prefix} \
+       --docdir=\$${prefix}/share/doc \
+       --mandir=\$${prefix}/share/man \
+       --infodir=\$${prefix}/share/info \
+       --with-gui
+
 build: build-arch build-indep
 
 build-arch: build-arch-stamp
 build-arch-stamp: configuration-stamp
+#      Build against the newest Postgres version
        $(MAKE)
        $(MAKE) -C doc
 
+#      Build against all other Postgres versions
+       (set -e; \
+       for PGVER in $(OTHER_POSTGRES_VERSIONS); do \
+               $(MAKE) -C $(CURDIR)/debian/build-$$PGVER; \
+       done)
+
        touch $@
 
 build-indep: build-indep-stamp
@@ -91,28 +112,48 @@ build-indep-stamp: configuration-stamp
 configuration: configuration-stamp
 configuration-stamp:
        dh_testdir
-       dh_prep -s 
+       dh_prep -s
+
+#      Copy sources required to build extensions for all but the most
+#      recent Postgres version. Unfortunately, Postgis doesn't support
+#      vpath builds.
+       (set -e; \
+       for PGVER in $(OTHER_POSTGRES_VERSIONS); do \
+               mkdir $(CURDIR)/debian/build-$$PGVER; \
+               for FILE in `ls $(CURDIR)|grep -v debian`; do \
+                       cp -a $$FILE $(CURDIR)/debian/build-$$PGVER; \
+               done; \
+       done)
+
 #      Documentation and common files for PostGIS
        [ ! -f doc/html/postgis.html.prev -a -f doc/html/postgis.html ] && cp 
doc/html/postgis.html doc/html/postgis.html.prev || true
 
 #      PostGIS for the most recent PostgreSQL version
-       ./configure \
-               --host=$(DEB_HOST_GNU_TYPE) \
-               --build=$(DEB_BUILD_GNU_TYPE) \
-               --prefix=/usr \
-               --exec-prefix=\$${prefix} \
+       ./configure $(COMMON_CONFIGURE_ARGS) \
                
--datadir=\$${prefix}/share/postgresql-$(NEWEST_POSTGRES_VERSION)-postgis \
-               --docdir=\$${prefix}/share/doc \
-               --mandir=\$${prefix}/share/man \
-               --infodir=\$${prefix}/share/info \
-               
--with-pgconfig=/usr/lib/postgresql/$(NEWEST_POSTGRES_VERSION)/bin/pg_config \
-               --with-gui
+               
--with-pgconfig=/usr/lib/postgresql/$(NEWEST_POSTGRES_VERSION)/bin/pg_config
+
+#      PostGIS for all older Postgres versions
+       (set -e; \
+       for PGVER in $(OTHER_POSTGRES_VERSIONS); do \
+               cd $(CURDIR)/debian/build-$$PGVER; \
+               ./configure $(COMMON_CONFIGURE_ARGS) \
+                       --datadir=\$${prefix}/share/postgresql-$$PGVER-postgis \
+                       
--with-pgconfig=/usr/lib/postgresql/$$PGVER/bin/pg_config; \
+       done)
 
        touch $@
 
-clean:
+clean: debian/control
        dh_testdir
        dh_testroot
+
+#      Clean all separate build directories.
+       (set -e; \
+       for PGVER in $(OTHER_POSTGRES_VERSIONS); do \
+               rm -rf $(CURDIR)/debian/build-$$PGVER; \
+       done)
+
        rm -f raster/rt_pg/rtpostgis_drop.sql 
raster/rt_pg/rtpostgis_upgrade_cleanup.sql 
postgis/postgis_upgrade_20_minor.sql.in
        [ -f doc/html/postgis.html.prev ] && mv doc/html/postgis.html.prev 
doc/html/postgis.html || true
        [ ! -f GNUmakefile ] || $(MAKE) distclean || true
@@ -132,8 +173,19 @@ install-indep: build-indep
        dh_prep -i 
        dh_installdirs -i
 
-#      Install extensions
+#      Install extensions for the most recent Postgres version
        $(MAKE) -C extensions install DESTDIR=$(CURDIR)/debian/tmp
+
+#      Install extensions for the older Postgres versions
+       (set -e; \
+       for PGVER in $(OTHER_POSTGRES_VERSIONS); do \
+               $(MAKE) -C $(CURDIR)/debian/build-$$PGVER \
+                       install DESTDIR=$(CURDIR)/debian/tmp; \
+               $(MAKE) -C $(CURDIR)/debian/build-$$PGVER/extensions \
+                       install DESTDIR=$(CURDIR)/debian/tmp; \
+       done)
+
+#      Compile and install docs
        $(MAKE) -C doc docs-install \
                        DESTDIR=$(CURDIR)/debian/tmp \
                        PGSQL_DOCDIR=/usr/share/doc
@@ -151,20 +203,32 @@ install-arch: build-arch
        dh_prep -s
        dh_installdirs -s
 
-#      Install docs
+#      Install the extension for the most recent Postgres verison
        $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
+
+#      Install the extensions for the older Postgres versions
+       (set -e; \
+       for PGVER in $(OTHER_POSTGRES_VERSIONS); do \
+               $(MAKE) -C $(CURDIR)/debian/build-$$PGVER \
+                       install DESTDIR=$(CURDIR)/debian/tmp; \
+       done)
+
+#      Install docs and man pages
        $(MAKE) -C doc man-install \
                        DESTDIR=$(CURDIR)/debian/tmp \
                        PGSQL_DOCDIR=/usr/share/doc \
                        PGSQL_MANDIR=/usr/share/man
 
 #      Auto-create required .install file for the current Postgres version.
-       cat $(CURDIR)/debian/postgresql-generic-postgis-2.0.install.in \
-               | sed -e 's/@PGVERSION@/$(NEWEST_POSTGRES_VERSION)/' \
-               > 
$(CURDIR)/debian/postgresql-$(NEWEST_POSTGRES_VERSION)-postgis-2.0.install
-       cat $(CURDIR)/debian/postgresql-generic-postgis-2.0-scripts.install.in \
-               | sed -e 's/@PGVERSION@/$(NEWEST_POSTGRES_VERSION)/' \
-               > 
$(CURDIR)/debian/postgresql-$(NEWEST_POSTGRES_VERSION)-postgis-2.0-scripts.install
+       (set -e; \
+       for PGVER in $(OTHER_POSTGRES_VERSIONS) $(NEWEST_POSTGRES_VERSION); do \
+               cat $(CURDIR)/debian/postgresql-generic-postgis-2.0.install.in \
+                       | sed -e "s/@PGVERSION@/$$PGVER/" \
+                       > 
$(CURDIR)/debian/postgresql-$$PGVER-postgis-2.0.install; \
+               cat 
$(CURDIR)/debian/postgresql-generic-postgis-2.0-scripts.install.in \
+                       | sed -e "s/@PGVERSION@/$$PGVER/" \
+                       > 
$(CURDIR)/debian/postgresql-$$PGVER-postgis-2.0-scripts.install; \
+       done)
 
        dh_install -s
 
@@ -201,4 +265,4 @@ binary-arch: install-arch
        $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
 
 binary: binary-arch binary-indep
-.PHONY: build clean binary-indep binary-arch binary install install-indep 
install-arch check
+.PHONY: build clean binary-indep binary-arch binary install install-indep 
install-arch check debian/control

-- 
PostGIS for PostgreSQL

_______________________________________________
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

Reply via email to