Обсуждение: question on 8.4.2 build postgres C functions

Поиск
Список
Период
Сортировка

question on 8.4.2 build postgres C functions

От
Steve Coleman
Дата:
Hi,

I am moving from version 8.1.4 to 8.4.2 and have set up a Ubuntu box configured with the 8.4.2 postgres one-click
installer. It works great! 

I imported everything from 8.1.4 with only two failures, and those were homegrown "C" encryption / decryption functions
thatwe use here. 

For 8.1.4 I had compiled the C functions by adding a folder in the contrib folder of the source code, and used gmake to
buildit. 

For 8.4.2 I plan on adding the "magic block" and rebuilding the functions.  I downloaded the source tarball
postgresql-8.4.2.tar.gzand put that in a tmp folder, set up my contrib/decrypt folder, and set up the make. 

My problem is that 8.4.2 source has no "Makefile.global".  This file is essential I believe, and is used by all of the
Makefilesin the source tarball. 

So am I missing something obvious or is there a different procedure to build "C" functions that I'm not aware of.

Thanks!
   STeve


Re: question on 8.4.2 build postgres C functions

От
Tom Lane
Дата:
Steve Coleman <scoleman@capecomputing.com> writes:
> My problem is that 8.4.2 source has no "Makefile.global".  This file is essential I believe, and is used by all of
theMakefiles in the source tarball. 

Makefile.global is created by the configure step.  This has not changed
since 8.1.  If you want to create a file that matches somebody else's
build, examine pg_config output to see what configure options they used,
and duplicate that.  It would also be wise to check the
src/include/pg_config.h result from configure to ensure that it matches
their build (hopefully pg_config.h is included in what they distributed).

            regards, tom lane

Re: question on 8.4.2 build postgres C functions

От
Tom Lane
Дата:
Tom Lane <tgl@sss.pgh.pa.us> writes:
> Steve Coleman <scoleman@capecomputing.com> writes:
>> My problem is that 8.4.2 source has no "Makefile.global".  This file is essential I believe, and is used by all of
theMakefiles in the source tarball. 

> Makefile.global is created by the configure step.  This has not changed
> since 8.1.

On second thought, I got too immersed in answering the question you
asked, and failed to answer the uber-question which is whether there's
a better way to do it.  Yes: use pgxs.  Then you don't need a
configured source tree at all, and everything you do need should
come in pre-built installations.

If you started by copying a contrib makefile then you should have a
block like

ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/auto_explain
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif

You could use this as-is by always typing "make USE_PGXS=1", but
what I'd suggest is dropping the ifdef and the else block so that
pgxs becomes the default.  Contrib modules have this so they can
be built either way, but you don't really need that flexibility
for a private module.

            regards, tom lane