Re: Clean up find_typedefs and add support for Mac

From: "Tristan Partin" <tristan(at)neon(dot)tech>
To: "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Clean up find_typedefs and add support for Mac
Date: 2023-12-15 16:08:58
Message-ID: CXP1DBDHMDYU.21TACUHI2W7G9@neon.tech
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> if ($using_osx)
> {
> # On OS X, we need to examine the .o files
> # exclude ecpg/test, which pgindent does too
> my $obj_wanted = sub {
> /^.*\.o\z/s
> && !($File::Find::name =~ m!/ecpg/test/!s)
> && push(@testfiles, $File::Find::name);
> };
>
> File::Find::find($obj_wanted, $bindir);
> }

I think we should use dsymutil --flat to assemble .dwarf files on Mac
instead of inspecting the plain object files. This would allow you to
use the script in the same way on presumably any system that Postgres
supports, meaning we can drop this distinction:

> # The second argument is a directory. For everything except OSX it should be
> # a directory where postgres is installed (e.g. $installdir for the buildfarm).
> # It should have bin and lib subdirectories. On OSX it should instead be the
> # top of the build tree, as we need to examine the individual object files.

> my @err = `$objdump -W 2>&1`;
> my @readelferr = `readelf -w 2>&1`;
> my $using_osx = (`uname` eq "Darwin\n");

Is there any reason we can't use uname -s to detect the system instead
of relying on error condition heuristics of readelf and objdump?

> # Note that this assumes there is not a platform-specific subdirectory of
> # lib like meson likes to use. (The buildfarm avoids this by specifying
> # --libdir=lib to meson setup.)

Should we just default the Meson build to libdir=lib in
project(default_options:)? This assumes that you don't think what Tom
said about running it on the build tree is better.

--
Tristan Partin
Neon (https://neon.tech)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tristan Partin 2023-12-15 16:10:14 Re: Clean up find_typedefs and add support for Mac
Previous Message Tom Lane 2023-12-15 16:06:12 Re: Clean up find_typedefs and add support for Mac