Re: more docs on extending postgres in C - Mailing list pgsql-general

From Ivan Sergio Borgonovo
Subject Re: more docs on extending postgres in C
Date
Msg-id 20100122181242.0f679f5a@dawn.webthatworks.it
Whole thread Raw
In response to Re: more docs on extending postgres in C  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: more docs on extending postgres in C  (Dimitri Fontaine <dfontaine@hi-media.com>)
List pgsql-general
On Fri, 22 Jan 2010 11:02:46 -0500
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Ivan Sergio Borgonovo <mail@webthatworks.it> writes:
> > If I had to build stuff in the pg source tree I'd just clone a
> > contrib directory and change the makefile [1]. What am I
> > supposed to do if I'd like to create a contrib elsewhere (eg.
> > ~/Documents/nfs/projects/ts_extensions)?
>
> Use PGXS:
> http://www.postgresql.org/docs/8.4/static/xfunc-c.html#XFUNC-C-PGXS
>
> If the docs aren't enough for you, all of the contrib modules can
> be built via pgxs, using "make PGXS=1".  So their makefiles are
> useful examples.

What did work for me on Debian sid was:

- installing postgresql-server-dev-[version]
- apt-get source postgresql-server-dev-[version]
- copy from there a contrib dir in my ~ (or wherever you prefer)
- export USE_PGXS=1; make

I didn't have postgresql server installed on this box but I have
stuff that got in to satisfy dependencies for php/python pg drivers
and psql.
I wasn't able to understand from where PGXS pick up the version
since I installed -dev-8.3 but everything else was for 8.4 and it
didn't work:

ivan@dawn:~/ts_extension$ export USE_PGXS=1; make
Makefile:12: /usr/lib/postgresql/8.4/lib/pgxs/src/makefiles/pgxs.mk:
No such file or directory make: *** No rule to make target
`/usr/lib/postgresql/8.4/lib/pgxs/src/makefiles/pgxs.mk'.  Stop.

Installing dev-8.4 made everything work.

Nothing that really trouble me... but I'd expect that installing
-dev-8.3 it would look in the right place since actually pgxs.mk is
included in both versions.

Thanks... I'd publish a summary as soon as I've clearer ideas so
that the next poor guy will find easier to write contrib on Debian.

I don't know if the version problem is worth a bug report to Debian
(or pg people that built the pgxs system).

--
Ivan Sergio Borgonovo
http://www.webthatworks.it


pgsql-general by date:

Previous
From: DM
Date:
Subject: Re: When is the release date for Postgres 8.5?
Next
From: "Bob Pawley"
Date:
Subject: Re: Old/New