Skip to content

Commit 1c0bf37

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 59d64e7 commit 1c0bf37

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/Makefile.shlib

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

310310
ifeq ($(PORTNAME), cygwin)
311+
LINK.shared = $(CC) -shared
311312
ifdef SO_MAJOR_VERSION
312313
shlib = cyg$(NAME)$(DLSUFFIX)
313314
endif
@@ -398,6 +399,16 @@ else # PORTNAME == cygwin || PORTNAME == win32
398399

399400
# If SHLIB_EXPORTS is set, the rules below will build a .def file from
400401
# that. Else we build a temporary one here.
402+
ifeq ($(PORTNAME), cygwin)
403+
$(shlib): $(OBJS) | $(SHLIB_PREREQS)
404+
$(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(LDAP_LIBS_BE)
405+
406+
$(stlib): $(OBJS) | $(SHLIB_PREREQS)
407+
$(LINK.static) $@ $^
408+
$(RANLIB) $@
409+
410+
411+
else
401412
ifeq (,$(SHLIB_EXPORTS))
402413
DLL_DEFFILE = lib$(NAME)dll.def
403414
exports_file = $(DLL_DEFFILE)
@@ -414,6 +425,7 @@ $(shlib): $(OBJS) $(DLL_DEFFILE)
414425
$(stlib): $(shlib) $(DLL_DEFFILE)
415426
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib $@
416427

428+
endif # PORTNAME == cygwin
417429
endif # PORTNAME == cygwin || PORTNAME == win32
418430

419431
endif # enable_shared

src/makefiles/Makefile.cygwin

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# $PostgreSQL: pgsql/src/makefiles/Makefile.cygwin,v 1.15 2010/07/05 23:15:56 tgl Exp $
22
DLLTOOL= dlltool
3-
DLLWRAP= dllwrap
43
ifdef PGXS
54
BE_DLLLIBS= -L$(libdir) -lpostgres
65
else
@@ -40,6 +39,4 @@ endif
4039

4140
# Rule for building a shared library from a single .o file
4241
%.dll: %.o
43-
$(DLLTOOL) --export-all --output-def $*.def $<
44-
$(DLLWRAP) -o $@ --def $*.def $< $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)
45-
rm -f $*.def
42+
$(CC) $(CFLAGS) -shared -o $@ $< $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)

0 commit comments

Comments
 (0)