Commit cba6ffae authored by Tom Lane's avatar Tom Lane

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
parent d3c4c471
...@@ -415,7 +415,12 @@ else ...@@ -415,7 +415,12 @@ else
libpq_pgport = -L$(top_builddir)/src/common -lpgcommon -L$(top_builddir)/src/port -lpgport $(libpq) libpq_pgport = -L$(top_builddir)/src/common -lpgcommon -L$(top_builddir)/src/port -lpgport $(libpq)
endif endif
# If PGXS is not defined, build libpq and libpgport dependancies as required. # Cygwin seems to need ldap libraries to be mentioned here, too
ifeq ($(PORTNAME),cygwin)
libpq_pgport += $(LDAP_LIBS_FE)
endif
# If PGXS is not defined, build libpq and libpgport dependencies as required.
# If the build is with PGXS, then these are supposed to be already built and # If the build is with PGXS, then these are supposed to be already built and
# installed, and we just ensure that the expected files exist. # installed, and we just ensure that the expected files exist.
ifndef PGXS ifndef PGXS
......
...@@ -62,18 +62,16 @@ endif ...@@ -62,18 +62,16 @@ endif
ifeq ($(PORTNAME), cygwin) ifeq ($(PORTNAME), cygwin)
postgres: $(OBJS) postgres.def libpostgres.a postgres: $(OBJS)
$(DLLTOOL) --dllname $@$(X) --output-exp $@.exp --def postgres.def $(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 $@
$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) -o $@$(X) -Wl,--base-file,$@.base $@.exp $(call expand_subsys,$(OBJS)) $(LIBS)
$(DLLTOOL) --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) -Wl,--stack,$(WIN32_STACK_RLIMIT) -o $@$(X) $@.exp $(call expand_subsys,$(OBJS)) $(LIBS)
rm -f $@.exp $@.base
postgres.def: $(OBJS) # There is no correct way to write a rule that generates two files.
$(DLLTOOL) --export-all --output-def $@ $(call expand_subsys,$^) # Rules with two targets don't have that meaning, they are merely
# shorthand for two otherwise separate rules. To be safe for parallel
# make, we must chain the dependencies like this. The semicolon is
# important, otherwise make will choose some built-in rule.
libpostgres.a: postgres.def libpostgres.a: postgres ;
$(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
endif # cygwin endif # cygwin
...@@ -295,7 +293,7 @@ clean: ...@@ -295,7 +293,7 @@ clean:
$(top_builddir)/src/include/utils/fmgroids.h \ $(top_builddir)/src/include/utils/fmgroids.h \
$(top_builddir)/src/include/utils/probes.h $(top_builddir)/src/include/utils/probes.h
ifeq ($(PORTNAME), cygwin) ifeq ($(PORTNAME), cygwin)
rm -f postgres.dll postgres.def libpostgres.a rm -f postgres.dll libpostgres.a
endif endif
ifeq ($(PORTNAME), win32) ifeq ($(PORTNAME), win32)
rm -f postgres.dll postgres.def libpostgres.a $(WIN32RES) rm -f postgres.dll postgres.def libpostgres.a $(WIN32RES)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment