On Thu, Apr 21, 2011 at 1:14 AM, David E. Wheeler <da...@kineticode.com> wrote:
> I finally got round to updating a couple of my extensions to support 9.1 > extensions. Unlike the contrib extensions, these needed to target older > versions of PostgreSQL, as well. Case in point, the semver data type; you > might find the Makefile of particular interest: > > https://github.com/theory/pg-semver/blob/master/Makefile Hi David, thanks for sharing. I've recently packaged an extension for PG 8.4-9.1 and had to wrestle the Makefile too. You may take a look at it and check if there is any solution useful for your extension too: <https://github.com/dvarrazzo/pgmp/blob/master/Makefile>. Specifically, I parse the version from the control file using: PGMP_VERSION=$(shell grep default_version pgmp.control | sed -e "s/default_version = '\(.*\)'/\1/") so the Makefile doesn't have to be maintained for it. To tell apart < 9.1 and >= 9.1 I've used instead: PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0" && echo pre91 || echo 91) ifeq ($(PG91),91) ... else ... For my extension I'm less concerned by having the install sql named in different ways or by the upgrade sql as all these files are generated by scripts. You may find useful this one <https://github.com/dvarrazzo/pgmp/blob/master/tools/sql2extension.py> to generate the upgrade sql from the install sql. For my extension I require Python and have all the sql files generated by the Makefile at install time; if you don't want this dependency you may generate the sql before packaging and ship the result instead. Cheers, -- Daniele -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers