Обсуждение: Building with meson on NixOS/nixpkgs

Поиск
Список
Период
Сортировка

Building with meson on NixOS/nixpkgs

От
Wolfgang Walther
Дата:
To build on NixOS/nixpkgs I came up with a few small patches to 
meson.build. All of this works fine with Autoconf/Make already.
Вложения

Re: Building with meson on NixOS/nixpkgs

От
Nazir Bilal Yavuz
Дата:
Hi,

Thank you for the patches!

On Sat, 16 Mar 2024 at 14:48, Wolfgang Walther <walther@technowledgy.de> wrote:
>
> To build on NixOS/nixpkgs I came up with a few small patches to
> meson.build. All of this works fine with Autoconf/Make already.

I do not have NixOS but I confirm that patches cleanly apply to master
and do pass CI. I have a small feedback:

0001 & 0002: Adding code comments to explain why they have fallback
could be nice.
0003: Looks good to me.

-- 
Regards,
Nazir Bilal Yavuz
Microsoft



Re: Building with meson on NixOS/nixpkgs

От
Alvaro Herrera
Дата:
On 2024-Mar-16, Wolfgang Walther wrote:

> The upstream name for the ossp-uuid package / pkg-config file is "uuid". Many
> distributions change this to be "ossp-uuid" to not conflict with e2fsprogs.

I can confirm that this is true for Debian, at least; the packaging
rules have this in override_dh_install:

    install -D -m 644 debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/uuid.pc \
        debian/libossp-uuid-dev/usr/lib/pkgconfig/ossp-uuid.pc

which matches the fact that Engelschall's official repository has the
file named simply uuid.pc:
https://github.com/rse/uuid/blob/master/uuid.pc.in

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/



Re: Building with meson on NixOS/nixpkgs

От
Wolfgang Walther
Дата:
Nazir Bilal Yavuz:
> 0001 & 0002: Adding code comments to explain why they have fallback
> could be nice.
> 0003: Looks good to me.

Added some comments in the attached.

Best,

Wolfgang
Вложения

Re: Building with meson on NixOS/nixpkgs

От
walther@technowledgy.de
Дата:
Wolfgang Walther:
> To build on NixOS/nixpkgs I came up with a few small patches to 
> meson.build. All of this works fine with Autoconf/Make already.

In v3, I added another small patch for meson, this one about proper 
handling of -Dlibedit_preferred when used together with -Dreadline=enabled.

Best,

Wolfgang
Вложения

Re: Building with meson on NixOS/nixpkgs

От
Nazir Bilal Yavuz
Дата:
Hi,

From your prior reply:

On Thu, 21 Mar 2024 at 23:44, Wolfgang Walther <walther@technowledgy.de> wrote:
>
> Nazir Bilal Yavuz:
> > 0001 & 0002: Adding code comments to explain why they have fallback
> > could be nice.
> > 0003: Looks good to me.
>
> Added some comments in the attached.

Comments look good, thanks.

On Fri, 29 Mar 2024 at 21:48, <walther@technowledgy.de> wrote:
>
> In v3, I added another small patch for meson, this one about proper
> handling of -Dlibedit_preferred when used together with -Dreadline=enabled.

You are right. I confirm the bug and your proposed patch fixes this.

-- 
Regards,
Nazir Bilal Yavuz
Microsoft



Re: Building with meson on NixOS/nixpkgs

От
Peter Eisentraut
Дата:
On 29.03.24 19:47, walther@technowledgy.de wrote:
 > -    uuid = dependency('ossp-uuid', required: true)
 > +    # upstream is called "uuid", but many distros change this to 
"ossp-uuid"
 > +    uuid = dependency('ossp-uuid', 'uuid', required: true)

How would this behave if you have only uuid.pc from e2fsprogs installed 
but choose -Duuid=ossp?  Then it would pick up uuid.pc here, but fail to 
compile later?




Re: Building with meson on NixOS/nixpkgs

От
walther@technowledgy.de
Дата:
Peter Eisentraut:
> On 29.03.24 19:47, walther@technowledgy.de wrote:
>  > -    uuid = dependency('ossp-uuid', required: true)
>  > +    # upstream is called "uuid", but many distros change this to 
> "ossp-uuid"
>  > +    uuid = dependency('ossp-uuid', 'uuid', required: true)
> 
> How would this behave if you have only uuid.pc from e2fsprogs installed 
> but choose -Duuid=ossp?  Then it would pick up uuid.pc here, but fail to 
> compile later?

It would still fail the meson setup step, because for e2fs we have:

uuidfunc = 'uuid_generate'
uuidheader = 'uuid/uuid.h'

while for ossp we have:

uuidfunc = 'uuid_export'
uuidheader = 'uuid.h'

and later we do:

if not cc.has_header_symbol(uuidheader, uuidfunc, args: test_c_args, 
dependencies: uuid)
     error('uuid library @0@ missing required function 
@1@'.format(uuidopt, uuidfunc))
endif

Best,

Wolfgang



Re: Building with meson on NixOS/nixpkgs

От
"Tristan Partin"
Дата:
Heikki asked me to take a look at this patchset for the commitfest.
Looks good to me.

Heikki, just be careful rebasing the first patch. You need to make sure
the newly set `required: false` gets carried forward.

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



Re: Building with meson on NixOS/nixpkgs

От
Heikki Linnakangas
Дата:
On 26/07/2024 23:01, Tristan Partin wrote:
> Heikki asked me to take a look at this patchset for the commitfest.
> Looks good to me.
> 
> Heikki, just be careful rebasing the first patch. You need to make sure
> the newly set `required: false` gets carried forward.

Committed and backpatched to v16 and v17. Thanks for the good 
explanations in the commit messages, Walther!

-- 
Heikki Linnakangas
Neon (https://neon.tech)




Re: Building with meson on NixOS/nixpkgs

От
Andres Freund
Дата:
Hi,


commit 4d8de281b5834c8f5e0be6ae21e884e69dffd4ce
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date:   2024-07-27 13:53:11 +0300

    Fallback to clang in PATH with meson

    Some distributions put clang into a different path than the llvm
    binary path.

    For example, this is the case on NixOS / nixpkgs, which failed to find
    clang with meson before this patch.


I think this is a bad change unfortunately - this way clang and llvm version
can mismatch. Yes, we've done it that way for autoconf, but back then LLVM
broke compatibility far less often.


commit a00fae9d43e5adabc56e64a4df6d332062666501
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date:   2024-07-27 13:53:08 +0300

    Fallback to uuid for ossp-uuid with meson

    The upstream name for the ossp-uuid package / pkg-config file is
    "uuid". Many distributions change this to be "ossp-uuid" to not
    conflict with e2fsprogs.

    This lookup fails on distributions which don't change this name, for
    example NixOS / nixpkgs. Both "ossp-uuid" and "uuid" are also checked
    in configure.ac.

    Author: Wolfgang Walther
    Reviewed-by: Nazir Bilal Yavuz, Alvaro Herrera, Peter Eisentraut
    Reviewed-by: Tristan Partin
    Discussion: https://www.postgresql.org/message-id/ca8f37e1-a2c3-40e2-91f6-59c3d3652ad4@technowledgy.de
    Backpatch: 16-, where meson support was added

I think this is a redundant change with

commit 2416fdb3ee30bdd2810408f93f14d47bff840fea
Author: Andres Freund <andres@anarazel.de>
Date:   2024-07-20 13:51:08 -0700

    meson: Add support for detecting ossp-uuid without pkg-config

    This is necessary as ossp-uuid on windows installs neither a pkg-config nor a
    cmake dependency information. Nor is there another supported uuid
    implementation available on windows.

    Reported-by: Dave Page <dpage@pgadmin.org>
    Reviewed-by: Tristan Partin <tristan@partin.io>
    Discussion: https://postgr.es/m/20240709065101.xhc74r3mdg2lmn4w@awork3.anarazel.de
    Backpatch: 16-, where meson support was added


Greetings,

Andres Freund



Re: Building with meson on NixOS/nixpkgs

От
"Tristan Partin"
Дата:
On Fri Aug 9, 2024 at 11:14 AM CDT, Andres Freund wrote:
> Hi,
>
>
> commit 4d8de281b5834c8f5e0be6ae21e884e69dffd4ce
> Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
> Date:   2024-07-27 13:53:11 +0300
>
>     Fallback to clang in PATH with meson
>
>     Some distributions put clang into a different path than the llvm
>     binary path.
>
>     For example, this is the case on NixOS / nixpkgs, which failed to find
>     clang with meson before this patch.
>
>
> I think this is a bad change unfortunately - this way clang and llvm version
> can mismatch. Yes, we've done it that way for autoconf, but back then LLVM
> broke compatibility far less often.

See the attached patch on how we could make this situation better.

> commit a00fae9d43e5adabc56e64a4df6d332062666501
> Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
> Date:   2024-07-27 13:53:08 +0300
>
>     Fallback to uuid for ossp-uuid with meson
>
>     The upstream name for the ossp-uuid package / pkg-config file is
>     "uuid". Many distributions change this to be "ossp-uuid" to not
>     conflict with e2fsprogs.
>
>     This lookup fails on distributions which don't change this name, for
>     example NixOS / nixpkgs. Both "ossp-uuid" and "uuid" are also checked
>     in configure.ac.
>
>     Author: Wolfgang Walther
>     Reviewed-by: Nazir Bilal Yavuz, Alvaro Herrera, Peter Eisentraut
>     Reviewed-by: Tristan Partin
>     Discussion: https://www.postgresql.org/message-id/ca8f37e1-a2c3-40e2-91f6-59c3d3652ad4@technowledgy.de
>     Backpatch: 16-, where meson support was added
>
> I think this is a redundant change with
>
> commit 2416fdb3ee30bdd2810408f93f14d47bff840fea
> Author: Andres Freund <andres@anarazel.de>
> Date:   2024-07-20 13:51:08 -0700
>
>     meson: Add support for detecting ossp-uuid without pkg-config
>
>     This is necessary as ossp-uuid on windows installs neither a pkg-config nor a
>     cmake dependency information. Nor is there another supported uuid
>     implementation available on windows.
>
>     Reported-by: Dave Page <dpage@pgadmin.org>
>     Reviewed-by: Tristan Partin <tristan@partin.io>
>     Discussion: https://postgr.es/m/20240709065101.xhc74r3mdg2lmn4w@awork3.anarazel.de
>     Backpatch: 16-, where meson support was added

I'm not sure I would call them redundant. It's cheaper (and better) to
do a pkg-config lookup than it is to do the various checks in your
patch. I think the two patches are complementary. Yours services Windows
plus anywhere else that doesn't have a pkg-config file, while Wolfgang's
services distros that install the pkg-config with a different name.

--
Tristan Partin
https://tristan.partin.io

Вложения