summaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorTom Lane2018-09-28 18:28:19 +0000
committerTom Lane2018-09-28 18:28:19 +0000
commit7143b3e82136d2941b3394168940d895a29b4f36 (patch)
tree6cd206756ab28e4d76d7d48d073ec0f3cddec8af /src/interfaces
parentf7ab802855200df5529a6e1e7b748d7926acace8 (diff)
Build src/common files as a library with -fPIC.
Build a third version of libpgcommon.a, with -fPIC and -DFRONTEND, as commit ea53100d5 did for src/port. Use that in libpq to avoid symlinking+rebuilding source files retail. Also adjust ecpg to use the new src/port and src/common libraries. Arrange to install these libraries, too, to simplify out-of-tree builds of shared libraries that need any of these modules. Discussion: https://postgr.es/m/13022.1538003440@sss.pgh.pa.us Discussion: https://postgr.es/m/E1g5Y8r-0006vs-QA@gemulon.postgresql.org
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/ecpg/compatlib/.gitignore4
-rw-r--r--src/interfaces/ecpg/compatlib/Makefile13
-rw-r--r--src/interfaces/ecpg/ecpglib/.gitignore9
-rw-r--r--src/interfaces/ecpg/ecpglib/Makefile27
-rw-r--r--src/interfaces/ecpg/pgtypeslib/.gitignore7
-rw-r--r--src/interfaces/ecpg/pgtypeslib/Makefile20
-rw-r--r--src/interfaces/libpq/.gitignore9
-rw-r--r--src/interfaces/libpq/Makefile22
8 files changed, 17 insertions, 94 deletions
diff --git a/src/interfaces/ecpg/compatlib/.gitignore b/src/interfaces/ecpg/compatlib/.gitignore
index d81829ce5a..926385c6b9 100644
--- a/src/interfaces/ecpg/compatlib/.gitignore
+++ b/src/interfaces/ecpg/compatlib/.gitignore
@@ -1,7 +1,3 @@
/compatlib.def
/blibecpg_compatdll.def
/exports.list
-/snprintf.c
-/strerror.c
-/strlcpy.c
-/strnlen.c
diff --git a/src/interfaces/ecpg/compatlib/Makefile b/src/interfaces/ecpg/compatlib/Makefile
index f6a7f2178e..092e456f42 100644
--- a/src/interfaces/ecpg/compatlib/Makefile
+++ b/src/interfaces/ecpg/compatlib/Makefile
@@ -22,17 +22,13 @@ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(libpq_srcdir) -DFRONTEND $(CPPFLAGS)
override CFLAGS += $(PTHREAD_CFLAGS)
-SHLIB_LINK_INTERNAL = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes $(libpq)
+SHLIB_LINK_INTERNAL = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes $(libpq_pgport_shlib)
SHLIB_LINK = $(filter -lintl -lm, $(LIBS)) $(PTHREAD_LIBS)
SHLIB_PREREQS = submake-ecpglib submake-pgtypeslib
SHLIB_EXPORTS = exports.txt
-# Need to recompile any libpgport object files
-LIBS := $(filter-out -lpgport, $(LIBS))
-
-OBJS= informix.o snprintf.o strerror.o \
- $(filter strlcpy.o strnlen.o, $(LIBOBJS)) $(WIN32RES)
+OBJS= informix.o $(WIN32RES)
PKG_CONFIG_REQUIRES_PRIVATE = libecpg libpgtypes
@@ -49,9 +45,6 @@ submake-pgtypeslib:
# Shared library stuff
include $(top_srcdir)/src/Makefile.shlib
-snprintf.c strerror.c strlcpy.c strnlen.c: % : $(top_srcdir)/src/port/%
- rm -f $@ && $(LN_S) $< .
-
install: all installdirs install-lib
installdirs: installdirs-lib
@@ -59,6 +52,6 @@ installdirs: installdirs-lib
uninstall: uninstall-lib
clean distclean: clean-lib
- rm -f $(OBJS) snprintf.c strerror.c strlcpy.c strnlen.c
+ rm -f $(OBJS)
maintainer-clean: distclean maintainer-clean-lib
diff --git a/src/interfaces/ecpg/ecpglib/.gitignore b/src/interfaces/ecpg/ecpglib/.gitignore
index 545c106a9e..f2bf3e7a4a 100644
--- a/src/interfaces/ecpg/ecpglib/.gitignore
+++ b/src/interfaces/ecpg/ecpglib/.gitignore
@@ -1,12 +1,3 @@
/ecpglib.def
/blibecpgdll.def
/exports.list
-/path.c
-/pgstrcasecmp.c
-/snprintf.c
-/strerror.c
-/strlcpy.c
-/strnlen.c
-/thread.c
-/win32setlocale.c
-/isinf.c
diff --git a/src/interfaces/ecpg/ecpglib/Makefile b/src/interfaces/ecpg/ecpglib/Makefile
index b381623f18..3b0f39c671 100644
--- a/src/interfaces/ecpg/ecpglib/Makefile
+++ b/src/interfaces/ecpg/ecpglib/Makefile
@@ -22,20 +22,10 @@ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(libpq_srcdir) -I$(top_builddir)/src/port -DFRONTEND $(CPPFLAGS)
override CFLAGS += $(PTHREAD_CFLAGS)
-# Need to recompile any libpgport object files
-LIBS := $(filter-out -lpgport, $(LIBS))
+OBJS= execute.o typename.o descriptor.o sqlda.o data.o error.o prepare.o \
+ memory.o connect.o misc.o $(WIN32RES)
-OBJS= execute.o typename.o descriptor.o sqlda.o data.o error.o prepare.o memory.o \
- connect.o misc.o path.o pgstrcasecmp.o snprintf.o strerror.o \
- $(filter strlcpy.o strnlen.o win32setlocale.o isinf.o, $(LIBOBJS)) \
- $(WIN32RES)
-
-# thread.c is needed only for non-WIN32 implementation of path.c
-ifneq ($(PORTNAME), win32)
-OBJS += thread.o
-endif
-
-SHLIB_LINK_INTERNAL = -L../pgtypeslib -lpgtypes $(libpq)
+SHLIB_LINK_INTERNAL = -L../pgtypeslib -lpgtypes $(libpq_pgport_shlib)
SHLIB_LINK = $(filter -lintl -lm, $(LIBS)) $(PTHREAD_LIBS)
SHLIB_PREREQS = submake-libpq submake-pgtypeslib
@@ -52,16 +42,8 @@ submake-pgtypeslib:
# Shared library stuff
include $(top_srcdir)/src/Makefile.shlib
-# We use some port modules verbatim, but since we need to
-# compile with appropriate options to build a shared lib, we can't
-# necessarily use the same object files as the backend uses. Instead,
-# symlink the source files in here and build our own object file.
-
-path.c pgstrcasecmp.c snprintf.c strerror.c strlcpy.c strnlen.c thread.c win32setlocale.c isinf.c: % : $(top_srcdir)/src/port/%
- rm -f $@ && $(LN_S) $< .
-
+# Make dependency on pg_config_paths.h visible.
misc.o: misc.c $(top_builddir)/src/port/pg_config_paths.h
-path.o: path.c $(top_builddir)/src/port/pg_config_paths.h
$(top_builddir)/src/port/pg_config_paths.h:
$(MAKE) -C $(top_builddir)/src/port pg_config_paths.h
@@ -74,6 +56,5 @@ uninstall: uninstall-lib
clean distclean: clean-lib
rm -f $(OBJS)
- rm -f path.c pgstrcasecmp.c snprintf.c strerror.c strlcpy.c strnlen.c thread.c win32setlocale.c isinf.c
maintainer-clean: distclean maintainer-clean-lib
diff --git a/src/interfaces/ecpg/pgtypeslib/.gitignore b/src/interfaces/ecpg/pgtypeslib/.gitignore
index 333b2817f8..91402ad88b 100644
--- a/src/interfaces/ecpg/pgtypeslib/.gitignore
+++ b/src/interfaces/ecpg/pgtypeslib/.gitignore
@@ -1,10 +1,3 @@
/pgtypeslib.def
/blibpgtypesdll.def
/exports.list
-/pgstrcasecmp.c
-/rint.c
-/snprintf.c
-/strerror.c
-/strlcpy.c
-/string.c
-/strnlen.c
diff --git a/src/interfaces/ecpg/pgtypeslib/Makefile b/src/interfaces/ecpg/pgtypeslib/Makefile
index 874c1a9fad..c1b41636ac 100644
--- a/src/interfaces/ecpg/pgtypeslib/Makefile
+++ b/src/interfaces/ecpg/pgtypeslib/Makefile
@@ -22,17 +22,12 @@ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-DFRONTEND $(CPPFLAGS)
override CFLAGS += $(PTHREAD_CFLAGS)
-# Need to recompile any libpgport object files
-LIBS := $(filter-out -lpgport, $(LIBS))
-
+SHLIB_LINK_INTERNAL = -lpgcommon_shlib -lpgport_shlib
SHLIB_LINK += $(filter -lintl -lm, $(LIBS))
SHLIB_EXPORTS = exports.txt
OBJS= numeric.o datetime.o common.o dt_common.o timestamp.o interval.o \
- pgstrcasecmp.o snprintf.o strerror.o \
- $(filter rint.o strlcpy.o strnlen.o, $(LIBOBJS)) \
- string.o \
$(WIN32RES)
all: all-lib
@@ -40,17 +35,6 @@ all: all-lib
# Shared library stuff
include $(top_srcdir)/src/Makefile.shlib
-# We use some port modules verbatim, but since we need to
-# compile with appropriate options to build a shared lib, we can't
-# necessarily use the same object files as the backend uses. Instead,
-# symlink the source files in here and build our own object file.
-
-pgstrcasecmp.c rint.c snprintf.c strerror.c strlcpy.c strnlen.c: % : $(top_srcdir)/src/port/%
- rm -f $@ && $(LN_S) $< .
-
-string.c: % : $(top_srcdir)/src/common/%
- rm -f $@ && $(LN_S) $< .
-
install: all installdirs install-lib
installdirs: installdirs-lib
@@ -58,6 +42,6 @@ installdirs: installdirs-lib
uninstall: uninstall-lib
clean distclean: clean-lib
- rm -f $(OBJS) pgstrcasecmp.c rint.c snprintf.c strerror.c strlcpy.c strnlen.c string.c
+ rm -f $(OBJS)
maintainer-clean: distclean maintainer-clean-lib
diff --git a/src/interfaces/libpq/.gitignore b/src/interfaces/libpq/.gitignore
index 8885e91e53..9be338dec8 100644
--- a/src/interfaces/libpq/.gitignore
+++ b/src/interfaces/libpq/.gitignore
@@ -1,14 +1,5 @@
/exports.list
/libpq.rc
# .c files that are symlinked in from elsewhere
-/ip.c
-/md5.c
-/base64.c
-/link-canary.c
-/scram-common.c
-/sha2.c
-/sha2_openssl.c
-/saslprep.c
-/unicode_norm.c
/encnames.c
/wchar.c
diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile
index 769c58b386..9ac06874b8 100644
--- a/src/interfaces/libpq/Makefile
+++ b/src/interfaces/libpq/Makefile
@@ -32,13 +32,9 @@ OBJS= fe-auth.o fe-auth-scram.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-l
# src/backend/utils/mb
OBJS += encnames.o wchar.o
-# src/common
-OBJS += base64.o ip.o link-canary.o md5.o scram-common.o saslprep.o unicode_norm.o
ifeq ($(with_openssl),yes)
-OBJS += fe-secure-openssl.o fe-secure-common.o sha2_openssl.o
-else
-OBJS += sha2.o
+OBJS += fe-secure-openssl.o fe-secure-common.o
endif
ifeq ($(PORTNAME), cygwin)
@@ -59,12 +55,14 @@ endif
# Add libraries that libpq depends (or might depend) on into the
# shared library link. (The order in which you list them here doesn't
-# matter.) Note that we filter out -lpgport from LIBS and instead
-# insert -lpgport_shlib, to get port files that are built correctly.
+# matter.) Note that we filter out -lpgcommon and -lpgport from LIBS and
+# instead link with -lpgcommon_shlib and -lpgport_shlib, to get object files
+# that are built correctly for use in a shlib.
+SHLIB_LINK_INTERNAL = -lpgcommon_shlib -lpgport_shlib
ifneq ($(PORTNAME), win32)
-SHLIB_LINK += -lpgport_shlib $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi_krb5 -lgss -lgssapi -lssl -lsocket -lnsl -lresolv -lintl -lm, $(LIBS)) $(LDAP_LIBS_FE) $(PTHREAD_LIBS)
+SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi_krb5 -lgss -lgssapi -lssl -lsocket -lnsl -lresolv -lintl -lm, $(LIBS)) $(LDAP_LIBS_FE) $(PTHREAD_LIBS)
else
-SHLIB_LINK += -lpgport_shlib $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi32 -lssl -lsocket -lnsl -lresolv -lintl -lm $(PTHREAD_LIBS), $(LIBS)) $(LDAP_LIBS_FE)
+SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi32 -lssl -lsocket -lnsl -lresolv -lintl -lm $(PTHREAD_LIBS), $(LIBS)) $(LDAP_LIBS_FE)
endif
ifeq ($(PORTNAME), win32)
SHLIB_LINK += -lshell32 -lws2_32 -lsecur32 $(filter -leay32 -lssleay32 -lcomerr32 -lkrb5_32, $(LIBS))
@@ -87,9 +85,6 @@ backend_src = $(top_srcdir)/src/backend
# Instead, symlink the source files in here and build our own object files.
# When you add a file here, remember to add it in the "clean" target below.
-ip.c md5.c base64.c link-canary.c scram-common.c sha2.c sha2_openssl.c saslprep.c unicode_norm.c: % : $(top_srcdir)/src/common/%
- rm -f $@ && $(LN_S) $< .
-
encnames.c wchar.c: % : $(backend_src)/utils/mb/%
rm -f $@ && $(LN_S) $< .
@@ -136,8 +131,7 @@ clean distclean: clean-lib
rm -f $(OBJS) pthread.h libpq.rc
# Might be left over from a Win32 client-only build
rm -f pg_config_paths.h
-# Remove files we (may have) symlinked in from src/common and other places
- rm -f ip.c md5.c base64.c link-canary.c scram-common.c sha2.c sha2_openssl.c saslprep.c unicode_norm.c
+# Remove files we (may have) symlinked in from other places
rm -f encnames.c wchar.c
maintainer-clean: distclean maintainer-clean-lib