Re: Reduce the number of special cases to build contrib modules on windows

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, Andres Freund <andres@anarazel.de>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2021-01-12T07:18:24Z
Lists: pgsql-hackers
On Wed, Dec 30, 2020 at 10:07:29AM +1300, David Rowley wrote:
> -#ifdef LOWER_NODE
> +/*
> + * Below we ignore the fact that LOWER_NODE is defined when compiling with
> + * MSVC.  The reason for this is that earlier versions of the MSVC build
> + * scripts failed to define LOWER_NODE.  More recent version of the MSVC
> + * build scripts parse makefiles which results in LOWER_NODE now being
> + * defined.  We check for _MSC_VER here so as not to break pg_upgrade when
> + * upgrading from versions MSVC versions where LOWER_NODE was not defined.
> + */
> +#if defined(LOWER_NODE) && !defined(_MSC_VER)
>  #include <ctype.h>
>  #define TOLOWER(x)	tolower((unsigned char) (x))
>  #else

While on it, do you think that it would be more readable if we remove
completely LOWER_NODE and use only a check based on _MSC_VER for those
two files in ltree?  This could also be handled as a separate change.

> +	foreach my $line (split /\n/, $mf)
> +	{
> +		if ($line =~ /^[A-Za-z0-9_]*\.o:\s(.*)/)
> +		{
> +			foreach my $file (split /\s+/, $1)
> +			{
> +				foreach my $proj (@projects)
> +				{
> +					$proj->AddFileConditional("$subdir/$n/$file");
> +				}
> +			}
> +		}
> +	}
Looking closer at this change, I don't think that this is completely
correct and that could become a trap.  This is adding quite a bit of
complexity to take care of contrib_extrasource getting empty, and it
actually overlaps with the handling of OBJS done in AddDir(), no?
--
Michael

Commits

  1. Remove some special cases from MSVC build scripts

  2. Adjust MSVC build scripts to parse Makefiles for defines

  3. Don't duplicate references and libraries in MSVC scripts

  4. Make the includes field an array in MSVC build scripts

  5. Use the AddFile function consistently in MSVC build scripts

  6. Remove seemingly unneeded include directory in MSVC scripts