Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4c5b4c8

Browse files
committed
Improve PGXS makefile system to allow the module's makefile to specify
where to install DATA and DOCS files. This is mainly intended to allow versioned installation, eg, install into contrib/fooM.N/ rather than directly into contrib/. Mark Cave-Ayland
1 parent 06f82b2 commit 4c5b4c8

File tree

2 files changed

+79
-54
lines changed

2 files changed

+79
-54
lines changed

doc/src/sgml/xfunc.sgml

+48-31
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.143 2009/12/10 06:32:28 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.144 2010/01/04 16:34:11 tgl Exp $ -->
22

33
<sect1 id="xfunc">
44
<title>User-Defined Functions</title>
@@ -2414,105 +2414,122 @@ include $(PGXS)
24142414
</para>
24152415

24162416
<para>
2417-
The following variables can be set:
2417+
Set one of these three variables to specify what is built:
24182418

24192419
<variablelist>
24202420
<varlistentry>
24212421
<term><varname>MODULES</varname></term>
24222422
<listitem>
24232423
<para>
2424-
list of shared objects to be built from source file with same
2424+
list of shared objects to be built from source files with same
24252425
stem (do not include suffix in this list)
24262426
</para>
24272427
</listitem>
24282428
</varlistentry>
24292429

24302430
<varlistentry>
2431-
<term><varname>DATA</varname></term>
2431+
<term><varname>MODULE_big</varname></term>
24322432
<listitem>
24332433
<para>
2434-
random files to install into <literal><replaceable>prefix</replaceable>/share/contrib</literal>
2434+
a shared object to build from multiple source files
2435+
(list object files in <varname>OBJS</varname>)
24352436
</para>
24362437
</listitem>
24372438
</varlistentry>
24382439

24392440
<varlistentry>
2440-
<term><varname>DATA_built</varname></term>
2441+
<term><varname>PROGRAM</varname></term>
24412442
<listitem>
24422443
<para>
2443-
random files to install into
2444-
<literal><replaceable>prefix</replaceable>/share/contrib</literal>,
2445-
which need to be built first
2444+
a binary program to build
2445+
(list object files in <varname>OBJS</varname>)
24462446
</para>
24472447
</listitem>
24482448
</varlistentry>
2449+
</variablelist>
24492450

2451+
The following variables can also be set:
2452+
2453+
<variablelist>
24502454
<varlistentry>
2451-
<term><varname>DOCS</varname></term>
2455+
<term><varname>MODULEDIR</varname></term>
24522456
<listitem>
24532457
<para>
2454-
random files to install under
2455-
<literal><replaceable>prefix</replaceable>/doc/contrib</literal>
2458+
subdirectory into which DATA and DOCS files should be
2459+
installed (if not set, default is <literal>contrib</literal>)
24562460
</para>
24572461
</listitem>
24582462
</varlistentry>
24592463

24602464
<varlistentry>
2461-
<term><varname>SCRIPTS</varname></term>
2465+
<term><varname>DATA</varname></term>
24622466
<listitem>
24632467
<para>
2464-
script files (not binaries) to install into
2465-
<literal><replaceable>prefix</replaceable>/bin</literal>
2468+
random files to install into <literal><replaceable>prefix</replaceable>/share/$MODULEDIR</literal>
24662469
</para>
24672470
</listitem>
24682471
</varlistentry>
24692472

24702473
<varlistentry>
2471-
<term><varname>SCRIPTS_built</varname></term>
2474+
<term><varname>DATA_built</varname></term>
24722475
<listitem>
24732476
<para>
2474-
script files (not binaries) to install into
2475-
<literal><replaceable>prefix</replaceable>/bin</literal>,
2477+
random files to install into
2478+
<literal><replaceable>prefix</replaceable>/share/$MODULEDIR</literal>,
24762479
which need to be built first
24772480
</para>
24782481
</listitem>
24792482
</varlistentry>
24802483

24812484
<varlistentry>
2482-
<term><varname>REGRESS</varname></term>
2485+
<term><varname>DATA_TSEARCH</varname></term>
24832486
<listitem>
24842487
<para>
2485-
list of regression test cases (without suffix), see below
2488+
random files to install under
2489+
<literal><replaceable>prefix</replaceable>/share/tsearch_data</literal>
24862490
</para>
24872491
</listitem>
24882492
</varlistentry>
2489-
</variablelist>
24902493

2491-
or at most one of these two:
2492-
2493-
<variablelist>
24942494
<varlistentry>
2495-
<term><varname>PROGRAM</varname></term>
2495+
<term><varname>DOCS</varname></term>
24962496
<listitem>
24972497
<para>
2498-
a binary program to build (list objects files in <varname>OBJS</varname>)
2498+
random files to install under
2499+
<literal><replaceable>prefix</replaceable>/doc/$MODULEDIR</literal>
24992500
</para>
25002501
</listitem>
25012502
</varlistentry>
25022503

25032504
<varlistentry>
2504-
<term><varname>MODULE_big</varname></term>
2505+
<term><varname>SCRIPTS</varname></term>
25052506
<listitem>
25062507
<para>
2507-
a shared object to build (list object files in <varname>OBJS</varname>)
2508+
script files (not binaries) to install into
2509+
<literal><replaceable>prefix</replaceable>/bin</literal>
25082510
</para>
25092511
</listitem>
25102512
</varlistentry>
2511-
</variablelist>
25122513

2513-
The following can also be set:
2514+
<varlistentry>
2515+
<term><varname>SCRIPTS_built</varname></term>
2516+
<listitem>
2517+
<para>
2518+
script files (not binaries) to install into
2519+
<literal><replaceable>prefix</replaceable>/bin</literal>,
2520+
which need to be built first
2521+
</para>
2522+
</listitem>
2523+
</varlistentry>
25142524

2515-
<variablelist>
2525+
<varlistentry>
2526+
<term><varname>REGRESS</varname></term>
2527+
<listitem>
2528+
<para>
2529+
list of regression test cases (without suffix), see below
2530+
</para>
2531+
</listitem>
2532+
</varlistentry>
25162533

25172534
<varlistentry>
25182535
<term><varname>EXTRA_CLEAN</varname></term>

src/makefiles/pgxs.mk

+31-23
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PGXS: PostgreSQL extensions makefile
22

3-
# $PostgreSQL: pgsql/src/makefiles/pgxs.mk,v 1.17 2009/08/26 22:24:43 petere Exp $
3+
# $PostgreSQL: pgsql/src/makefiles/pgxs.mk,v 1.18 2010/01/04 16:34:11 tgl Exp $
44

55
# This file contains generic rules to build many kinds of simple
66
# extension modules. You only need to set a few variables and include
@@ -15,27 +15,27 @@
1515
# PGXS := $(shell $(PG_CONFIG) --pgxs)
1616
# include $(PGXS)
1717
#
18-
# The following variables can be set:
18+
# Set one of these three variables to specify what is built:
1919
#
20-
# MODULES -- list of shared objects to be build from source file with
20+
# MODULES -- list of shared objects to be built from source files with
2121
# same stem (do not include suffix in this list)
22-
# DATA -- random files to install into $PREFIX/share/contrib
23-
# DATA_built -- random files to install into $PREFIX/share/contrib,
22+
# MODULE_big -- a shared object to build from multiple source files
23+
# (list object files in OBJS)
24+
# PROGRAM -- a binary program to build (list object files in OBJS)
25+
#
26+
# The following variables can also be set:
27+
#
28+
# MODULEDIR -- subdirectory into which DATA and DOCS files should be
29+
# installed (if not set, default is "contrib")
30+
# DATA -- random files to install into $PREFIX/share/$MODULEDIR
31+
# DATA_built -- random files to install into $PREFIX/share/$MODULEDIR,
2432
# which need to be built first
2533
# DATA_TSEARCH -- random files to install into $PREFIX/share/tsearch_data
26-
# DOCS -- random files to install under $PREFIX/doc/contrib
34+
# DOCS -- random files to install under $PREFIX/doc/$MODULEDIR
2735
# SCRIPTS -- script files (not binaries) to install into $PREFIX/bin
2836
# SCRIPTS_built -- script files (not binaries) to install into $PREFIX/bin,
2937
# which need to be built first
3038
# REGRESS -- list of regression test cases (without suffix)
31-
#
32-
# or at most one of these two:
33-
#
34-
# PROGRAM -- a binary program to build (list objects files in OBJS)
35-
# MODULE_big -- a shared object to build (list object files in OBJS)
36-
#
37-
# The following can also be set:
38-
#
3939
# EXTRA_CLEAN -- extra files to remove in 'make clean'
4040
# PG_CPPFLAGS -- will be added to CPPFLAGS
4141
# PG_LIBS -- will be added to PROGRAM link line
@@ -71,6 +71,14 @@ override CFLAGS += $(CFLAGS_SL)
7171
SHLIB_LINK += $(BE_DLLLIBS)
7272
endif
7373

74+
ifdef MODULEDIR
75+
datamoduledir = $(MODULEDIR)
76+
docmoduledir = $(MODULEDIR)
77+
else
78+
datamoduledir = contrib
79+
docmoduledir = contrib
80+
endif
81+
7482
ifdef PG_CPPFLAGS
7583
override CPPFLAGS := $(PG_CPPFLAGS) $(CPPFLAGS)
7684
endif
@@ -90,8 +98,8 @@ endif # MODULE_big
9098
install: all installdirs
9199
ifneq (,$(DATA)$(DATA_built))
92100
@for file in $(addprefix $(srcdir)/, $(DATA)) $(DATA_built); do \
93-
echo "$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/contrib'"; \
94-
$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/contrib'; \
101+
echo "$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/$(datamoduledir)'"; \
102+
$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/$(datamoduledir)'; \
95103
done
96104
endif # DATA
97105
ifneq (,$(DATA_TSEARCH))
@@ -109,8 +117,8 @@ endif # MODULES
109117
ifdef DOCS
110118
ifdef docdir
111119
@for file in $(addprefix $(srcdir)/, $(DOCS)); do \
112-
echo "$(INSTALL_DATA) $$file '$(DESTDIR)$(docdir)/contrib'"; \
113-
$(INSTALL_DATA) $$file '$(DESTDIR)$(docdir)/contrib'; \
120+
echo "$(INSTALL_DATA) $$file '$(DESTDIR)$(docdir)/$(docmoduledir)'"; \
121+
$(INSTALL_DATA) $$file '$(DESTDIR)$(docdir)/$(docmoduledir)'; \
114122
done
115123
endif # docdir
116124
endif # DOCS
@@ -137,7 +145,7 @@ endif # MODULE_big
137145

138146
installdirs:
139147
ifneq (,$(DATA)$(DATA_built))
140-
$(MKDIR_P) '$(DESTDIR)$(datadir)/contrib'
148+
$(MKDIR_P) '$(DESTDIR)$(datadir)/$(datamoduledir)'
141149
endif
142150
ifneq (,$(DATA_TSEARCH))
143151
$(MKDIR_P) '$(DESTDIR)$(datadir)/tsearch_data'
@@ -147,7 +155,7 @@ ifneq (,$(MODULES))
147155
endif
148156
ifdef DOCS
149157
ifdef docdir
150-
$(MKDIR_P) '$(DESTDIR)$(docdir)/contrib'
158+
$(MKDIR_P) '$(DESTDIR)$(docdir)/$(docmoduledir)'
151159
endif # docdir
152160
endif # DOCS
153161
ifneq (,$(PROGRAM)$(SCRIPTS)$(SCRIPTS_built))
@@ -161,16 +169,16 @@ endif # MODULE_big
161169

162170
uninstall:
163171
ifneq (,$(DATA)$(DATA_built))
164-
rm -f $(addprefix '$(DESTDIR)$(datadir)'/contrib/, $(notdir $(DATA) $(DATA_built)))
172+
rm -f $(addprefix '$(DESTDIR)$(datadir)/$(datamoduledir)'/, $(notdir $(DATA) $(DATA_built)))
165173
endif
166174
ifneq (,$(DATA_TSEARCH))
167-
rm -f $(addprefix '$(DESTDIR)$(datadir)'/tsearch_data/, $(notdir $(DATA_TSEARCH)))
175+
rm -f $(addprefix '$(DESTDIR)$(datadir)/tsearch_data'/, $(notdir $(DATA_TSEARCH)))
168176
endif
169177
ifdef MODULES
170178
rm -f $(addprefix '$(DESTDIR)$(pkglibdir)'/, $(addsuffix $(DLSUFFIX), $(MODULES)))
171179
endif
172180
ifdef DOCS
173-
rm -f $(addprefix '$(DESTDIR)$(docdir)'/contrib/, $(DOCS))
181+
rm -f $(addprefix '$(DESTDIR)$(docdir)/$(docmoduledir)'/, $(DOCS))
174182
endif
175183
ifdef PROGRAM
176184
rm -f '$(DESTDIR)$(bindir)/$(PROGRAM)$(X)'

0 commit comments

Comments
 (0)