Skip to content

Commit fad4437

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 6e96d4d commit fad4437

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
@@ -284,6 +284,7 @@ ifeq ($(PORTNAME), unixware)
284284
endif
285285

286286
ifeq ($(PORTNAME), cygwin)
287+
LINK.shared = $(CC) -shared
287288
ifdef SO_MAJOR_VERSION
288289
shlib = cyg$(NAME)$(DLSUFFIX)
289290
endif
@@ -374,6 +375,16 @@ else # PORTNAME == cygwin || PORTNAME == win32
374375

375376
# If SHLIB_EXPORTS is set, the rules below will build a .def file from
376377
# that. Else we build a temporary one here.
378+
ifeq ($(PORTNAME), cygwin)
379+
$(shlib): $(OBJS) | $(SHLIB_PREREQS)
380+
$(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(LDAP_LIBS_BE)
381+
382+
$(stlib): $(OBJS) | $(SHLIB_PREREQS)
383+
$(LINK.static) $@ $^
384+
$(RANLIB) $@
385+
386+
387+
else
377388
ifeq (,$(SHLIB_EXPORTS))
378389
DLL_DEFFILE = lib$(NAME)dll.def
379390
exports_file = $(DLL_DEFFILE)
@@ -390,6 +401,7 @@ $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
390401
$(stlib): $(shlib) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
391402
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib $@
392403

404+
endif # PORTNAME == cygwin
393405
endif # PORTNAME == cygwin || PORTNAME == win32
394406

395407
endif # enable_shared

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
@@ -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)