Re: Extensions, this time with a patch - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: Extensions, this time with a patch
Date
Msg-id m239s07vh9.fsf@2ndQuadrant.fr
Whole thread Raw
In response to Re: Extensions, this time with a patch  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Extensions, this time with a patch
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:
> I don't think that "no changes to the makefiles" is a requirement,
> or even a wish-list item, for this.  I think it's perfectly reasonable
> for the makefile to have to specify the module name; far better that
> than that we get the name by some "magic" or other.

It seemed easy to get a reasonable approach requiring very few edits in
contribs so I favoured that. Now, it's still entirely possible to hand
adjust. Determining the extension name automatically from DATA_built or
DATA is only done where EXTENSION has not been provided, and guessing
the CONTROL file name from the EXTENSION name only occurs when CONTROL
has not been provided.

Of course if those changes (inlined there after) are seen as a bad idea,
then I will change all contrib Makefiles to add EXTENSION, EXTVERSION
(which always is MAJORVERSION here) and CONTROL (which almost always is
EXTENSION.control).

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support

# create extension support
ifndef CONTROL
ifndef EXTENSION
ifdef DATA_built
EXTENSION = $(basename $(notdir $(firstword $(DATA_built))))
else ifdef DATA
EXTENSION = $(basename $(notdir $(firstword $(DATA))))
endif # DATA_built
endif # EXTENSION
ifndef EXTVERSION
EXTVERSION = $(MAJORVERSION)
endif
ifdef EXTENSION
CONTROL = $(EXTENSION).control
endif # EXTENSION
endif # CONTROL

control:# create .control to keep track that we created the control file(s)@for file in $(CONTROL); do \  test -f
`basename$$file .control`.sql -a ! -f $$file && touch .control || true ; \  if [ -f .control ]; then \    if [ -n
"$(EXTENSION)"]; then \    (echo "name = '$(EXTENSION)'"; echo "version = '$(EXTVERSION)'") > $$file ; \    else \
(echo"name = '`basename $$file .control`'"; echo "version = '$(EXTVERSION)'") > $$file ; \    fi ; \    if [ -n
"$(EXTCOMMENT)"]; then echo "comment = '$(EXTCOMMENT)'" >> $$file ; fi ; \  fi ; \done
 

install: all installdirs control
ifneq (,$(DATA)$(DATA_built)$(CONTROL))@for file in $(addprefix $(srcdir)/, $(DATA)) $(DATA_built) $(CONTROL); do \
echo"$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/$(datamoduledir)'"; \  $(INSTALL_DATA) $$file
'$(DESTDIR)$(datadir)/$(datamoduledir)';\done
 
endif # DATA


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Serializable snapshot isolation patch
Next
From: Heikki Linnakangas
Date:
Subject: Re: How to reliably detect if it's a promoting standby