aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2014-02-01 16:13:32 -0500
committerAndrew Dunstan <andrew@dunslane.net>2014-02-01 16:13:32 -0500
commit27942baf49eb3a939dde14cb81f254fbdf2b1816 (patch)
tree3da684ab55b601db0c6c1fe9290c965d46b3125c
parent1e9876c3b69491906cfcd542ebc8c79e91df6904 (diff)
downloadpostgresql-27942baf49eb3a939dde14cb81f254fbdf2b1816.tar.gz
postgresql-27942baf49eb3a939dde14cb81f254fbdf2b1816.zip
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.
-rw-r--r--src/Makefile.shlib12
-rw-r--r--src/makefiles/Makefile.cygwin7
2 files changed, 14 insertions, 5 deletions
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 2a0c7a9d017..7a1a175904a 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -281,6 +281,7 @@ ifeq ($(PORTNAME), unixware)
endif
ifeq ($(PORTNAME), cygwin)
+ LINK.shared = $(CC) -shared
ifdef SO_MAJOR_VERSION
shlib = cyg$(NAME)$(DLSUFFIX)
endif
@@ -371,6 +372,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)
@@ -387,6 +398,7 @@ $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
$(stlib): $(shlib) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib $@
+endif # PORTNAME == cygwin
endif # PORTNAME == cygwin || PORTNAME == win32
diff --git a/src/makefiles/Makefile.cygwin b/src/makefiles/Makefile.cygwin
index 0a0680c74cc..863732f5984 100644
--- a/src/makefiles/Makefile.cygwin
+++ b/src/makefiles/Makefile.cygwin
@@ -1,6 +1,5 @@
-# src/makefiles/Makefile.cygwin
DLLTOOL= dlltool
-DLLWRAP= dllwrap
+# src/makefiles/Makefile.cygwin
ifdef PGXS
BE_DLLLIBS= -L$(libdir) -lpostgres
else
@@ -44,6 +43,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)