Log Message:
-----------
PostgreSQL extension makefile framework ("pgxs"), by Fabien Coelho, with
some massaging by Peter Eisentraut.  This is basically a simple
generalization of the existing contrib makefiles.

Modified Files:
--------------
    pgsql-server:
        GNUmakefile.in (r1.39 -> r1.40)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/GNUmakefile.in.diff?r1=1.39&r2=1.40)
    pgsql-server/contrib:
        contrib-global.mk (r1.7 -> r1.8)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/contrib/contrib-global.mk.diff?r1=1.7&r2=1.8)
    pgsql-server/doc/src/sgml:
        xfunc.sgml (r1.84 -> r1.85)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/doc/src/sgml/xfunc.sgml.diff?r1=1.84&r2=1.85)
    pgsql-server/src:
        Makefile (r1.32 -> r1.33)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/Makefile.diff?r1=1.32&r2=1.33)
        Makefile.global.in (r1.189 -> r1.190)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/Makefile.global.in.diff?r1=1.189&r2=1.190)
    pgsql-server/src/bin/pg_config:
        Makefile (r1.6 -> r1.7)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/pg_config/Makefile.diff?r1=1.6&r2=1.7)
        pg_config.sh (r1.9 -> r1.10)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/pg_config/pg_config.sh.diff?r1=1.9&r2=1.10)
    pgsql-server/src/utils:
        Makefile (r1.20 -> r1.21)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/utils/Makefile.diff?r1=1.20&r2=1.21)

Added Files:
-----------
    pgsql-server/config:
        Makefile (r1.1)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/config/Makefile?rev=1.1&content-type=text/x-cvsweb-markup)
    pgsql-server/src/makefiles:
        Makefile (r1.1)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/makefiles/Makefile?rev=1.1&content-type=text/x-cvsweb-markup)
        pgxs.mk (r1.1)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/makefiles/pgxs.mk?rev=1.1&content-type=text/x-cvsweb-markup)

Fri, 30 Jul 2004 09:26:41 -0300 (ADT)
petere@svr1.postgresql.org (Peter Eisentraut)
pgsql-server: PostgreSQL extension makefile framework ("pgxs"), by 

Dear Peter,

> PostgreSQL extension makefile framework ("pgxs"), by Fabien Coelho, with
> some massaging by Peter Eisentraut.  This is basically a simple
> generalization of the existing contrib makefiles.

Thanks for your help.

I'm having a look at CVS know, and it seems to me that one cannot pgxs
"dynamic" stuff to install any contrib, because:

(1) all makefiles in contrib include directly "src/Makefile.global" which
    is generated by configure, although it is already included by the
    "src/makefiles/pgxs.mk" makefile anyway, so it seems to me that it
    is useless because redundant?

(2) only static includes are used, so I cannot use "pg_config --pgxs"
    approach to install a contrib against an already compiled postgresql?
    basically, you drop the USE_PGXS stuff for dynamic configuration
    of contrib makefiles, and I have found no replacement.

That does annoy me a little bit not to be able to use it, as it was one of
my motivations for doing all that stuff...

May I enquire on the rational for the current status?
Would it be possible to have both worlds?
If not, what is the actual issue?
What was broken with version 4 I sent?
Or am I missing something somewhere? I'm pretty jetlagged this afternoon...:-(

Thanks in advance,

-- 
Fabien Coelho - coelho@cri.ensmp.fr

Tue, 10 Aug 2004 17:55:17 +0200 (CEST)
Fabien COELHO <coelho@cri.ensmp.fr>
Re: pgsql-server: PostgreSQL extension makefile framework
Am Dienstag, 10. August 2004 17:55 schrieb Fabien COELHO:
> (1) all makefiles in contrib include directly "src/Makefile.global" which
>     is generated by configure, although it is already included by the
>     "src/makefiles/pgxs.mk" makefile anyway, so it seems to me that it
>     is useless because redundant?

No, because you need Makefile.global to define top_srcdir, which is needed to 
find pgxs.mk.  You changed all top_srcdir to top_builddir, which is wrong.

> (2) only static includes are used, so I cannot use "pg_config --pgxs"
>     approach to install a contrib against an already compiled postgresql?
>     basically, you drop the USE_PGXS stuff for dynamic configuration
>     of contrib makefiles, and I have found no replacement.

I don't see the point of that.  If you have a PostgreSQL source tree, you can 
install the contribs right there.  How else would you do it?

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

Wed, 11 Aug 2004 18:55:01 +0200
Peter Eisentraut <peter_e@gmx.net>
Re: [COMMITTERS] pgsql-server: PostgreSQL extension makefile
 framework

Dear Peter,

> Am Dienstag, 10. August 2004 17:55 schrieb Fabien COELHO:
> > (1) all makefiles in contrib include directly "src/Makefile.global" which
> >     is generated by configure, although it is already included by the
> >     "src/makefiles/pgxs.mk" makefile anyway, so it seems to me that it
> >     is useless because redundant?
>
> No, because you need Makefile.global to define top_srcdir, which is needed to
> find pgxs.mk.

> You changed all top_srcdir to top_builddir, which is wrong.

I agree it may be wrong, although it worked in my simple tests.

Maybe you could explain why it is wrong?
What is the actual issue with these two macros?
I guess I miss something about the "vpath" feature?

There is a chicken and egg issue here for a simple makefile macro, the
implications are unclear to me, and I'm willing to find a fix.

It looks to me that when using the dynamic feature of pgxs, then the
abs_top_srcdir does not make sense as one cannot know whether the sources
would be extracted in the same directory. This suggest that maybe some
carefull ifdef could fix the stuff? I can suggest the following in every
contrib makefiles:

ifdef USE_PGXS
# Fabien's way
PGXS = $(shell pg_config --pgxs)
include $(PGXS)
else
# Peter's way
include $(top_builddir)/src/Makefile.global
# Now top_srcdir is defined:
include $(top_srcdir)/contrib/contrib-global.mk
endif

Would you find it better?


> > (2) only static includes are used, so I cannot use "pg_config --pgxs"
> >     approach to install a contrib against an already compiled postgresql?
> >     basically, you drop the USE_PGXS stuff for dynamic configuration
> >     of contrib makefiles, and I have found no replacement.
>
> I don't see the point of that.

Indeed.

> If you have a PostgreSQL source tree, you can install the contribs right
> there.

My objective in pgxs wrt contrib is to be able to add a contrib as an
afterthought: say, I installed a postgresql server 10 months ago and now I
would like to test tsearch2 with that server. I don't want to reconfigure
the whole thing, I just have a few files to compile.

With apache, I can do a "apxs -someoptions mod_somemodule.c" to install
any "simple" module, and that is the kind of feature I'm looking for.

If pgxs can be used to add external modules, there is no reason why we
could not use it to also install a contrib, the issue is just about the
makefile and how to handle it.

In my first submissions I provided a separate makefile which is basically
a copy of the original makefile with one line fixed. You argued that they
that it added a maintenance burden. So as they are very similar, in a
later submission I merged the two files, but then you removed the key
feature I was adding:-(

> How else would you do it?

With the "dynamic configuration" provided pgxs, not relying on the files
in the source tree but relying on the ones installed. That why I copy all
those files... adding any extension, external or in contrib, does not
need to rely on the configured source tree.

Have a nice day,

-- 
Fabien Coelho - coelho@cri.ensmp.fr

Thu, 12 Aug 2004 09:24:57 +0200 (CEST)
Fabien COELHO <coelho@cri.ensmp.fr>
Re: [COMMITTERS] pgsql-server: PostgreSQL extension makefile