Thread: Re: pgxs: build infrastructure for extensions v4

Re: pgxs: build infrastructure for extensions v4

From
"Mark Cave-Ayland"
Date:
Peter/Fabien,

Just to say thank you for all your hard work in getting pgxs working in
CVS. I've successfully managed to get a contrib module to build outside
of the source tree, which will help simplify a lot of things.

I have one question though: the comments in pgxs.mk suggested that I
needed to do the following to include the pgxs.mk:

# Use the following layout for your Makefile:
#
#   [variable assignments, see below]
#   [custom rules, rarely necessary]
#
#   PGXS := $(shell pg_config --pgxs)
#   include $(PGXS)


However, on my CVS version from about an hour ago, I needed to change
this to:
PGXS := $(shell pg_config --pgxs)/src/makefiles/pgxs.mkinclude $(PGXS)

This is because I only get the pgxs directory returned by "pgconfig
--pgxs" as opposed to the path to the pgxs.mk file itself - is that the
correct thing to do (i.e. the comment is wrong?) or is "pgconfig --pgxs"
returning the wrong thing?


Kind regards,

Mark.

---

Mark Cave-Ayland
Webbased Ltd.
Tamar Science Park
Derriford
Plymouth
PL6 8BX
England

Tel: +44 (0)1752 764445
Fax: +44 (0)1752 764446


This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender. You
should not copy it or use it for any purpose nor disclose or distribute
its contents to any other person.




Re: pgxs: build infrastructure for extensions v4

From
Andrew Dunstan
Date:

Mark Cave-Ayland wrote:

>Peter/Fabien,
>
>Just to say thank you for all your hard work in getting pgxs working in
>CVS. I've successfully managed to get a contrib module to build outside
>of the source tree, which will help simplify a lot of things.
>
>I have one question though: the comments in pgxs.mk suggested that I
>needed to do the following to include the pgxs.mk:
>
># Use the following layout for your Makefile:
>#
>#   [variable assignments, see below]
>#   [custom rules, rarely necessary]
>#
>#   PGXS := $(shell pg_config --pgxs)
>#   include $(PGXS)
>
>
>However, on my CVS version from about an hour ago, I needed to change
>this to:
>
>    PGXS := $(shell pg_config --pgxs)/src/makefiles/pgxs.mk
>    include $(PGXS)
>
>This is because I only get the pgxs directory returned by "pgconfig
>--pgxs" as opposed to the path to the pgxs.mk file itself - is that the
>correct thing to do (i.e. the comment is wrong?) or is "pgconfig --pgxs"
>returning the wrong thing?
>
>
>
>  
>

needs to be fixed in pg_config.c I think - should be a one-liner.

cheers

andrew


Re: pgxs: build infrastructure for extensions v4

From
Joe Conway
Date:
Andrew Dunstan wrote:
> Mark Cave-Ayland wrote:
>> This is because I only get the pgxs directory returned by "pgconfig
>> --pgxs" as opposed to the path to the pgxs.mk file itself - is that the
>> correct thing to do (i.e. the comment is wrong?) or is "pgconfig --pgxs"
>> returning the wrong thing?
>
> needs to be fixed in pg_config.c I think - should be a one-liner.

If the attached looks correct I'll apply it.

Joe
Index: src/bin/pg_config/pg_config.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_config/pg_config.c,v
retrieving revision 1.3
diff -c -r1.3 pg_config.c
*** src/bin/pg_config/pg_config.c    2 Aug 2004 12:34:14 -0000    1.3
--- src/bin/pg_config/pg_config.c    4 Aug 2004 18:00:51 -0000
***************
*** 141,147 ****
          else if (strcmp(argv[i],"--pgxs") == 0)
          {
              get_pkglib_path(mypath,otherpath);
!             strncat(otherpath, "/pgxs", MAXPGPATH-1);
          }

          printf("%s\n",otherpath);
--- 141,147 ----
          else if (strcmp(argv[i],"--pgxs") == 0)
          {
              get_pkglib_path(mypath,otherpath);
!             strncat(otherpath, "/pgxs/src/makefiles/pgxs.mk", MAXPGPATH-1);
          }

          printf("%s\n",otherpath);

Re: pgxs: build infrastructure for extensions v4

From
Bruce Momjian
Date:
FYI, I couldn't find anything in the shell pg_config with this path:
       strncat(otherpath, "/pgxs/src/makefiles/pgxs.mk", MAXPGPATH-1);

Did you find a mention of this?  I looked in pg_config.sh and
Makefile.global.in.

I am not saying your change is wrong, just that it is new, I think.

---------------------------------------------------------------------------

Joe Conway wrote:
> Andrew Dunstan wrote:
> > Mark Cave-Ayland wrote:
> >> This is because I only get the pgxs directory returned by "pgconfig
> >> --pgxs" as opposed to the path to the pgxs.mk file itself - is that the
> >> correct thing to do (i.e. the comment is wrong?) or is "pgconfig --pgxs"
> >> returning the wrong thing?
> > 
> > needs to be fixed in pg_config.c I think - should be a one-liner.
> 
> If the attached looks correct I'll apply it.
> 
> Joe


> 
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: pgxs: build infrastructure for extensions v4

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> FYI, I couldn't find anything in the shell pg_config with this path:
>         strncat(otherpath, "/pgxs/src/makefiles/pgxs.mk", MAXPGPATH-1);
> Did you find a mention of this?  I looked in pg_config.sh and
> Makefile.global.in.

The original coding concatenated "src/makefiles/pgxs.mk" to a path value
derived elsewhere (pgxsdir).  I was planning to bug Peter about just how
correct this patch is --- it's essentially hardwiring an assumption
about the construction of pgxsdir.
        regards, tom lane


Re: pgxs: build infrastructure for extensions v4

From
Joe Conway
Date:
Bruce Momjian wrote:
> FYI, I couldn't find anything in the shell pg_config with this path:
> 
>         strncat(otherpath, "/pgxs/src/makefiles/pgxs.mk", MAXPGPATH-1);
> 
> Did you find a mention of this?  I looked in pg_config.sh and
> Makefile.global.in.

I see it here:
http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/pg_config/Attic/pg_config.sh.diff?r1=1.9;r2=1.10
     --pkglibdir)    show="$show \$val_pkglibdir";;
+    --pgxs)         show="$show \$val_pgxsdir/src/makefiles/pgxs.mk";;     --configure)    show="$show
\$val_configure";;

Joe


Re: pgxs: build infrastructure for extensions v4

From
Joe Conway
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> 
>>FYI, I couldn't find anything in the shell pg_config with this path:
>>        strncat(otherpath, "/pgxs/src/makefiles/pgxs.mk", MAXPGPATH-1);
>>Did you find a mention of this?  I looked in pg_config.sh and
>>Makefile.global.in.
> 
> 
> The original coding concatenated "src/makefiles/pgxs.mk" to a path value
> derived elsewhere (pgxsdir).  I was planning to bug Peter about just how
> correct this patch is --- it's essentially hardwiring an assumption
> about the construction of pgxsdir.
> 

I just added "src/makefiles/pgxs.mk" to the already hardwired path to 
pgxs in pg_config.c. But in any case, it looks like pgxsdir is set in 
src/Makefile.global.in like like this:  pgxsdir = $(pkglibdir)/pgxs
So it is sort of hardwired already at the moment at least.

Joe



Re: pgxs: build infrastructure for extensions v4

From
Bruce Momjian
Date:
Oh, I see that modification now.  Thanks.  Sorry I missed it.

---------------------------------------------------------------------------

Joe Conway wrote:
> Bruce Momjian wrote:
> > FYI, I couldn't find anything in the shell pg_config with this path:
> > 
> >         strncat(otherpath, "/pgxs/src/makefiles/pgxs.mk", MAXPGPATH-1);
> > 
> > Did you find a mention of this?  I looked in pg_config.sh and
> > Makefile.global.in.
> 
> I see it here:
> http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/pg_config/Attic/pg_config.sh.diff?r1=1.9;r2=1.10
> 
>       --pkglibdir)    show="$show \$val_pkglibdir";;
> +    --pgxs)         show="$show \$val_pgxsdir/src/makefiles/pgxs.mk";;
>       --configure)    show="$show \$val_configure";;
> 
> Joe
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073