On Mon, Mar 07, 2022 at 07:53:49PM +0000, Stuart Henderson wrote:
> On 2022/03/06 18:21, Rafael Sadowski wrote:
> > > Yet another cmake patch, which needs a full bulk test. Many of you will
> > > certainly know it, our cmake's SHARED_LIBS handling is broken for new
> > > shared libs.
> > > 
> > > The default "0.0" version has been broken for several months/years.
> > > Here is a attempt to fix this. With the following patch you get back the
> > > following lines, if (a) LIBxxx_VERSION is not set and (b) SOVERSION for
> > > the shared lib is set by cmake. (a) is clear but (b) helps us to handle
> > > shared libs and not plugins (dlopen) aka shared libs without version.
> > > 
> > > ...
> > > Warning: unregistered shared lib(s)
> > > SHARED_LIBS +=  fmt                       0.0 # 0.0
> > > /usr/ports/devel/fmt/pkg/PLIST is new
> > > 
> > > 
> > > Patch changes:
> > > 
> > > - Remove MODULE_LIBRARY processing.
> > >   "MODULE libraries are plugins that are not linked into other targets
> > >   but may be loaded dynamically at runtime using dlopen-like
> > >   functionality." --
> > >   https://cmake.org/cmake/help/latest/command/add_library.html
> > > 
> > > - Add default "0.0" version:
> > >   if type SHARED_LIBRARY AND empty LIBxxx_VERSION BUT SOVERSION is set.
> > > 
> > > I would appreciate a bulk test, unfortunately I can't do one.
> 
> Not finished yet, but this one looks a bit odd so I'm sending it early.
> net/dino fails; despite having
> 
> SHARED_LIBS +=  dino                      1.0 # 0.0
> 
> the actual file produced is
> 
> -rw-r--r--   1 _pbuild  _pbuild  3085740 Mar  7 12:32 libdino.so.0.0

Their main lib's target is called "libdino" but they install it with
`PREFIX ""'... maybe to avoid conflicts with the main project "Dino"?

        $ cd `make show=WRKSRC`; rg -t cmake -w SOVERSION
        qlite/CMakeLists.txt
        39:set_target_properties(qlite PROPERTIES VERSION 0.1 SOVERSION 0)

        xmpp-vala/CMakeLists.txt
        168:set_target_properties(xmpp-vala PROPERTIES VERSION 0.1 SOVERSION 0)

        libdino/CMakeLists.txt
        96:set_target_properties(libdino PROPERTIES PREFIX "" VERSION 0.0 
SOVERSION 0)

        crypto-vala/CMakeLists.txt
        37:set_target_properties(crypto-vala PROPERTIES VERSION 0.0 SOVERSION 0)

Diff below fixes the build and packages without PLIST change except the
RCSID marker when built with rsadowski's patch, it does however "warn"
in this unique port:

        Looking for unregistered conflicts
        Warning: unregistered shared lib(s)
        SHARED_LIBS +=  dino                      0.0 # 3.4
        /usr/ports/net/dino/pkg/PLIST changed

net/dino would be the only port with a SHARED_LIBS entry that begins
with "libfoo" but installs "foo".

PS: I've built with shared lib versions 1.2 3.4 5.6 and 7.8 just to
confirm that cmake installs exactly those and does without any patches:
The existing one is indeed obsolete as all versions are picked and no
symlinks are around:

        $ cd `make show=WRKINST`; find . -name \*.so.\*
        ./usr/local/lib/libqlite.so.5.6
        ./usr/local/lib/libxmpp-vala.so.7.8
        ./usr/local/lib/libdino.so.3.4
        ./usr/local/lib/libcrypto-vala.so.1.2


Index: Makefile
===================================================================
RCS file: /home/cvs/ports/net/dino/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- Makefile    21 Feb 2022 16:33:33 -0000      1.7
+++ Makefile    8 Mar 2022 19:17:17 -0000
@@ -2,11 +2,13 @@
 
 COMMENT=       XMPP desktop client
 VERSION=       0.3.0
+REVISION=      0
 DISTNAME=      dino-${VERSION}
 CATEGORIES=    net x11
 
 SHARED_LIBS += crypto-vala               0.0 # 0.0
-SHARED_LIBS += dino                      1.0 # 0.0
+# target `libdino' installed with `PREFIX ""'
+SHARED_LIBS += libdino                   1.0 # 0.0
 SHARED_LIBS += qlite                     0.0 # 0.1
 SHARED_LIBS += xmpp-vala                 1.0 # 0.1
 
Index: patches/patch-libdino_CMakeLists_txt
===================================================================
RCS file: patches/patch-libdino_CMakeLists_txt
diff -N patches/patch-libdino_CMakeLists_txt
--- patches/patch-libdino_CMakeLists_txt        21 Feb 2022 16:33:33 -0000      
1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-libdino_CMakeLists_txt,v 1.3 2022/02/21 16:33:33 kn Exp $
-
-avoid stupid links to libraries
-
-Index: libdino/CMakeLists.txt
---- libdino/CMakeLists.txt.orig
-+++ libdino/CMakeLists.txt
-@@ -93,7 +93,7 @@ add_definitions(${VALA_CFLAGS} -DDINO_SYSTEM_PLUGIN_DI
- add_library(libdino SHARED ${LIBDINO_VALA_C} 
${CMAKE_BINARY_DIR}/exports/dino_i18n.h)
- add_dependencies(libdino dino-vapi)
- target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_PACKAGES} m)
--set_target_properties(libdino PROPERTIES PREFIX "" VERSION 0.0 SOVERSION 0)
-+set_target_properties(libdino PROPERTIES PREFIX "" VERSION ${LIBdino_VERSION})
- 
- install(TARGETS libdino ${TARGET_INSTALL})
- install(FILES ${CMAKE_BINARY_DIR}/exports/dino.vapi 
${CMAKE_BINARY_DIR}/exports/dino.deps DESTINATION ${VAPI_INSTALL_DIR})
Index: pkg/PLIST
===================================================================
RCS file: /home/cvs/ports/net/dino/pkg/PLIST,v
retrieving revision 1.3
diff -u -p -r1.3 PLIST
--- pkg/PLIST   21 Feb 2022 16:33:33 -0000      1.3
+++ pkg/PLIST   8 Mar 2022 19:11:22 -0000
@@ -1,4 +1,3 @@
-@comment $OpenBSD: PLIST,v 1.3 2022/02/21 16:33:33 kn Exp $
 @bin bin/dino
 include/crypto-vala.h
 include/dino.h

Reply via email to