postgres.git / summary / log / commit / refs
commit 1c0bf372fa185278856970c4e80d7714570392d1
Author: Andrew Dunstan <andrew@dunslane.net>
Date: Sat Feb 01 21:14:15 2014 +0000
First released in: 9.4.0, 9.0.16, 9.1.12, 9.2.7, 9.3.3
Don't use deprecated dllwrap on Cygwin.
The preferred method is to use "cc -shared", and this allows binaries
to be rebased if required, unlike dllwrap.
Backpatch to 9.0 where we have buildfarm coverage.
There are still some issues with Cygwin, especially modern Cygwin, but
this helps us get closer to good support.
Marco Atzeri.
src/Makefile.shlib | 12 ++++++++++++
src/makefiles/Makefile.cygwin | 5 +----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index a01d10be042..d33422c0c73 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -308,6 +308,7 @@ ifeq ($(PORTNAME), unixware)
endif
ifeq ($(PORTNAME), cygwin)
+ LINK.shared = $(CC) -shared
ifdef SO_MAJOR_VERSION
shlib = cyg$(NAME)$(DLSUFFIX)
endif
@@ -398,6 +399,16 @@ else # PORTNAME == cygwin || PORTNAME == win32
# If SHLIB_EXPORTS is set, the rules below will build a .def file from
# that. Else we build a temporary one here.
+ifeq ($(PORTNAME), cygwin)
+$(shlib): $(OBJS) | $(SHLIB_PREREQS)
+ $(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(LDAP_LIBS_BE)
+
+$(stlib): $(OBJS) | $(SHLIB_PREREQS)
+ $(LINK.static) $@ $^
+ $(RANLIB) $@
+
+
+else
ifeq (,$(SHLIB_EXPORTS))
DLL_DEFFILE = lib$(NAME)dll.def
exports_file = $(DLL_DEFFILE)
@@ -414,6 +425,7 @@ $(shlib): $(OBJS) $(DLL_DEFFILE)
$(stlib): $(shlib) $(DLL_DEFFILE)
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib $@
+endif # PORTNAME == cygwin
endif # PORTNAME == cygwin || PORTNAME == win32
endif # enable_shared
diff --git a/src/makefiles/Makefile.cygwin b/src/makefiles/Makefile.cygwin
index 1a5bdc85cd8..44fa4055182 100644
--- a/src/makefiles/Makefile.cygwin
+++ b/src/makefiles/Makefile.cygwin
@@ -1,6 +1,5 @@
# $PostgreSQL: pgsql/src/makefiles/Makefile.cygwin,v 1.15 2010/07/05 23:15:56 tgl Exp $
DLLTOOL= dlltool
-DLLWRAP= dllwrap
ifdef PGXS
BE_DLLLIBS= -L$(libdir) -lpostgres
else
@@ -40,6 +39,4 @@ endif
# Rule for building a shared library from a single .o file
%.dll: %.o
- $(DLLTOOL) --export-all --output-def $*.def $<
- $(DLLWRAP) -o $@ --def $*.def $< $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)
- rm -f $*.def
+ $(CC) $(CFLAGS) -shared -o $@ $< $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)
[parent: 59d64e7f3010]