Skip to content

Commit 7e1531a

Browse files
committed
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.
1 parent d587298 commit 7e1531a

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/Makefile.shlib

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ ifeq ($(PORTNAME), unixware)
271271
endif
272272

273273
ifeq ($(PORTNAME), cygwin)
274+
LINK.shared = $(CC) -shared
274275
ifdef SO_MAJOR_VERSION
275276
shlib = cyg$(NAME)$(DLSUFFIX)
276277
endif
@@ -361,6 +362,16 @@ else # PORTNAME == cygwin || PORTNAME == win32
361362

362363
# If SHLIB_EXPORTS is set, the rules below will build a .def file from
363364
# that. Else we build a temporary one here.
365+
ifeq ($(PORTNAME), cygwin)
366+
$(shlib): $(OBJS) | $(SHLIB_PREREQS)
367+
$(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(LDAP_LIBS_BE)
368+
369+
$(stlib): $(OBJS) | $(SHLIB_PREREQS)
370+
$(LINK.static) $@ $^
371+
$(RANLIB) $@
372+
373+
374+
else
364375
ifeq (,$(SHLIB_EXPORTS))
365376
DLL_DEFFILE = lib$(NAME)dll.def
366377
exports_file = $(DLL_DEFFILE)
@@ -377,6 +388,7 @@ $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
377388
$(stlib): $(shlib) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
378389
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib $@
379390

391+
endif # PORTNAME == cygwin
380392
endif # PORTNAME == cygwin || PORTNAME == win32
381393

382394

src/makefiles/Makefile.cygwin

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# src/makefiles/Makefile.cygwin
21
DLLTOOL= dlltool
3-
DLLWRAP= dllwrap
2+
# src/makefiles/Makefile.cygwin
43
ifdef PGXS
54
BE_DLLLIBS= -L$(libdir) -lpostgres
65
else
@@ -44,6 +43,4 @@ endif
4443

4544
# Rule for building a shared library from a single .o file
4645
%.dll: %.o
47-
$(DLLTOOL) --export-all --output-def $*.def $<
48-
$(DLLWRAP) -o $@ --def $*.def $< $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)
49-
rm -f $*.def
46+
$(CC) $(CFLAGS) -shared -o $@ $< $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)

0 commit comments

Comments
 (0)