Re: Reduce the number of special cases to build contrib modules on windows
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>,
Andres Freund <andres@anarazel.de>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2021-03-03T09:37:56Z
Lists: pgsql-hackers
Attachments
- reduce_contrib_build_special_cases_on_windows_v7.patch (text/plain) patch v7
Thank you for having another look at this.
On Tue, 12 Jan 2021 at 20:18, Michael Paquier <michael@paquier.xyz> wrote:
>
> 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.
I'm hesitant to touch that. If anyone is running an instance compiled
with a non-default LOWER_NODE then we might give them some trouble if
they pg_upgrade their database later.
> > + 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?
hmm. I'm not quite sure if I know what you mean by "trap" here.
contrib/cube/Makefile has an example of what this is trying to catch:
# cubescan is compiled as part of cubeparse
cubeparse.o: cubescan.c
I don't really see what other options there are apart from just not
get rid of $contrib_extrasource.
Can you give an example of what sort of scenario you've got in mind
where it'll cause issues?
I've attached a rebased patch.
David
Commits
-
Remove some special cases from MSVC build scripts
- 76ad24400d73 15.0 landed
-
Adjust MSVC build scripts to parse Makefiles for defines
- 245de48455da 15.0 landed
-
Don't duplicate references and libraries in MSVC scripts
- 15f16ec6511c 15.0 landed
-
Make the includes field an array in MSVC build scripts
- 33d74c5d00e4 15.0 landed
-
Use the AddFile function consistently in MSVC build scripts
- ed1884a2fede 15.0 landed
-
Remove seemingly unneeded include directory in MSVC scripts
- 4b763ff642e1 15.0 landed