Author: Martin Pitt <mpitt@debian.org>
Description: Use version specific installation directories so that several major versions can be installed in parallel.
Forwarded: No, Debian specific packaging with postgresql-common

 * Install lib files into /usr/lib/postgresql/<version>/lib/
 * Install server related header files into /usr/include/postgresql/<version>/server/
 * Disable PostgreSQL's automagic path mangling and fix libdir for pg_config,
   so that pg_config in /usr/bin and /usr/lib/postgresql/<version>/bin behave
   identically.

Bug-Debian: http://bugs.debian.org/462037

Index: postgresql-9.2-9.2.0/src/Makefile.global.in
===================================================================
--- postgresql-9.2-9.2.0.orig/src/Makefile.global.in	2011-09-09 07:21:46.011745835 +0200
+++ postgresql-9.2-9.2.0/src/Makefile.global.in	2011-09-09 07:21:51.041745870 +0200
@@ -96,7 +96,7 @@
 pkglibdir = $(libdir)
 ifeq "$(findstring pgsql, $(pkglibdir))" ""
 ifeq "$(findstring postgres, $(pkglibdir))" ""
-override pkglibdir := $(pkglibdir)/postgresql
+override pkglibdir := $(pkglibdir)/postgresql/9.2/lib
 endif
 endif
 
@@ -144,7 +144,7 @@
 
 # These derived path variables aren't separately configurable.
 
-includedir_server = $(pkgincludedir)/server
+includedir_server = $(pkgincludedir)/9.2/server
 includedir_internal = $(pkgincludedir)/internal
 pgxsdir = $(pkglibdir)/pgxs
 
Index: postgresql-9.2-9.2.0/src/bin/pg_config/pg_config.c
===================================================================
--- postgresql-9.2-9.2.0.orig/src/bin/pg_config/pg_config.c	2011-09-09 07:21:46.031745835 +0200
+++ postgresql-9.2-9.2.0/src/bin/pg_config/pg_config.c	2011-09-09 07:21:51.041745870 +0200
@@ -26,6 +26,8 @@
 
 #include "port.h"
 
+#include "../port/pg_config_paths.h"
+
 static const char *progname;
 static char mypath[MAXPGPATH];
 
@@ -481,7 +483,6 @@
 {
 	int			i;
 	int			j;
-	int			ret;
 
 	set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_config"));
 
@@ -497,13 +498,7 @@
 		}
 	}
 
-	ret = find_my_exec(argv[0], mypath);
-
-	if (ret)
-	{
-		fprintf(stderr, _("%s: could not find own program executable\n"), progname);
-		exit(1);
-	}
+	snprintf(mypath, sizeof(mypath), "%s/%s", PGBINDIR, progname);
 
 	/* no arguments -> print everything */
 	if (argc < 2)
