pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: pgsql-hackers@postgresql.org
Subject: Clean up MinGW def file generation
Date: Tue, 15 Oct 2019 09:00:23 +0200
Message-ID: <0f9db9f8-47b8-a48b-6ccc-15b22b412316@2ndquadrant.com> (raw)

I was mystified by this comment in Makefile.shlib:

# We need several not-quite-identical variants of .DEF files to build
# DLLs for Windows.  These are made from the single source file
# exports.txt.  Since we can't assume that Windows boxes will have
# sed, the .DEF files are always built and included in distribution
# tarballs.

ifneq (,$(SHLIB_EXPORTS))
distprep: lib$(NAME)dll.def lib$(NAME)ddll.def
...

This doesn't make much sense (anymore?) since MinGW surely has sed and
MSVC doesn't use this (and has Perl).  I think this is a leftover from
various ancient client-only ad-hoc Windows build provisions (those
win32.mak files we used to have around).  Also, the ddll.def (debug
build) isn't used by anything anymore AFAICT.

I think we can clean this up and just have the regular ddl.def built
normally at build time if required.

Does anyone know more about this?

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

0001-Clean-up-MinGW-def-file-generation.patch (text/plain, 5.1K) download From 5cf449d76be516b207bb77b7802585f7612a776f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter@eisentraut.org> Date: Tue, 15 Oct 2019 08:48:35 +0200 Subject: [PATCH] Clean up MinGW def file generation There were some leftovers from ancient ad-hoc ways to build on Windows, prior to the standardization on MSVC and MinGW. We don't need to build a lib$(NAME)ddll.def (debug build, as opposed to lib$(NAME)dll.def) for MinGW, since nothing uses that. We also don't need to build the regular .def file during distprep, since the MinGW build environment is perfectly capable of creating that normally at build time. --- src/Makefile.shlib | 40 ++++++------------------- src/interfaces/ecpg/compatlib/Makefile | 2 +- src/interfaces/ecpg/ecpglib/Makefile | 2 +- src/interfaces/ecpg/pgtypeslib/Makefile | 2 +- src/interfaces/libpq/Makefile | 2 +- 5 files changed, 13 insertions(+), 35 deletions(-) diff --git a/src/Makefile.shlib b/src/Makefile.shlib index c4893edfc3..526361f31b 100644 --- a/src/Makefile.shlib +++ b/src/Makefile.shlib @@ -49,7 +49,6 @@ # installdirs-lib create installation directory $(libdir) # uninstall-lib remove the libraries from $(libdir) # clean-lib delete the static and shared libraries from the build dir -# maintainer-clean-lib delete .def files built for win32 # # Typically you would add `all-lib' to the `all' target so that `make all' # builds the libraries. In the most simple case it would look like this: @@ -374,6 +373,13 @@ DLL_DEFFILE = lib$(NAME)dll.def $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS) $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib) + +UC_NAME = $(shell echo $(NAME) | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') + +$(DLL_DEFFILE): $(SHLIB_EXPORTS) + echo 'LIBRARY LIB$(UC_NAME).dll' >$@ + echo 'EXPORTS' >>$@ + sed -e '/^#/d' -e 's/^\(.*[ ]\)\([0-9][0-9]*\)/ \1@ \2/' $< >>$@ endif endif # PORTNAME == cygwin @@ -397,32 +403,6 @@ endif # PORTNAME == cygwin || PORTNAME == win32 echo 'Libs.private: $(sort $(filter-out -L.% -L$(top_srcdir)/%,$(filter -L%,$(LDFLAGS) $(SHLIB_LINK)))) $(filter-out $(PKG_CONFIG_REQUIRES_PRIVATE:lib%=-l%),$(filter -l%,$(SHLIB_LINK)))' >>$@ -# We need several not-quite-identical variants of .DEF files to build -# DLLs for Windows. These are made from the single source file -# exports.txt. Since we can't assume that Windows boxes will have -# sed, the .DEF files are always built and included in distribution -# tarballs. - -ifneq (,$(SHLIB_EXPORTS)) -distprep: lib$(NAME)dll.def lib$(NAME)ddll.def - -UC_NAME = $(shell echo $(NAME) | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') - -lib$(NAME)dll.def: $(SHLIB_EXPORTS) - echo '; DEF file for Makefile.shlib (MinGW)' >$@ - echo 'LIBRARY LIB$(UC_NAME).dll' >>$@ - echo 'EXPORTS' >>$@ - sed -e '/^#/d' -e 's/^\(.*[ ]\)\([0-9][0-9]*\)/ \1@ \2/' $< >>$@ - -lib$(NAME)ddll.def: $(SHLIB_EXPORTS) - echo '; DEF file for Makefile.shlib (MinGW)' >$@ - echo 'LIBRARY LIB$(UC_NAME)D.dll' >>$@ - echo 'EXPORTS' >>$@ - sed -e '/^#/d' -e 's/^\(.*[ ]\)\([0-9][0-9]*\)/ \1@ \2/' $< >>$@ - -endif # SHLIB_EXPORTS - - ## ## INSTALL ## @@ -505,8 +485,6 @@ endif # no soname .PHONY: clean-lib clean-lib: rm -f $(shlib) $(shlib_bare) $(shlib_major) $(stlib) $(exports_file) lib$(NAME).pc - -ifneq (,$(SHLIB_EXPORTS)) -maintainer-clean-lib: - rm -f lib$(NAME)dll.def lib$(NAME)ddll.def +ifneq (,$(DLL_DEFFILE)) + rm -f $(DLL_DEFFILE) endif diff --git a/src/interfaces/ecpg/compatlib/Makefile b/src/interfaces/ecpg/compatlib/Makefile index cd9879ba75..b9a4fbe9c0 100644 --- a/src/interfaces/ecpg/compatlib/Makefile +++ b/src/interfaces/ecpg/compatlib/Makefile @@ -54,4 +54,4 @@ uninstall: uninstall-lib clean distclean: clean-lib rm -f $(OBJS) -maintainer-clean: distclean maintainer-clean-lib +maintainer-clean: distclean diff --git a/src/interfaces/ecpg/ecpglib/Makefile b/src/interfaces/ecpg/ecpglib/Makefile index 8827a17fec..e888205dee 100644 --- a/src/interfaces/ecpg/ecpglib/Makefile +++ b/src/interfaces/ecpg/ecpglib/Makefile @@ -57,4 +57,4 @@ uninstall: uninstall-lib clean distclean: clean-lib rm -f $(OBJS) -maintainer-clean: distclean maintainer-clean-lib +maintainer-clean: distclean diff --git a/src/interfaces/ecpg/pgtypeslib/Makefile b/src/interfaces/ecpg/pgtypeslib/Makefile index fcc18c193c..899ff40cf6 100644 --- a/src/interfaces/ecpg/pgtypeslib/Makefile +++ b/src/interfaces/ecpg/pgtypeslib/Makefile @@ -44,4 +44,4 @@ uninstall: uninstall-lib clean distclean: clean-lib rm -f $(OBJS) -maintainer-clean: distclean maintainer-clean-lib +maintainer-clean: distclean diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile index c734965d63..0eb457d373 100644 --- a/src/interfaces/libpq/Makefile +++ b/src/interfaces/libpq/Makefile @@ -139,6 +139,6 @@ clean distclean: clean-lib # Remove files we (may have) symlinked in from other places rm -f encnames.c wchar.c -maintainer-clean: distclean maintainer-clean-lib +maintainer-clean: distclean $(MAKE) -C test $@ rm -f libpq-dist.rc -- 2.23.0

view thread (7+ messages)  latest in thread

Message-ID: <0f9db9f8-47b8-a48b-6ccc-15b22b412316@2ndquadrant.com>
Permalink:  ../0f9db9f8-47b8-a48b-6ccc-15b22b412316@2ndquadrant.com/
Also on:    postgresql.org/message-id/0f9db9f8-47b8-a48b-6ccc-15b22b412316@2ndquadrant.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com
  Subject: Re: Clean up MinGW def file generation
  In-Reply-To: <0f9db9f8-47b8-a48b-6ccc-15b22b412316@2ndquadrant.com>
  References: <0f9db9f8-47b8-a48b-6ccc-15b22b412316@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox