git: e07da5f2329a - main - net/usockets: fix shared library and provide pc file

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Mon, 16 Dec 2024 09:33:20 UTC
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e07da5f2329ad771844b20f262f4c07c73c0a832

commit e07da5f2329ad771844b20f262f4c07c73c0a832
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2024-12-16 08:05:44 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2024-12-16 09:33:08 +0000

    net/usockets: fix shared library and provide pc file
    
    fix the shared library to make sure it provides a soname.
    while here follow the gentoo and openbsd path by providing a .pc file
    some of the futur ports depending on uSockets requires it.
    
    Approved by:            yuri
    Differential Revision:  https://reviews.freebsd.org/D48110
---
 net/usockets/Makefile             | 9 ++++++++-
 net/usockets/files/patch-Makefile | 4 ++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/usockets/Makefile b/net/usockets/Makefile
index 03a3da0a1f7a..aa58c180a918 100644
--- a/net/usockets/Makefile
+++ b/net/usockets/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	usockets
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.8.8
+PORTREVISION=	1
 CATEGORIES=	net devel
 
 MAINTAINER=	yuri@FreeBSD.org
@@ -25,12 +26,18 @@ CXXFLAGS+=	-fPIC
 
 ALL_TARGET=	default
 
+SUB_FILES=	libusockets.pc
+SUB_LISTS=	VERSION=${DISTVERSION}
+
 PLIST_FILES=	include/libusockets.h \
+		lib/libuSockets.so.0 \
 		lib/libuSockets.so
 
 do-install:
 	${INSTALL_DATA} ${WRKSRC}/src/libusockets.h ${STAGEDIR}${PREFIX}/include
-	${INSTALL_LIB} ${WRKSRC}/libuSockets.so ${STAGEDIR}${PREFIX}/lib
+	${INSTALL_LIB} ${WRKSRC}/libuSockets.so.0 ${STAGEDIR}${PREFIX}/lib
+	${RLN} ${WRKSRC}/libuSockets.so.0 ${STAGEDIR}${PREFIX}/lib/libuSockets.so
+	${INSTALL_DATA} ${WRKDIR}/libusockets.pc ${STAGEDIR}${LOCALBASE}/libdata/pkgconfig
 
 do-test: # tests fail to compile: https://github.com/uNetworking/uSockets/issues/213
 	cd ${WRKSRC} && \
diff --git a/net/usockets/files/patch-Makefile b/net/usockets/files/patch-Makefile
index 1a326b309bd0..f8bb9ea1bd80 100644
--- a/net/usockets/files/patch-Makefile
+++ b/net/usockets/files/patch-Makefile
@@ -1,11 +1,11 @@
---- Makefile.orig	2023-12-28 02:58:25 UTC
+--- Makefile.orig	2024-02-07 13:04:14 UTC
 +++ Makefile
 @@ -88,7 +88,7 @@ endif
  	$(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp
  endif
  # Create a static library (try windows, then unix)
 -	lib.exe /out:uSockets.a *.o || $(AR) rvs uSockets.a *.o
-+	$(CXX) -shared -o libuSockets.so *.o -lssl
++	$(CXX) -shared -o libuSockets.so.0 -Wl,-soname=libuSockets.so.0 *.o -lssl
  
  # BoringSSL needs cmake and golang
  .PHONY: boringssl