Strip -mmacosx-version-min options from plperl build

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-08-18T06:57:51Z
Lists: pgsql-hackers

Attachments

When building on macOS against a Homebrew-provided Perl installation, I 
get these warnings during the build:

ld: warning: object file (SPI.o) was built for newer macOS version 
(12.4) than being linked (11.3)
ld: warning: object file (plperl.o) was built for newer macOS version 
(12.4) than being linked (11.3)
...

This is because the link command uses the option 
-mmacosx-version-min=11.3, which comes in from perl_embed_ldflags (perl 
-MExtUtils::Embed -e ldopts), but the compile commands don't use that 
option, which creates a situation that ld considers inconsistent.

I think an appropriate fix is to strip out the undesired option from 
perl_embed_ldflags.  We already do that for other options.  Proposed 
patch attached.

Commits

  1. mingw: Define PGDLLEXPORT as __declspec (dllexport) as done for msvc

  2. Fix PL/Perl build on Cygwin

  3. Remove further unwanted linker flags from perl_embed_ldflags