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

Commit 264f8f2

Browse files
committed
Install dynamically loadable modules into a private subdirectory
under libdir, for a cleaner separation in the installation layout and compatibility with binary packaging standards. Point backend's default search location there. The contrib modules are also installed in the said location, giving them the benefit of the default search path as well. No changes in user interface nevertheless.
1 parent d20a50d commit 264f8f2

File tree

21 files changed

+123
-88
lines changed

21 files changed

+123
-88
lines changed

contrib/contrib-global.mk

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Header: /cvsroot/pgsql/contrib/contrib-global.mk,v 1.1 2001/09/06 10:49:29 petere Exp $
1+
# $Header: /cvsroot/pgsql/contrib/contrib-global.mk,v 1.2 2001/09/16 16:11:08 petere Exp $
22

33
# This file contains generic rules to build many kinds of simple
44
# contrib modules. You only need to set a few variables and include
@@ -78,8 +78,8 @@ ifneq (,$(DATA)$(DATA_built))
7878
endif # DATA
7979
ifdef MODULES
8080
@for file in $(addsuffix $(DLSUFFIX), $(MODULES)); do \
81-
echo "$(INSTALL_SHLIB) $$file $(DESTDIR)$(libdir)/contrib"; \
82-
$(INSTALL_SHLIB) $$file $(DESTDIR)$(libdir)/contrib; \
81+
echo "$(INSTALL_SHLIB) $$file $(DESTDIR)$(pkglibdir)"; \
82+
$(INSTALL_SHLIB) $$file $(DESTDIR)$(pkglibdir); \
8383
done
8484
endif # MODULES
8585
ifdef DOCS
@@ -92,12 +92,12 @@ ifdef PROGRAM
9292
$(INSTALL_PROGRAM) $(PROGRAM)$(X) $(DESTDIR)$(bindir)
9393
endif # PROGRAM
9494
ifdef MODULE_big
95-
$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(libdir)/contrib/$(MODULE_big)$(DLSUFFIX)
95+
$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/$(MODULE_big)$(DLSUFFIX)
9696
endif # MODULE_big
9797
ifdef SCRIPTS
9898
@for file in $(addprefix $(srcdir)/, $(SCRIPTS)); do \
9999
echo "$(INSTALL_SCRIPT) $$file $(DESTDIR)$(bindir)"; \
100-
$(INSTALL_DATA) $$file $(DESTDIR)$(bindir); \
100+
$(INSTALL_SCRIPT) $$file $(DESTDIR)$(bindir); \
101101
done
102102
endif # SCRIPTS
103103

@@ -107,7 +107,7 @@ ifneq (,$(DATA)$(DATA_built))
107107
$(mkinstalldirs) $(DESTDIR)$(datadir)/contrib
108108
endif
109109
ifneq (,$(MODULES)$(MODULE_big))
110-
$(mkinstalldirs) $(DESTDIR)$(libdir)/contrib
110+
$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
111111
endif
112112
ifdef DOCS
113113
$(mkinstalldirs) $(DESTDIR)$(docdir)/contrib
@@ -122,7 +122,7 @@ ifneq (,$(DATA)$(DATA_built))
122122
rm -f $(addprefix $(DESTDIR)$(datadir)/contrib/, $(DATA) $(DATA_built))
123123
endif
124124
ifdef MODULES
125-
rm -f $(addprefix $(DESTDIR)$(libdir)/contrib/, $(addsuffix $(DLSUFFIX), $(MODULES)))
125+
rm -f $(addprefix $(DESTDIR)$(pkglibdir)/, $(addsuffix $(DLSUFFIX), $(MODULES)))
126126
endif
127127
ifdef DOCS
128128
rm -f $(addprefix $(DESTDIR)$(docdir)/contrib/, $(DOCS))
@@ -131,7 +131,7 @@ ifdef PROGRAM
131131
rm -f $(DESTDIR)$(bindir)/$(PROGRAM)$(X)
132132
endif
133133
ifdef MODULE_big
134-
rm -f $(DESTDIR)$(libdir)/contrib/$(MODULE_big)$(DLSUFFIX)
134+
rm -f $(DESTDIR)$(pkglibdir)/$(MODULE_big)$(DLSUFFIX)
135135
endif
136136
ifdef SCRIPTS
137137
rm -f $(addprefix $(DESTDIR)$(bindir)/, $(SCRIPTS))
@@ -193,7 +193,7 @@ endif # REGRESS
193193

194194
ifneq (,$(MODULES)$(MODULE_big))
195195
%.sql: %.sql.in
196-
sed 's,MODULE_PATHNAME,$(libdir)/contrib/$*,g' $< >$@
196+
sed 's,MODULE_PATHNAME,$$libdir/$*,g' $< >$@
197197
endif
198198

199199
ifdef PROGRAM

contrib/pgcrypto/Makefile

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# $Header: /cvsroot/pgsql/contrib/pgcrypto/Makefile,v 1.5 2001/08/21 00:42:41 momjian Exp $
2+
# $Header: /cvsroot/pgsql/contrib/pgcrypto/Makefile,v 1.6 2001/09/16 16:11:09 petere Exp $
33
#
44

55
subdir = contrib/pgcrypto
@@ -47,13 +47,14 @@ SO_MINOR_VERSION = 1
4747

4848
override CPPFLAGS += $(CRYPTO_CFLAGS) -I$(srcdir)
4949
override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
50+
rpath :=
5051

5152
all: all-lib $(NAME).sql
5253

5354
include $(top_srcdir)/src/Makefile.shlib
5455

5556
$(NAME).sql: $(NAME).sql.in
56-
sed 's,@MODULE_FILENAME@,$(libdir)/contrib/pgcrypto$(DLSUFFIX),g' $< >$@
57+
sed 's,@MODULE_FILENAME@,$$libdir/$(NAME),g' $< >$@
5758

5859
rijndael.o: rijndael.tbl
5960

@@ -62,15 +63,15 @@ rijndael.tbl:
6263
./gen-rtab > rijndael.tbl
6364

6465
install: all installdirs
65-
$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(libdir)/contrib/pgcrypto$(DLSUFFIX)
66+
$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/pgcrypto$(DLSUFFIX)
6667
$(INSTALL_DATA) $(NAME).sql $(DESTDIR)$(datadir)/contrib/$(NAME).sql
6768
$(INSTALL_DATA) README.$(NAME) $(DESTDIR)$(docdir)/contrib/README.$(NAME)
6869

6970
installdirs:
70-
$(mkinstalldirs) $(libdir)/contrib $(datadir)/contrib $(docdir)/contrib
71+
$(mkinstalldirs) $(pkglibdir) $(datadir)/contrib $(docdir)/contrib
7172

7273
uninstall: uninstall-lib
73-
rm -f $(DESTDIR)$(libdir)/contrib/pgcrypto$(DLSUFFIX) $(datadir)/contrib/$(NAME).sql $(docdir)/contrib/README.$(NAME)
74+
rm -f $(DESTDIR)$(pkglibdir)/pgcrypto$(DLSUFFIX) $(datadir)/contrib/$(NAME).sql $(docdir)/contrib/README.$(NAME)
7475

7576
clean distclean maintainer-clean: clean-lib
7677
rm -f $(OBJS) $(NAME).sql gen-rtab

contrib/rserv/Makefile

+7-9
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@ override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
2222
all: $(SQLS) $(TCLS) $(PERLS) $(SCRIPTS) $(SONAME)
2323

2424
%.sql: %.sql.in
25-
sed -e "s:_OBJWD_:$(libdir)/contrib:g" \
26-
-e "s:_DLSUFFIX_:$(DLSUFFIX):g" $< >$@
25+
sed 's,@MODULE_FILENAME@,$$libdir/$(NAME),g' $< >$@
2726

2827
$(PERLS) $(TCLS) $(SCRIPTS): %: %.in
29-
sed -e "s:_OBJWD_:$(libdir)/contrib:g" \
30-
-e "s:_DLSUFFIX_:$(DLSUFFIX):g" \
31-
-e "s:@SQLDIR@:$(datadir)/contrib:g" \
32-
-e "s:@BINDIR@:$(bindir):g" \
33-
-e "s:@LIBDIR@:$(datadir)/contrib:g" $< >$@
28+
sed -e 's,@MODULE_FILENAME@,$$libdir/$(NAME),g' \
29+
-e 's:@SQLDIR@:$(datadir)/contrib:g' \
30+
-e 's:@BINDIR@:$(bindir):g' \
31+
-e 's:@LIBDIR@:$(datadir)/contrib:g' $< >$@
3432
chmod a+x $@
3533

3634

@@ -42,12 +40,12 @@ install: all installdirs
4240
$(INSTALL_SCRIPT) $$file $(DESTDIR)$(bindir) || exit ; \
4341
done
4442
$(INSTALL_DATA) $(srcdir)/RServ.pm $(DESTDIR)$(datadir)/contrib
45-
$(INSTALL_SHLIB) $(SONAME) $(DESTDIR)$(libdir)/contrib
43+
$(INSTALL_SHLIB) $(SONAME) $(DESTDIR)$(pkglibdir)
4644
$(INSTALL_DATA) $(srcdir)/README.$(NAME) $(DESTDIR)$(docdir)/contrib
4745

4846
installdirs:
4947
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(datadir)/contrib \
50-
$(DESTDIR)$(libdir)/contrib $(DESTDIR)$(docdir)/contrib
48+
$(DESTDIR)$(pkglibdir) $(DESTDIR)$(docdir)/contrib
5149

5250

5351
clean distclean maintainer-clean:

contrib/rserv/MasterInit.in

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ $result = $conn->exec("create sequence _rserv_sync_seq_");
9090
RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK);
9191

9292
$result = $conn->exec("CREATE FUNCTION _rserv_log_() RETURNS opaque" .
93-
" AS '_OBJWD_/rserv_DLSUFFIX_' LANGUAGE 'c'");
93+
" AS '@MODULE_FILENAME@' LANGUAGE 'c'");
9494
RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK);
9595

9696
$result = $conn->exec("CREATE FUNCTION _rserv_sync_(int4) RETURNS int4" .
97-
" AS '_OBJWD_/rserv_DLSUFFIX_' LANGUAGE 'c'");
97+
" AS '@MODULE_FILENAME@' LANGUAGE 'c'");
9898
RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK);
9999

100100
$result = $conn->exec("CREATE FUNCTION _rserv_debug_(int4) RETURNS int4" .
101-
" AS '_OBJWD_/rserv_DLSUFFIX_' LANGUAGE 'c'");
101+
" AS '@MODULE_FILENAME@' LANGUAGE 'c'");
102102
RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK);
103103

104104
$result = $conn->exec("COMMIT");

contrib/rserv/master.sql.in

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,22 @@ drop function _rserv_log_();
8080

8181
CREATE FUNCTION _rserv_log_()
8282
RETURNS opaque
83-
AS '_OBJWD_/rserv_DLSUFFIX_'
83+
AS '@MODULE_FILENAME@'
8484
LANGUAGE 'c'
8585
;
8686

8787
drop function _rserv_sync_(int4);
8888

8989
CREATE FUNCTION _rserv_sync_(int4)
9090
RETURNS int4
91-
AS '_OBJWD_/rserv_DLSUFFIX_'
91+
AS '@MODULE_FILENAME@'
9292
LANGUAGE 'c'
9393
;
9494

9595
drop function _rserv_debug_(int4);
9696

9797
CREATE FUNCTION _rserv_debug_(int4)
9898
RETURNS int4
99-
AS '_OBJWD_/rserv_DLSUFFIX_'
99+
AS '@MODULE_FILENAME@'
100100
LANGUAGE 'c'
101101
;

doc/src/sgml/installation.sgml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.55 2001/09/12 20:57:28 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.56 2001/09/16 16:11:09 petere Exp $ -->
22

33
<chapter id="installation">
44
<title><![%flattext-install-include[<productname>PostgreSQL</>]]>
@@ -471,9 +471,11 @@ su - postgres
471471
<varname>includedir</varname> and are namespace-clean. The
472472
internal header files and the server header files are installed
473473
into private directories under
474-
<filename><replaceable>includedir</replaceable>/postgresql</filename>.
474+
<varname>includedir</varname>.
475475
See the <citetitle>Programmer's Guide</citetitle> for
476476
information how to get at the header files for each interface.
477+
Finally, a private subdirectory will also be created, if appropriate,
478+
under <varname>libdir</varname> for dynamically loadable modules.
477479
</para>
478480
</note>
479481
</para>

doc/src/sgml/ref/pg_config-ref.sgml

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_config-ref.sgml,v 1.7 2001/09/03 12:57:50 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_config-ref.sgml,v 1.8 2001/09/16 16:11:09 petere Exp $ -->
22

33
<refentry id="app-pgconfig">
44
<docinfo>
@@ -24,6 +24,7 @@
2424
<arg>--includedir</arg>
2525
<arg>--includedir-server</arg>
2626
<arg>--libdir</arg>
27+
<arg>--pkglibdir</arg>
2728
<arg>--configure</arg>
2829
<arg>--version</arg>
2930
</group>
@@ -87,6 +88,18 @@
8788
</listitem>
8889
</varlistentry>
8990

91+
<varlistentry>
92+
<term>--pkglibdir</>
93+
<listitem>
94+
<para>
95+
Print the location of dynamically loadable modules, or where
96+
the server would search for them. (Other
97+
architecture-dependent data files may also be installed in this
98+
directory.)
99+
</para>
100+
</listitem>
101+
</varlistentry>
102+
90103
<varlistentry>
91104
<term>--configure</>
92105
<listitem>

doc/src/sgml/runtime.sgml

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.79 2001/09/13 15:55:23 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.80 2001/09/16 16:11:09 petere Exp $
33
-->
44

55
<Chapter Id="runtime">
@@ -1047,12 +1047,13 @@ env PGOPTIONS='-c geqo=off' psql
10471047
The value for dynamic_library_path has to be a colon-separated
10481048
list of absolute directory names. If a directory name starts
10491049
with the special value <literal>$libdir</literal>, the
1050-
compiled-in PostgreSQL library directory, which is where the
1050+
compiled-in PostgreSQL package library directory, which is where the
10511051
modules provided by the PostgreSQL distribution are installed,
1052-
is substituted. An example value:
1052+
is substituted. (Use <literal>pg_config --pkglibdir</literal>
1053+
to print the name of this directory.) An example value:
10531054
<informalexample>
10541055
<programlisting>
1055-
dynamic_library_path = '/usr/local/lib:/home/my_project/lib:$libdir:$libdir/contrib'
1056+
dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
10561057
</programlisting>
10571058
</informalexample>
10581059
</para>

doc/src/sgml/xfunc.sgml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.37 2001/09/15 19:56:59 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.38 2001/09/16 16:11:09 petere Exp $
33
-->
44

55
<chapter id="xfunc">
@@ -466,7 +466,7 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision
466466
<listitem>
467467
<para>
468468
If the name starts with the string <literal>$libdir</literal>,
469-
that part is replaced by the PostgreSQL library directory,
469+
that part is replaced by the PostgreSQL package library directory,
470470
which is determined at build time.
471471
</para>
472472
</listitem>
@@ -516,7 +516,9 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision
516516
It is recommended to locate shared libraries either relative to
517517
<literal>$libdir</literal> or through the dynamic library path.
518518
This simplifies version upgrades if the new installation is at a
519-
different location.
519+
different location. The actual directory that
520+
<literal>$libdir</literal> stands for can be found out with the
521+
command <literal>pg_config --pkglibdir</literal>.
520522
</para>
521523

522524
<note>

src/Makefile.global.in

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*-makefile-*-
2-
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.136 2001/08/29 19:14:39 petere Exp $
2+
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.137 2001/09/16 16:11:09 petere Exp $
33

44
#------------------------------------------------------------------------------
55
# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -80,10 +80,20 @@ endif
8080
endif
8181

8282
libdir := @libdir@
83-
pkglibdir = $(libdir)/postgresql
83+
pkglibdir = $(libdir)
84+
ifeq "$(findstring pgsql, $(pkglibdir))" ""
85+
ifeq "$(findstring postgres, $(pkglibdir))" ""
86+
override pkglibdir := $(pkglibdir)/postgresql
87+
endif
88+
endif
8489

8590
includedir := @includedir@
86-
pkgincludedir = $(includedir)/postgresql
91+
pkgincludedir = $(includedir)
92+
ifeq "$(findstring pgsql, $(pkgincludedir))" ""
93+
ifeq "$(findstring postgres, $(pkgincludedir))" ""
94+
override pkgincludedir := $(pkgincludedir)/postgresql
95+
endif
96+
endif
8797
includedir_server = $(pkgincludedir)/server
8898
includedir_internal = $(pkgincludedir)/internal
8999

src/backend/Makefile

+17-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.73 2001/06/02 18:25:17 petere Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.74 2001/09/16 16:11:10 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -136,28 +136,36 @@ ifeq ($(enable_nls), yes)
136136
$(MAKE) -C po $@
137137
endif
138138

139-
installdirs:
140-
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(datadir)
141-
ifeq ($(enable_nls), yes)
142-
$(MAKE) -C po $@
143-
endif
144-
145139
install-bin: postgres $(POSTGRES_IMP) installdirs
146140
$(INSTALL_PROGRAM) postgres$(X) $(DESTDIR)$(bindir)/postgres$(X)
147141
@rm -f $(DESTDIR)$(bindir)/postmaster
148142
ln -s postgres$(X) $(DESTDIR)$(bindir)/postmaster
149143
ifeq ($(MAKE_EXPORTS), true)
150-
$(INSTALL_DATA) $(POSTGRES_IMP) $(DESTDIR)$(libdir)/$(POSTGRES_IMP)
144+
$(INSTALL_DATA) $(POSTGRES_IMP) $(DESTDIR)$(pkglibdir)/$(POSTGRES_IMP)
151145
endif
152146

153147
.PHONY: install-bin
154148

149+
installdirs:
150+
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(datadir)
151+
ifeq ($(PORTNAME), win)
152+
ifeq ($(MAKE_DLL), true)
153+
$(mkinstalldirs) $(DESTDIR)$(libdir)
154+
endif
155+
endif
156+
ifeq ($(MAKE_EXPORTS), true)
157+
$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
158+
endif
159+
ifeq ($(enable_nls), yes)
160+
$(MAKE) -C po $@
161+
endif
162+
155163
##########################################################################
156164

157165
uninstall:
158166
rm -f $(DESTDIR)$(bindir)/postgres$(X) $(DESTDIR)$(bindir)/postmaster
159167
ifeq ($(MAKE_EXPORTS), true)
160-
rm -f $(DESTDIR)$(libdir)/$(POSTGRES_IMP)
168+
rm -f $(DESTDIR)$(pkglibdir)/$(POSTGRES_IMP)
161169
endif
162170
ifeq ($(PORTNAME), win)
163171
ifeq ($(MAKE_DLL), true)

0 commit comments

Comments
 (0)