Index | Thread | Search

From:
George Koehler <kernigh@gmail.com>
Subject:
Re: devel/meson and name_prefix: and LIBname_VERSION
To:
Kirill A. Korinsky <kirill@korins.ky>
Cc:
ports@openbsd.org, Antoine Jacoutot <ajacoutot@openbsd.org>, Pascal Stumpf <pascal@stumpf.co>
Date:
Mon, 17 Nov 2025 23:13:19 -0500

Download raw body.

Thread
On Wed, 12 Nov 2025 13:48:46 +0100
Kirill A. Korinsky <kirill@korins.ky> wrote:

> 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.

I made this change and will commit it after my amd64 builds some
packages, which might take a day.  Below is the diff with the change.

This change might produce a different result if prefixed_name[:3]
is not 'lib', but the result would be bogus either way.  Every library
should begin with 'lib'.

--gkoehler

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/meson/Makefile,v
diff -u -p -r1.151 Makefile
--- Makefile	23 Sep 2025 09:55:38 -0000	1.151
+++ Makefile	18 Nov 2025 03:34:56 -0000
@@ -5,6 +5,7 @@ GH_ACCOUNT=		mesonbuild
 GH_PROJECT=		meson
 GH_TAGNAME=		1.9.1
 EPOCH=			0
+REVISION=		0
 
 CATEGORIES=		devel
 
Index: patches/patch-mesonbuild_build_py
===================================================================
RCS file: /cvs/ports/devel/meson/patches/patch-mesonbuild_build_py,v
diff -u -p -r1.59 patch-mesonbuild_build_py
--- patches/patch-mesonbuild_build_py	25 Aug 2025 07:12:17 -0000	1.59
+++ patches/patch-mesonbuild_build_py	18 Nov 2025 03:34:56 -0000
@@ -9,12 +9,16 @@ Index: mesonbuild/build.py
  )
  from .options import OptionKey
  
-@@ -2584,6 +2585,26 @@ class SharedLibrary(BuildTarget):
+@@ -2584,6 +2585,30 @@ class SharedLibrary(BuildTarget):
              if self.darwin_versions is None and self.soversion is not None:
                  # If unspecified, pick the soversion
                  self.darwin_versions = (self.soversion, self.soversion)
 +        if is_openbsd():
-+            self.libversion = os.getenv('LIB' + self.name + '_VERSION')
++            libname = self.name
++            if hasattr(self, 'prefix'):
++                prefixed_name = self.prefix + self.name
++                libname = prefixed_name.removeprefix('lib')
++            self.libversion = os.getenv('LIB' + libname + '_VERSION')
 +            if (self.libversion is None and
 +                    self.soversion is not None and
 +                    len(self.soversion) != 0 and
@@ -30,13 +34,13 @@ Index: mesonbuild/build.py
 +                    f.write("# SHARED_LIBS+= {:<25}<obsd version> # <orig version>\n".format("<libname>"))
 +                    f.close
 +                f = open(shared_libs_log, 'a')
-+                f.write("SHARED_LIBS += {:<25} {} # {}\n".format(self.name, \
++                f.write("SHARED_LIBS += {:<25} {} # {}\n".format(libname, \
 +                        self.soversion, self.ltversion_orig))
 +                f.close
  
          # Visual Studio module-definitions file
          self.process_vs_module_defs_kw(kwargs)
-@@ -2635,6 +2656,8 @@ class SharedLibrary(BuildTarget):
+@@ -2635,6 +2660,8 @@ class SharedLibrary(BuildTarget):
          # filename. If ltversion != soversion we create an soversion alias:
          # libfoo.so.0 -> libfoo.so.0.100.0
          # Where libfoo.so.0.100.0 is the actual library