Skip to content

Commit 46e7637

Browse files
committed
Implement a few changes to how shared libraries and dynamically loadable
modules are built. Foremost, it creates a solid distinction between these two types of targets based on what had already been implemented and duplicated in ad hoc ways before. Specifically, - Dynamically loadable modules no longer get a soname. The numbers previously set in the makefiles were dummy numbers anyway, and the presence of a soname upset a few packaging tools, so it is nicer not to have one. - The cumbersome detour taken on installation (build a libfoo.so.0.0.0 and then override the rule to install foo.so instead) is removed. - Lots of duplicated code simplified.
1 parent 8deafd6 commit 46e7637

File tree

14 files changed

+204
-197
lines changed

14 files changed

+204
-197
lines changed

src/Makefile.shlib

+148-60
Large diffs are not rendered by default.

src/backend/snowball/Makefile

+5-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Makefile for src/backend/snowball
44
#
5-
# $PostgreSQL: pgsql/src/backend/snowball/Makefile,v 1.5 2008/03/18 16:24:50 petere Exp $
5+
# $PostgreSQL: pgsql/src/backend/snowball/Makefile,v 1.6 2008/04/07 14:15:58 petere Exp $
66
#
77
#-------------------------------------------------------------------------
88

@@ -77,11 +77,7 @@ else
7777
VPATH = $(srcdir)/libstemmer
7878
endif
7979

80-
SHLIB_LINK := $(BE_DLLLIBS)
81-
8280
NAME := dict_snowball
83-
SO_MAJOR_VERSION := 0
84-
SO_MINOR_VERSION := 0
8581
rpath =
8682

8783
all: all-shared-lib $(SQLSCRIPT)
@@ -116,10 +112,7 @@ else
116112
echo "-- No language-specific snowball dictionaries, for lack of shared library support" > $@
117113
endif
118114

119-
install: all installdirs
120-
ifeq ($(enable_shared), yes)
121-
$(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
122-
endif
115+
install: all installdirs install-lib
123116
$(INSTALL_DATA) $(SQLSCRIPT) '$(DESTDIR)$(datadir)'
124117
@set -e; \
125118
set $(LANGUAGES) ; \
@@ -131,11 +124,10 @@ endif
131124
fi \
132125
done
133126

134-
installdirs:
135-
$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)' '$(DESTDIR)$(datadir)' '$(DESTDIR)$(datadir)/$(DICTDIR)'
127+
installdirs: installdirs-lib
128+
$(mkinstalldirs) '$(DESTDIR)$(datadir)' '$(DESTDIR)$(datadir)/$(DICTDIR)'
136129

137-
uninstall:
138-
rm -f '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
130+
uninstall: uninstall-lib
139131
rm -f '$(DESTDIR)$(datadir)/$(SQLSCRIPT)'
140132
@set -e; \
141133
set $(LANGUAGES) ; \
+3-12
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11
SRCS += $(NAME).c
22
OBJS += $(NAME).o
33

4-
SHLIB_LINK := $(BE_DLLLIBS)
5-
6-
SO_MAJOR_VERSION := 0
7-
SO_MINOR_VERSION := 0
84
rpath =
95

106
all: all-shared-lib
117

128
include $(top_srcdir)/src/Makefile.shlib
139

14-
install: all installdirs
15-
ifeq ($(enable_shared), yes)
16-
$(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
17-
endif
10+
install: all installdirs install-lib
1811

19-
installdirs:
20-
$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
12+
installdirs: installdirs-lib
2113

22-
uninstall:
23-
rm -f '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
14+
uninstall: uninstall-lib
2415

2516
clean distclean maintainer-clean: clean-lib
2617
rm -f $(OBJS)

src/interfaces/ecpg/compatlib/Makefile

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.39 2008/02/26 06:41:23 petere Exp $
8+
# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.40 2008/04/07 14:15:58 petere Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -16,7 +16,6 @@ include $(top_builddir)/src/Makefile.global
1616
NAME= ecpg_compat
1717
SO_MAJOR_VERSION= 3
1818
SO_MINOR_VERSION= 1
19-
DLTYPE= library
2019

2120
override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
2221
-I$(libpq_srcdir) -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
@@ -42,8 +41,7 @@ snprintf.c: % : $(top_srcdir)/src/port/%
4241

4342
install: all installdirs install-lib
4443

45-
installdirs:
46-
$(mkinstalldirs) '$(DESTDIR)$(libdir)'
44+
installdirs: installdirs-lib
4745

4846
uninstall: uninstall-lib
4947

src/interfaces/ecpg/ecpglib/Makefile

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.58 2008/03/21 16:10:23 meskes Exp $
8+
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.59 2008/04/07 14:15:58 petere Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -16,7 +16,6 @@ include $(top_builddir)/src/Makefile.global
1616
NAME= ecpg
1717
SO_MAJOR_VERSION= 6
1818
SO_MINOR_VERSION= 1
19-
DLTYPE= library
2019

2120
override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
2221
-I$(libpq_srcdir) -I$(top_builddir)/src/port $(CPPFLAGS)
@@ -63,8 +62,7 @@ $(top_builddir)/src/port/pg_config_paths.h:
6362

6463
install: all installdirs install-lib
6564

66-
installdirs:
67-
$(mkinstalldirs) '$(DESTDIR)$(libdir)'
65+
installdirs: installdirs-lib
6866

6967
uninstall: uninstall-lib
7068

src/interfaces/ecpg/pgtypeslib/Makefile

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.41 2008/02/26 06:41:24 petere Exp $
8+
# $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.42 2008/04/07 14:15:58 petere Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -16,7 +16,6 @@ include $(top_builddir)/src/Makefile.global
1616
NAME= pgtypes
1717
SO_MAJOR_VERSION= 3
1818
SO_MINOR_VERSION= 1
19-
DLTYPE= library
2019

2120
override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
2221
-I$(top_srcdir)/src/include/utils -I$(libpq_srcdir) $(CPPFLAGS)
@@ -48,8 +47,7 @@ pgstrcasecmp.c rint.c snprintf.c: % : $(top_srcdir)/src/port/%
4847

4948
install: all installdirs install-lib
5049

51-
installdirs:
52-
$(mkinstalldirs) '$(DESTDIR)$(libdir)'
50+
installdirs: installdirs-lib
5351

5452
uninstall: uninstall-lib
5553

src/interfaces/libpq/Makefile

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.164 2008/03/05 05:39:11 tgl Exp $
8+
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.165 2008/04/07 14:15:58 petere Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -18,7 +18,6 @@ include $(top_builddir)/src/Makefile.global
1818
NAME= pq
1919
SO_MAJOR_VERSION= 5
2020
SO_MINOR_VERSION= 2
21-
DLTYPE= library
2221

2322
override CPPFLAGS := -DFRONTEND -I$(srcdir) $(CPPFLAGS) -I$(top_builddir)/src/port
2423
ifneq ($(PORTNAME), win32)
@@ -111,8 +110,8 @@ install: all installdirs install-lib
111110
$(INSTALL_DATA) $(srcdir)/pqexpbuffer.h '$(DESTDIR)$(includedir_internal)'
112111
$(INSTALL_DATA) $(srcdir)/pg_service.conf.sample '$(DESTDIR)$(datadir)/pg_service.conf.sample'
113112

114-
installdirs:
115-
$(mkinstalldirs) '$(DESTDIR)$(libdir)' '$(DESTDIR)$(includedir)' '$(DESTDIR)$(includedir_internal)'
113+
installdirs: installdirs-lib
114+
$(mkinstalldirs) '$(DESTDIR)$(includedir)' '$(DESTDIR)$(includedir_internal)'
116115

117116
uninstall: uninstall-lib
118117
rm -f '$(DESTDIR)$(includedir)/libpq-fe.h' '$(DESTDIR)$(includedir_internal)/libpq-int.h' '$(DESTDIR)$(includedir_internal)/pqexpbuffer.h' '$(DESTDIR)$(datadir)/pg_service.conf.sample'

src/makefiles/pgxs.mk

+14-12
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.11 2007/10/16 15:59:59 tgl Exp $
3+
# $PostgreSQL: pgsql/src/makefiles/pgxs.mk,v 1.12 2008/04/07 14:15:58 petere 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
@@ -80,10 +80,6 @@ all: $(PROGRAM) $(DATA_built) $(SCRIPTS_built) $(addsuffix $(DLSUFFIX), $(MODULE
8080
ifdef MODULE_big
8181
# shared library parameters
8282
NAME = $(MODULE_big)
83-
SO_MAJOR_VERSION= 0
84-
SO_MINOR_VERSION= 0
85-
86-
SHLIB_LINK += $(BE_DLLLIBS)
8783

8884
include $(top_srcdir)/src/Makefile.shlib
8985

@@ -121,9 +117,6 @@ endif # DOCS
121117
ifdef PROGRAM
122118
$(INSTALL_PROGRAM) $(PROGRAM)$(X) '$(DESTDIR)$(bindir)'
123119
endif # PROGRAM
124-
ifdef MODULE_big
125-
$(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/$(MODULE_big)$(DLSUFFIX)'
126-
endif # MODULE_big
127120
ifdef SCRIPTS
128121
@for file in $(addprefix $(srcdir)/, $(SCRIPTS)); do \
129122
echo "$(INSTALL_SCRIPT) $$file '$(DESTDIR)$(bindir)'"; \
@@ -137,6 +130,10 @@ ifdef SCRIPTS_built
137130
done
138131
endif # SCRIPTS_built
139132

133+
ifdef MODULE_big
134+
install: install-lib
135+
endif # MODULE_big
136+
140137

141138
installdirs:
142139
ifneq (,$(DATA)$(DATA_built))
@@ -145,7 +142,7 @@ endif
145142
ifneq (,$(DATA_TSEARCH))
146143
$(mkinstalldirs) '$(DESTDIR)$(datadir)/tsearch_data'
147144
endif
148-
ifneq (,$(MODULES)$(MODULE_big))
145+
ifneq (,$(MODULES))
149146
$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
150147
endif
151148
ifdef DOCS
@@ -157,6 +154,10 @@ ifneq (,$(PROGRAM)$(SCRIPTS)$(SCRIPTS_built))
157154
$(mkinstalldirs) '$(DESTDIR)$(bindir)'
158155
endif
159156

157+
ifdef MODULE_big
158+
installdirs: installdirs-lib
159+
endif # MODULE_big
160+
160161

161162
uninstall:
162163
ifneq (,$(DATA)$(DATA_built))
@@ -174,16 +175,17 @@ endif
174175
ifdef PROGRAM
175176
rm -f '$(DESTDIR)$(bindir)/$(PROGRAM)$(X)'
176177
endif
177-
ifdef MODULE_big
178-
rm -f '$(DESTDIR)$(pkglibdir)/$(MODULE_big)$(DLSUFFIX)'
179-
endif
180178
ifdef SCRIPTS
181179
rm -f $(addprefix '$(DESTDIR)$(bindir)'/, $(SCRIPTS))
182180
endif
183181
ifdef SCRIPTS_built
184182
rm -f $(addprefix '$(DESTDIR)$(bindir)'/, $(SCRIPTS_built))
185183
endif
186184

185+
ifdef MODULE_big
186+
uninstall: uninstall-lib
187+
endif # MODULE_big
188+
187189

188190
clean:
189191
ifdef MODULES

src/pl/plperl/GNUmakefile

+5-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Makefile for PL/Perl
2-
# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.33 2007/12/01 15:30:09 adunstan Exp $
2+
# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.34 2008/04/07 14:15:58 petere Exp $
33

44
subdir = src/pl/plperl
55
top_builddir = ../../..
@@ -32,12 +32,10 @@ rpathdir = $(perl_archlibexp)/CORE
3232

3333

3434
NAME = plperl
35-
SO_MAJOR_VERSION = 0
36-
SO_MINOR_VERSION = 0
3735

3836
OBJS = plperl.o spi_internal.o SPI.o
3937

40-
SHLIB_LINK = $(perl_embed_ldflags) $(BE_DLLLIBS)
38+
SHLIB_LINK = $(perl_embed_ldflags)
4139

4240
REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=plperl
4341
REGRESS = plperl plperl_trigger plperl_shared plperl_elog
@@ -73,20 +71,11 @@ $(test_files_build): $(abs_builddir)/%: $(srcdir)/%
7371

7472
endif
7573

76-
install: all installdirs
77-
ifeq ($(enable_shared), yes)
78-
$(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/plperl$(DLSUFFIX)'
79-
else
80-
@echo "*****"; \
81-
echo "* PL/Perl was not installed due to lack of shared library support."; \
82-
echo "*****"
83-
endif
74+
install: all installdirs install-lib
8475

85-
installdirs:
86-
$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
76+
installdirs: installdirs-lib
8777

88-
uninstall:
89-
rm -f '$(DESTDIR)$(pkglibdir)/plperl$(DLSUFFIX)'
78+
uninstall: uninstall-lib
9079

9180
installcheck: submake
9281
$(top_builddir)/src/test/regress/pg_regress --psqldir=$(PSQLDIR) $(REGRESS_OPTS) $(REGRESS)

src/pl/plpgsql/src/Makefile

+5-21
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Makefile for the plpgsql shared object
44
#
5-
# $PostgreSQL: pgsql/src/pl/plpgsql/src/Makefile,v 1.31 2007/07/15 22:18:24 tgl Exp $
5+
# $PostgreSQL: pgsql/src/pl/plpgsql/src/Makefile,v 1.32 2008/04/07 14:15:58 petere Exp $
66
#
77
#-------------------------------------------------------------------------
88

@@ -12,11 +12,9 @@ include $(top_builddir)/src/Makefile.global
1212

1313
# Shared library parameters
1414
NAME= plpgsql
15-
SO_MAJOR_VERSION= 1
16-
SO_MINOR_VERSION= 0
1715

1816
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
19-
SHLIB_LINK = $(filter -lintl, $(LIBS)) $(BE_DLLLIBS)
17+
SHLIB_LINK = $(filter -lintl, $(LIBS))
2018
rpath =
2119

2220
OBJS = pl_gram.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o
@@ -27,26 +25,12 @@ all: all-lib
2725
include $(top_srcdir)/src/Makefile.shlib
2826

2927

30-
# In order to use Makefile.shlib, we allow it to build a static
31-
# library libplpgsql.a, which we just ignore, as well as a shared
32-
# library that it will insist on naming $(shlib). We don't want to
33-
# call it that when installed, however, so we ignore the install-shlib
34-
# rule and do this instead:
28+
install: installdirs all install-lib
3529

36-
install: installdirs all
37-
ifeq ($(enable_shared), yes)
38-
$(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/plpgsql$(DLSUFFIX)'
39-
else
40-
@echo "*****"; \
41-
echo "* PL/pgSQL was not installed due to lack of shared library support."; \
42-
echo "*****"
43-
endif
30+
installdirs: installdirs-lib
4431

45-
installdirs:
46-
$(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
32+
uninstall: uninstall-lib
4733

48-
uninstall:
49-
rm -f '$(DESTDIR)$(pkglibdir)/plpgsql$(DLSUFFIX)'
5034

5135
# Force these dependencies to be known even without dependency info built:
5236
pl_gram.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o: plpgsql.h $(srcdir)/pl.tab.h

0 commit comments

Comments
 (0)