Re: Bug: build is broken on FreeBSD if libsysinfo is installed
- From
Eli Schwartz <eschwartz@gentoo.org>
- Date
- Jul 2, 2025, 18:32 UTC
- Message-ID
- <b57b1418-2179-480c-92a3-a107388d71f2@gentoo.org>
- In-Reply-To
- <d3b912ca-ba5a-4b56-81d1-0e8a10055d83@ramsayjones.plus.com>
On 7/1/25 4:03 PM, Ramsay Jones wrote:
Show 17 quoted lines
> The patch is below. (I didn't write a commit message ;) ). > > Does this work for you? > > ATB, > Ramsay Jones > > ---- >8 ---- > From: Ramsay Jones <ramsay@ramsayjones.plus.com> > Date: Tue, 1 Jul 2025 20:33:44 +0100 > Subject: [PATCH] build: fix FreeBSD sysinfo build failure > > Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> > --- > configure.ac | 61 ++++++++++++++++++++++++++++++---------------------- > meson.build | 10 +++++---- > 2 files changed, 41 insertions(+), 30 deletions(-)
Show 27 quoted lines
> diff --git a/meson.build b/meson.build
> index 7fea4a34d6..355cad730c 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1331,10 +1331,6 @@ if host_machine.system() != 'windows'
> endif
> endif
>
> -if compiler.has_member('struct sysinfo', 'totalram', prefix: '#include <sys/sysinfo.h>')
> - libgit_c_args += '-DHAVE_SYSINFO'
> -endif
> -
> if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
> libgit_c_args += '-DUSE_ST_TIMESPEC'
> elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
> @@ -1449,6 +1445,12 @@ if compiler.has_header('sys/sysctl.h')
> endif
> endif
>
> +if not has_bsd_sysctl
> + if compiler.has_member('struct sysinfo', 'totalram', prefix: '#include <sys/sysinfo.h>')
> + libgit_c_args += '-DHAVE_SYSINFO'
> + endif
> +endif
> +
> if not meson.is_cross_build() and compiler.run('''
> #include <stdio.h>This seems reasonable to me. has_member only does a compile-check, not linkage, so we can't know if it's a BSD port. Only using it when a previously checked interface can't be found, lets us avoid doing extraneous work though.
-- Eli Schwartz