Re: [RFC] building postgres with meson - Mailing list pgsql-hackers

From Andres Freund
Subject Re: [RFC] building postgres with meson
Date
Msg-id 20220810171935.7k5zgnjwqzalzmtm@awork3.anarazel.de
Whole thread Raw
In response to Re: [RFC] building postgres with meson  (Andres Freund <andres@anarazel.de>)
Responses Re: [RFC] building postgres with meson
List pgsql-hackers
Hi,

On 2022-06-02 10:26:09 -0700, Andres Freund wrote:
> > Could we have the meson build check that, say, if gram.c exists it
> > is newer than gram.y?  Or get it to ignore an in-tree gram.c?
>
> I suspect the problem with ignoring is gram.h, that's probably a bit harder to
> ignore.

I tried to ignore various generated files in the source tree, but I don't
think it's doable for all of them. Consider
e.g. src/backend/utils/misc/guc-file.c which is gets built via #include
"guc-file.c" from gram.c

Because it's a "" include, the search path starts in the current directory and
only then -I is searched. To my knowledge there's no way of changing
that. Quoting the gcc manpage:

       -I dir
       -iquote dir
       -isystem dir
       -idirafter dir
           Add the directory dir to the list of directories to be searched for header files during preprocessing.  If
dirbegins with = or $SYSROOT, then
 
           the = or $SYSROOT is replaced by the sysroot prefix; see --sysroot and -isysroot.

           Directories specified with -iquote apply only to the quote form of the directive, "#include "file"".
Directoriesspecified with -I, -isystem, or
 
           -idirafter apply to lookup for both the "#include "file"" and "#include <file>" directives.

           You can specify any number or combination of these options on the command line to search for header files in
severaldirectories.  The lookup
 
           order is as follows:

           1.  For the quote form of the include directive, the directory of the current file is searched first.

           2.  For the quote form of the include directive, the directories specified by -iquote options are searched
inleft-to-right order, as they appear
 
               on the command line.

           3.  Directories specified with -I options are scanned in left-to-right order.
           [...]

Except for copying guc.c from source to build tree before building, I don't
see a way of ignoring the in-build-tree guc-file.c.

Not sure what a good way of dealing with this is. For now I'll make it just
error out if there's any known such file in the source tree, but that's not a
good solution forever.  If it were just "normal" build leftovers I'd propose
to (optionally) just remove them, but that's not good for tarballs.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [PATCH] CF app: add "Returned: Needs more interest"
Next
From: Ibrar Ahmed
Date:
Subject: Re: Get the statistics based on the application name and IP address