Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit cba6ffa

Browse files
committed
Cygwin build fixes.
Get rid of use of dlltool for linking the main postgres executable. dlltool is obsolete and we'd prefer to stop depending on it. Also, include $(LDAP_LIBS_FE) in $(libpq_pgport). (It's not clear that this is really needed, or why it's not a linker bug if it is needed. But reports are that it's needed on current Cygwin.) We might want to back-patch this if it works, but first let's see what the buildfarm thinks. Marco Atzeri
1 parent d3c4c47 commit cba6ffa

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/Makefile.global.in

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,12 @@ else
415415
libpq_pgport = -L$(top_builddir)/src/common -lpgcommon -L$(top_builddir)/src/port -lpgport $(libpq)
416416
endif
417417

418-
# If PGXS is not defined, build libpq and libpgport dependancies as required.
418+
# Cygwin seems to need ldap libraries to be mentioned here, too
419+
ifeq ($(PORTNAME),cygwin)
420+
libpq_pgport += $(LDAP_LIBS_FE)
421+
endif
422+
423+
# If PGXS is not defined, build libpq and libpgport dependencies as required.
419424
# If the build is with PGXS, then these are supposed to be already built and
420425
# installed, and we just ensure that the expected files exist.
421426
ifndef PGXS

src/backend/Makefile

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,16 @@ endif
6262

6363
ifeq ($(PORTNAME), cygwin)
6464

65-
postgres: $(OBJS) postgres.def libpostgres.a
66-
$(DLLTOOL) --dllname $@$(X) --output-exp $@.exp --def postgres.def
67-
$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) -o $@$(X) -Wl,--base-file,$@.base $@.exp $(call expand_subsys,$(OBJS)) $(LIBS)
68-
$(DLLTOOL) --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
69-
$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) -Wl,--stack,$(WIN32_STACK_RLIMIT) -o $@$(X) $@.exp $(call expand_subsys,$(OBJS)) $(LIBS)
70-
rm -f $@.exp $@.base
65+
postgres: $(OBJS)
66+
$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) $(export_dynamic) -Wl,--stack,$(WIN32_STACK_RLIMIT) -Wl,--export-all-symbols -Wl,--out-implib=libpostgres.a $(call expand_subsys,$^) $(LIBS) -o $@
7167

72-
postgres.def: $(OBJS)
73-
$(DLLTOOL) --export-all --output-def $@ $(call expand_subsys,$^)
68+
# There is no correct way to write a rule that generates two files.
69+
# Rules with two targets don't have that meaning, they are merely
70+
# shorthand for two otherwise separate rules. To be safe for parallel
71+
# make, we must chain the dependencies like this. The semicolon is
72+
# important, otherwise make will choose some built-in rule.
7473

75-
libpostgres.a: postgres.def
76-
$(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
74+
libpostgres.a: postgres ;
7775

7876
endif # cygwin
7977

@@ -295,7 +293,7 @@ clean:
295293
$(top_builddir)/src/include/utils/fmgroids.h \
296294
$(top_builddir)/src/include/utils/probes.h
297295
ifeq ($(PORTNAME), cygwin)
298-
rm -f postgres.dll postgres.def libpostgres.a
296+
rm -f postgres.dll libpostgres.a
299297
endif
300298
ifeq ($(PORTNAME), win32)
301299
rm -f postgres.dll postgres.def libpostgres.a $(WIN32RES)

0 commit comments

Comments
 (0)