Re: Improve prep_buildtree
Re: Improve prep_buildtree
От:
Peter Eisentraut <peter@eisentraut.org>
Дата:
On 31.07.25 09:24, Nazir Bilal Yavuz wrote: > On Wed, 30 Jul 2025 at 21:56, Peter Eisentraut wrote: >> >> On 30.07.25 12:58, Nazir Bilal Yavuz wrote: >>> >>> That makes sense. I noticed one difference, patched prep_buildtree >>> does not create a symbolic link for the top Makefile in the builddir. >> >> Ok, here is an updated version that takes care of that, too. > > Thanks. v2 LGTM. committed
Re: Improve prep_buildtree
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Peter Eisentraut writes:
> On 30.07.25 10:28, Nazir Bilal Yavuz wrote:
>> Meson looks for ${builddir}/meson-private/coredata.dat file to
>> understand if the directory is a build directory [1]. I am just
>> wondering if you tried this and found it complicated or did you try
>> something else.
> I tried things along this line, but it's not easy to have a shell "find"
> command handle that kind of logic.
For this purpose, I think it's better for us to rely on things we
control than things Meson controls. Adding a new top-level directory
is rare enough that I don't see a problem with needing to update
prep_buildtree.
regards, tom lane
Improve prep_buildtree
От:
Peter Eisentraut <peter@eisentraut.org>
Дата:
Since I started using meson regularly, I have put the build directory under the source directory, which appears to be the recommended convention. See for example https://mesonbuild.com/Quick-guide.html#compiling-a-meson-project Then, if I also want to create a build directory using configure/make in parallel to that (for example, to test the makefiles, if adding new source files), then prep_buildtree is a bit stupid about that. It processes all directories under the top-level source directory, including existing other build trees, and so it makes a copy of existing build trees under the new build tree. This isn't actually harmful, but it seems pretty stupid, and it also makes prep_buildtree slower and slower the more build trees you have. I have never been much of a vpath user before meson, so I don't have much experience with it, but I suspect that it was previously the convention to have the build tree outside of the source tree, in which case this wouldn't have been a problem. To fix this, I first tried to devise a way to detect whether a given directory is a build directory. But that seemed pretty complicated. Instead, I chose the simpler solution that we just enumerate the source subdirectories that we know about (config, contrib, doc, src). That way we can also remove the special handling to exclude the .git directory and make the find command a bit simpler. See the attached patch. Maybe people can try this with their local workflows to make sure it still works for them, but I don't expect any particular problems, other than perhaps some shell or find command portability issues. Note, this only runs if you do a vpath configure/make build, not an in-tree configure/make build, and of course not if you use meson.
Re: Improve prep_buildtree
От:
Peter Eisentraut <peter@eisentraut.org>
Дата:
On 30.07.25 10:28, Nazir Bilal Yavuz wrote:
> On Wed, 30 Jul 2025 at 11:07, Peter Eisentraut wrote:
>>
>> To fix this, I first tried to devise a way to detect whether a given
>> directory is a build directory. But that seemed pretty complicated.
>> Instead, I chose the simpler solution that we just enumerate the source
>> subdirectories that we know about (config, contrib, doc, src). That way
>> we can also remove the special handling to exclude the .git directory
>> and make the find command a bit simpler.
>
> Meson looks for ${builddir}/meson-private/coredata.dat file to
> understand if the directory is a build directory [1]. I am just
> wondering if you tried this and found it complicated or did you try
> something else.
I tried things along this line, but it's not easy to have a shell "find"
command handle that kind of logic.
Re: Improve prep_buildtree
От:
Peter Eisentraut <peter@eisentraut.org>
Дата:
On 30.07.25 12:58, Nazir Bilal Yavuz wrote:
> Hi,
>
> On Wed, 30 Jul 2025 at 12:32, Peter Eisentraut wrote:
>>
>> On 30.07.25 10:28, Nazir Bilal Yavuz wrote:
>>> On Wed, 30 Jul 2025 at 11:07, Peter Eisentraut wrote:
>>>>
>>>> To fix this, I first tried to devise a way to detect whether a given
>>>> directory is a build directory. But that seemed pretty complicated.
>>>> Instead, I chose the simpler solution that we just enumerate the source
>>>> subdirectories that we know about (config, contrib, doc, src). That way
>>>> we can also remove the special handling to exclude the .git directory
>>>> and make the find command a bit simpler.
>>>
>>> Meson looks for ${builddir}/meson-private/coredata.dat file to
>>> understand if the directory is a build directory [1]. I am just
>>> wondering if you tried this and found it complicated or did you try
>>> something else.
>>
>> I tried things along this line, but it's not easy to have a shell "find"
>> command handle that kind of logic.
>
> That makes sense. I noticed one difference, patched prep_buildtree
> does not create a symbolic link for the top Makefile in the builddir.
Ok, here is an updated version that takes care of that, too.
Re: Improve prep_buildtree
От:
Nazir Bilal Yavuz <byavuz81@gmail.com>
Дата:
Hi,
On Wed, 30 Jul 2025 at 12:32, Peter Eisentraut wrote:
>
> On 30.07.25 10:28, Nazir Bilal Yavuz wrote:
> > On Wed, 30 Jul 2025 at 11:07, Peter Eisentraut wrote:
> >>
> >> To fix this, I first tried to devise a way to detect whether a given
> >> directory is a build directory. But that seemed pretty complicated.
> >> Instead, I chose the simpler solution that we just enumerate the source
> >> subdirectories that we know about (config, contrib, doc, src). That way
> >> we can also remove the special handling to exclude the .git directory
> >> and make the find command a bit simpler.
> >
> > Meson looks for ${builddir}/meson-private/coredata.dat file to
> > understand if the directory is a build directory [1]. I am just
> > wondering if you tried this and found it complicated or did you try
> > something else.
>
> I tried things along this line, but it's not easy to have a shell "find"
> command handle that kind of logic.
That makes sense. I noticed one difference, patched prep_buildtree
does not create a symbolic link for the top Makefile in the builddir.
--
Regards,
Nazir Bilal Yavuz
Microsoft
Re: Improve prep_buildtree
От:
Nazir Bilal Yavuz <byavuz81@gmail.com>
Дата:
Hi, On Wed, 30 Jul 2025 at 21:56, Peter Eisentraut wrote: > > On 30.07.25 12:58, Nazir Bilal Yavuz wrote: > > > > That makes sense. I noticed one difference, patched prep_buildtree > > does not create a symbolic link for the top Makefile in the builddir. > > Ok, here is an updated version that takes care of that, too. Thanks. v2 LGTM. -- Regards, Nazir Bilal Yavuz Microsoft
Re: Improve prep_buildtree
От:
Nazir Bilal Yavuz <byavuz81@gmail.com>
Дата:
Hi,
Thank you for working on this!
On Wed, 30 Jul 2025 at 11:07, Peter Eisentraut wrote:
>
> To fix this, I first tried to devise a way to detect whether a given
> directory is a build directory. But that seemed pretty complicated.
> Instead, I chose the simpler solution that we just enumerate the source
> subdirectories that we know about (config, contrib, doc, src). That way
> we can also remove the special handling to exclude the .git directory
> and make the find command a bit simpler.
Meson looks for ${builddir}/meson-private/coredata.dat file to
understand if the directory is a build directory [1]. I am just
wondering if you tried this and found it complicated or did you try
something else.
[1] https://github.com/mesonbuild/meson/blob/b4d32763940ae67d1ed36952112b3d94ba9f03a7/mesonbuild/mcompile.py#L30C1-L35C82
--
Regards,
Nazir Bilal Yavuz
Microsoft
Re: Improve prep_buildtree
От:
Jacob Champion <jacob.champion@enterprisedb.com>
Дата:
On Wed, Jul 30, 2025 at 6:35 AM Tom Lane wrote: > For this purpose, I think it's better for us to rely on things we > control than things Meson controls. Adding a new top-level directory > is rare enough that I don't see a problem with needing to update > prep_buildtree. +1. (This approach should also keep prep_buildtree from recursing into my git worktrees and vpaths, so I'm excited to give it a try!) --Jacob