Re: Frustrating issue with PGXS - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Frustrating issue with PGXS
Date
Msg-id 273.1182895811@sss.pgh.pa.us
Whole thread Raw
In response to Re: Frustrating issue with PGXS  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: Frustrating issue with PGXS
List pgsql-hackers
Fabien COELHO <coelho@cri.ensmp.fr> writes:
> Some documentation (not just code) update seems important to me.

Agreed.  I added this to xfunc.sgml's discussion of PGXS makefiles:

Index: doc/src/sgml/xfunc.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v
retrieving revision 1.128
diff -c -r1.128 xfunc.sgml
*** doc/src/sgml/xfunc.sgml    6 Jun 2007 23:00:36 -0000    1.128
--- doc/src/sgml/xfunc.sgml    26 Jun 2007 21:57:43 -0000
***************
*** 2071,2080 **** DATA_built = isbn_issn.sql DOCS = README.isbn_issn 
! PGXS := $(shell pg_config --pgxs) include $(PGXS) </programlisting>
!     The last two lines should always be the same.  Earlier in the     file, you assign variables or add custom
<application>make</application>rules.    </para>
 
--- 2071,2081 ---- DATA_built = isbn_issn.sql DOCS = README.isbn_issn 
! PG_CONFIG = pg_config
! PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) </programlisting>
!     The last three lines should always be the same.  Earlier in the     file, you assign variables or add custom
<application>make</application>rules.    </para>
 
***************
*** 2215,2220 ****
--- 2216,2233 ----        </para>       </listitem>      </varlistentry>
+ 
+      <varlistentry>
+       <term><varname>PG_CONFIG</varname></term>
+       <listitem>
+        <para>
+         path to <application>pg_config</> program for the
+         <productname>PostgreSQL</productname> installation to build against
+         (typically just <literal>pg_config</> to use the first one in your
+         <varname>PATH</>)
+        </para>
+       </listitem>
+      </varlistentry>     </variablelist>    </para> 
***************
*** 2222,2234 ****     Put this makefile as <literal>Makefile</literal> in the directory     which holds your
extension.Then you can do     <literal>make</literal> to compile, and later <literal>make
 
!     install</literal> to install your module.  The extension is     compiled and installed for the
<productname>PostgreSQL</productname>installation that
 
!     corresponds to the first <command>pg_config</command> command
!     found in your path.    </para>     <para>     The scripts listed in the <varname>REGRESS</> variable are used for
   regression testing of your module, just like <literal>make
 
--- 2235,2260 ----     Put this makefile as <literal>Makefile</literal> in the directory     which holds your
extension.Then you can do     <literal>make</literal> to compile, and later <literal>make
 
!     install</literal> to install your module.  By default, the extension is     compiled and installed for the
<productname>PostgreSQL</productname>installation that
 
!     corresponds to the first <command>pg_config</command> program
!     found in your path.  You can use a different installation by
!     setting <varname>PG_CONFIG</varname> to point to its
!     <command>pg_config</command> program, either within the makefile
!     or on the <literal>make</literal> command line.    </para> 
+    <caution>
+     <para>
+      Changing <varname>PG_CONFIG</varname> only works when building
+      against <productname>PostgreSQL</productname> 8.3 or later.
+      With older releases it does not work to set it to anything except
+      <literal>pg_config</>; you must alter your <varname>PATH</>
+      to select the installation to build against.
+     </para>
+    </caution>
+     <para>     The scripts listed in the <varname>REGRESS</> variable are used for     regression testing of your
module,just like <literal>make
 


It might be worth backpatching the Makefile.global.in patch (ie, the
ifndef addition) to the 8.2 branch, which would allow us to say "8.2.5
or later" instead of "8.3 or later", and would bring correspondingly
nearer the time when people can actually use the feature without
thinking much.  Comments?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Bugtraq: Having Fun With PostgreSQL
Next
From: Andrew Dunstan
Date:
Subject: Re: Bugtraq: Having Fun With PostgreSQL