The following commit has been merged in the master branch:
commit b1b34b5e3f280606617a8dc66133a6c74cad9bac
Author: Markus Wanner <mar...@bluegap.ch>
Date:   Wed Jun 5 08:06:18 2013 +0200

    Add pgversions and allow generation of debian/control based on it.

diff --git a/debian/changelog b/debian/changelog
index 6d5a4fd..c4e1a11 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -24,10 +24,11 @@ postgis (2.0.3-1) UNRELEASED; urgency=low
   * Append the PostGIS version to postgresql-9.1-postgis, so multiple
     versions of it can be co-installed. Required to keep systems working
     after an upgrade.
-  * Represent the fact that lwgeom isn't backward by renaming liblwgeom2
-    to liblwgeom-2.0.3.
+  * Represent the fact that lwgeom isn't backward compatible by renaming
+    liblwgeom2 to liblwgeom-2.0.3.
   * Add patch java-version-fix: Corrects java jdbc jar version.
   * Policy updated to 3.9.4. No changes.
+  * Add pgversions and allow generation of debian/control based on it.
   * Update debian/copyright a bit.
   * Update and improve watchfile.
 
diff --git a/debian/control b/debian/control
index cac79f7..4c28137 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@ Build-Depends: debhelper (>= 8), dpkg-dev (>= 1.16.1~), 
autotools-dev,
  libproj-dev (>= 4.5.0), libssl-dev, xsltproc, docbook, docbook-xsl,
  default-jdk, libpg-java, fastjar, libjts-java (>= 1.7), imagemagick,
  libcunit1-dev, dblatex, libxml2-dev (>= 2.5.0~), libgtk2.0-dev,
- libgdal-dev (>= 1.6.0~), postgresql-server-dev-9.1
+ libgdal-dev (>= 1.6.0~), postgresql-server-dev-all
 Build-Depends-Indep: libpostgresql-jdbc-java, libsurefire-java,
  libmaven-clean-plugin-java, libmaven-compiler-plugin-java,
  libmaven-jar-plugin-java, libmaven-resources-plugin-java, maven2
@@ -18,22 +18,6 @@ Homepage: http://postgis.refractions.net/
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-grass/postgis.git
 Vcs-Git: git://anonscm.debian.org/pkg-grass/postgis.git
 
-Package: postgresql-9.1-postgis-2.0
-Depends: ${shlibs:Depends}, postgresql-9.1, postgis-scripts2.0.3,
- liblwgeom-2.0.3, ${misc:Depends}
-Recommends: postgis
-Breaks: postgis (<< 1.2.1)
-Architecture: any
-Description: Geographic objects support for PostgreSQL 9.1
- PostGIS adds support for geographic objects to the PostgreSQL
- object-relational database. In effect, PostGIS "spatially enables"
- the PostgreSQL server, allowing it to be used as a backend spatial
- database for geographic information systems (GIS), much like ESRI's
- SDE or Oracle's Spatial extension. PostGIS follows the OpenGIS
- "Simple Features Specification for SQL".
- .
- This package supports PostgreSQL 9.1.
-
 Package: postgis
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
@@ -67,7 +51,7 @@ Package: postgis-scripts2.0.3
 Architecture: all
 Depends: ${misc:Depends}
 Recommends: postgresql-9.1-postgis-2.0
-Description: Geographic objects support for PostgreSQL 9.1 -- scripts
+Description: Geographic objects support for PostgreSQL -- scripts
  PostGIS adds support for geographic objects to the PostgreSQL
  object-relational database. In effect, PostGIS "spatially enables"
  the PostgreSQL server, allowing it to be used as a backend spatial
@@ -129,3 +113,20 @@ Description: PostGIS "Lightweight Geometry" library - 
Development files
  geometry objects, constructors, destructors, and a set of spatial
  processing functions, are implemented here.  This package contains
  the development files.
+
+Package: postgresql-9.1-postgis-2.0
+Depends: ${shlibs:Depends}, postgresql-9.1, postgis-scripts2.0.3,
+ liblwgeom-2.0.3, ${misc:Depends}
+Recommends: postgis
+Breaks: postgis (<< 1.2.1)
+Architecture: any
+Description: Geographic objects support for PostgreSQL 9.1
+ PostGIS adds support for geographic objects to the PostgreSQL
+ object-relational database. In effect, PostGIS "spatially enables"
+ the PostgreSQL server, allowing it to be used as a backend spatial
+ database for geographic information systems (GIS), much like ESRI's
+ SDE or Oracle's Spatial extension. PostGIS follows the OpenGIS
+ "Simple Features Specification for SQL".
+ .
+ This package supports PostgreSQL 9.1.
+
diff --git a/debian/control b/debian/control.in
similarity index 91%
copy from debian/control
copy to debian/control.in
index cac79f7..8aadf88 100644
--- a/debian/control
+++ b/debian/control.in
@@ -9,7 +9,7 @@ Build-Depends: debhelper (>= 8), dpkg-dev (>= 1.16.1~), 
autotools-dev,
  libproj-dev (>= 4.5.0), libssl-dev, xsltproc, docbook, docbook-xsl,
  default-jdk, libpg-java, fastjar, libjts-java (>= 1.7), imagemagick,
  libcunit1-dev, dblatex, libxml2-dev (>= 2.5.0~), libgtk2.0-dev,
- libgdal-dev (>= 1.6.0~), postgresql-server-dev-9.1
+ libgdal-dev (>= 1.6.0~), postgresql-server-dev-all
 Build-Depends-Indep: libpostgresql-jdbc-java, libsurefire-java,
  libmaven-clean-plugin-java, libmaven-compiler-plugin-java,
  libmaven-jar-plugin-java, libmaven-resources-plugin-java, maven2
@@ -18,13 +18,13 @@ Homepage: http://postgis.refractions.net/
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-grass/postgis.git
 Vcs-Git: git://anonscm.debian.org/pkg-grass/postgis.git
 
-Package: postgresql-9.1-postgis-2.0
-Depends: ${shlibs:Depends}, postgresql-9.1, postgis-scripts2.0.3,
+Package: postgresql-PGVERSION-postgis-2.0
+Depends: ${shlibs:Depends}, postgresql-PGVERSION, postgis-scripts2.0.3,
  liblwgeom-2.0.3, ${misc:Depends}
 Recommends: postgis
 Breaks: postgis (<< 1.2.1)
 Architecture: any
-Description: Geographic objects support for PostgreSQL 9.1
+Description: Geographic objects support for PostgreSQL PGVERSION
  PostGIS adds support for geographic objects to the PostgreSQL
  object-relational database. In effect, PostGIS "spatially enables"
  the PostgreSQL server, allowing it to be used as a backend spatial
@@ -32,12 +32,12 @@ Description: Geographic objects support for PostgreSQL 9.1
  SDE or Oracle's Spatial extension. PostGIS follows the OpenGIS
  "Simple Features Specification for SQL".
  .
- This package supports PostgreSQL 9.1.
+ This package supports PostgreSQL PGVERSION.
 
 Package: postgis
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Suggests: postgresql-9.1-postgis-2.0
+Suggests: postgresql-NEWEST_PGVERSION-postgis-2.0
 Description: Geographic objects support for PostgreSQL
  PostGIS adds support for geographic objects to the PostgreSQL
  object-relational database. In effect, PostGIS "spatially enables"
@@ -66,8 +66,8 @@ Description: Geographic objects support for PostgreSQL -- 
documentation
 Package: postgis-scripts2.0.3
 Architecture: all
 Depends: ${misc:Depends}
-Recommends: postgresql-9.1-postgis-2.0
-Description: Geographic objects support for PostgreSQL 9.1 -- scripts
+Recommends: postgresql-NEWEST_PGVERSION-postgis-2.0
+Description: Geographic objects support for PostgreSQL -- scripts
  PostGIS adds support for geographic objects to the PostgreSQL
  object-relational database. In effect, PostGIS "spatially enables"
  the PostgreSQL server, allowing it to be used as a backend spatial
@@ -82,7 +82,7 @@ Package: libpostgis-java
 Architecture: all
 Section: java
 Depends: libpostgresql-jdbc-java, ${misc:Depends}
-Suggests: postgresql-9.1-postgis-2.0
+Suggests: postgresql-NEWEST_PGVERSION-postgis-2.0
 Breaks: libpostgis-jdbc, libpostgisjava, postgresql-postgis-java
 Replaces: libpostgis-jdbc, libpostgisjava, postgresql-postgis-java
 Description: Geographic objects support for PostgreSQL -- JDBC support
diff --git a/debian/pgversions b/debian/pgversions
new file mode 100644
index 0000000..1d15182
--- /dev/null
+++ b/debian/pgversions
@@ -0,0 +1,3 @@
+# 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.
+9.1
diff --git a/debian/rules b/debian/rules
index 0be8b9b..985be34 100755
--- a/debian/rules
+++ b/debian/rules
@@ -18,6 +18,25 @@ export DH_OPTIONS
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/buildflags.mk
 
+# Magic to automatically create a debian/control file for the (or all)
+# supported versions of Postgres.
+#
+# Blatantly copied from /usr/share/postgresql-common/pgxs_debian_control.mk
+# and extended to support NEWEST_VERSION.
+debian/control: debian/control.in debian/pgversions
+       (set -e; \
+       VERSIONS=`pg_buildext supported-versions $(CURDIR)` || exit $$?; \
+       NEWEST_VERSION=`pg_buildext supported-versions $(CURDIR) | tail -1` || 
exit $$?; \
+       grep-dctrl -vP PGVERSION $< | \
+               sed -e "s:NEWEST_PGVERSION:$$NEWEST_VERSION:" > $@.pgxs_tmp; \
+       for v in $$VERSIONS; \
+        do                                         \
+               grep -q "^$$v" debian/pgversions   \
+               && grep-dctrl -P PGVERSION $<      \
+               | sed -e "s:PGVERSION:$$v:" >> $@.pgxs_tmp; \
+       done; \
+       mv $@.pgxs_tmp $@) || (rm -f $@.pgxs_tmp; exit 1)
+
 # These are used for cross-compiling and for saving the configure script
 # from having to guess our platform (since we know it already)
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
@@ -29,11 +48,17 @@ MVN = mvn --offline -Dmaven.repo.local=/usr/share/maven-repo
 MAJOR_VERSION = $(shell grep POSTGIS_MAJOR_VERSION Version.config|cut -d= -f2)
 MINOR_VERSION = $(shell grep POSTGIS_MINOR_VERSION Version.config|cut -d= -f2)
 MICRO_VERSION = $(shell grep POSTGIS_MICRO_VERSION Version.config|cut -d= -f2)
-VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
-ifeq ($(VERSION),..)
+POSTGIS_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
+ifeq ($(POSTGIS_VERSION),..)
 $(error Cannot detect Postgis version, fix debian/rules)
 endif
 
+# For plain Debian, we support only exactly one version at a time.
+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
+
 build: build-arch build-indep
 
 build-arch: build-arch-stamp
@@ -70,23 +95,22 @@ configuration-stamp:
 #      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 PostgreSQL 9.1
+#      PostGIS for the most recent PostgreSQL version
        ./configure \
                --host=$(DEB_HOST_GNU_TYPE) \
                --build=$(DEB_BUILD_GNU_TYPE) \
                --prefix=/usr \
                --exec-prefix=\$${prefix} \
-               --datadir=\$${prefix}/share/postgresql-9.1-postgis \
+               
--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/9.1/bin/pg_config \
+               
--with-pgconfig=/usr/lib/postgresql/$(NEWEST_POSTGRES_VERSION)/bin/pg_config \
                --with-gui
 
        touch $@
 
-
-clean: 
+clean:
        dh_testdir
        dh_testroot
        rm -f raster/rt_pg/rtpostgis_drop.sql 
raster/rt_pg/rtpostgis_upgrade_cleanup.sql 
postgis/postgis_upgrade_20_minor.sql.in
@@ -97,7 +121,7 @@ clean:
        rm -f $(CURDIR)/debian/*.postinst $(CURDIR)/debian/*.postrm
        rm -f postgis/postgis_upgrade_20_minor.sql.in 
raster/rt_pg/rtpostgis_drop.sql \
                raster/rt_pg/rtpostgis_upgrade_cleanup.sql
-       dh_clean 
+       dh_clean
 
 install: install-indep install-arch
 install-indep: build-indep
@@ -113,17 +137,17 @@ install-indep: build-indep
 
 #      Move all SQL files to /usr/share/postgis - the original location's
 #      files will get replaced with symlinks.
-       mkdir -p $(CURDIR)/debian/tmp/usr/share/postgis/$(VERSION)/sql
+       mkdir -p $(CURDIR)/debian/tmp/usr/share/postgis/$(POSTGIS_VERSION)/sql
        set -e; \
-               for FILE in 
$(CURDIR)/debian/tmp/usr/share/postgresql/9.1/extension/*.sql; do \
-                       mv $$FILE 
$(CURDIR)/debian/tmp/usr/share/postgis/$(VERSION)/sql/; \
+               for FILE in 
$(CURDIR)/debian/tmp/usr/share/postgresql/$(NEWEST_POSTGRES_VERSION)/extension/*.sql;
 do \
+                       mv $$FILE 
$(CURDIR)/debian/tmp/usr/share/postgis/$(POSTGIS_VERSION)/sql/; \
                done
 
        dh_install -i
 
 #      Link the resulting JAR file, so it's available via it's old
 #      name. (Even if postgis-jdbc.jar might be more appropriate.)
-       ln -sf postgis-jdbc-$(VERSION).jar \
+       ln -sf postgis-jdbc-$(POSTGIS_VERSION).jar \
                $(CURDIR)/debian/libpostgis-java/usr/share/java/postgis.jar
 
 install-arch: build-arch
@@ -141,9 +165,9 @@ install-arch: build-arch
 #      Link from the default postgresql extension directory back to the
 #      share postgis one, where postgis-scripts provides SQL scripts.
        set -e; \
-               for FILE in 
$(CURDIR)/debian/tmp/usr/share/postgresql/9.1/extension/*.sql; do \
+               for FILE in 
$(CURDIR)/debian/tmp/usr/share/postgresql/$(NEWEST_POSTGRES_VERSION)/extension/*.sql;
 do \
                        BASENAME=$$(basename $$FILE); \
-                       ln -sf /usr/share/postgis/$(VERSION)/sql/$$BASENAME 
$$FILE; \
+                       ln -sf 
/usr/share/postgis/$(POSTGIS_VERSION)/sql/$$BASENAME $$FILE; \
                done
 
        dh_install -s

-- 
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