From: Kirill A. Korinsky Subject: Re: devel/meson and name_prefix: and LIBname_VERSION To: George Koehler Cc: ports@openbsd.org, Antoine Jacoutot , Pascal Stumpf Date: Wed, 12 Nov 2025 13:48:46 +0100 On Wed, 12 Nov 2025 02:08:05 +0100, George Koehler wrote: > > We patch meson to look at LIBname_VERSION (set by SHARED_LIBS in > ports). Our patch doesn't work when a meson.build has > library(name_prefix: ''). Both net/dino and net/libupnpp have patches > removing name_prefix: '' to work around this problem. I offer this > diff for name_prefix. > > A typical library looks like > library('what', sources) > and prepends 'lib', so it is libwhat.so.${LIBwhat_VERSION}. > > A library with named_prefix: might be > library('libwhat', sources, name_prefix: '') > which should have the same name, but might rename some generated > files (like from 'what.pc' to 'libwhat.pc'). The version variable > should be LIBwhat_VERSION, not LIBlibwhat_VERSION. > > I rarely write Python, so it would help if someone checks my code. It > runs before the default self.prefix = 'lib' is set. Given a typical > library without name_prefix, hasattr(self, 'prefix') is false, so it > should pick the same version variable as before. The pick should > change only if there is a name_prefix and the prefixed name begins > with 'lib'. > > This diff has built all the packages on my amd64 desktop, but has never > been in a bulk. I packaged net/libupnpp without its patch-meson_build. > I tried to package net/dino without the 2nd chunk of > patch-libdino_meson_build; it failed because some files changed names > (dino.h to libdino.h and dino.vapi to libdino.vapi) and I had not > updated PLIST. > > Is this good enough to commit? it allows to remove the hack from net/dino build. Which is good. Code logical with one small remarks: > ++ if prefixed_name[:3] == 'lib': > ++ libname = prefixed_name[3:] I think that + libname = prefixed_name.removeprefix('lib') is ideomatically cleaner. with it, I see it worth to be commited because it allows to stop hacking build systems. So, OK kirill@ -- wbr, Kirill