git: 4ecceca208a6 - main - security/rustls-ffi: Allow dynamic linking

From: Bernard Spil <brnrd_at_FreeBSD.org>
Date: Sat, 06 Jul 2024 22:51:03 UTC
The branch main has been updated by brnrd:

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

commit 4ecceca208a6ab9fcf5d73ce47c0e243e55ddafe
Author:     Bernard Spil <brnrd@FreeBSD.org>
AuthorDate: 2024-07-06 22:47:44 +0000
Commit:     Bernard Spil <brnrd@FreeBSD.org>
CommitDate: 2024-07-06 22:47:44 +0000

    security/rustls-ffi: Allow dynamic linking
    
    Obtained from:  https://projects.pyret.net/files/freebsd-patches/rustls-ffi-v2.patch
    Reported by:    diizzy
---
 security/rustls-ffi/Makefile  | 19 ++++++++++------
 security/rustls-ffi/patch     | 53 +++++++++++++++++++++++++++++++++++++++++++
 security/rustls-ffi/pkg-plist |  5 ++++
 3 files changed, 70 insertions(+), 7 deletions(-)

diff --git a/security/rustls-ffi/Makefile b/security/rustls-ffi/Makefile
index cd09e6272781..4ea9c2641a92 100644
--- a/security/rustls-ffi/Makefile
+++ b/security/rustls-ffi/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	rustls-ffi
-PORTVERSION=	0.13.0
 DISTVERSIONPREFIX=	v
+DISTVERSION=	0.13.0
+PORTREVISION=	1
 CATEGORIES=	security
 
 MAINTAINER=	brnrd@FreeBSD.org
@@ -13,18 +14,22 @@ LICENSE_FILE_APACHE20=	${WRKSRC}/LICENSE-APACHE
 LICENSE_FILE_ISCL=	${WRKSRC}/LICENSE-ISC
 LICENSE_FILE_MIT=	${WRKSRC}/LICENSE-MIT
 
-USES=		cargo gmake
+BUILD_DEPENDS=	cargo-cbuild:devel/cargo-c
+
+USES=		cargo
+USE_LDCONFIG=	yes
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	rustls
 
-PLIST_FILES=	include/rustls.h \
-		lib/librustls.a
-
 do-build:
-	${MAKE_CMD} -C ${WRKSRC}
+	@${CARGO_CARGO_RUN} cbuild --verbose --verbose ${CARGO_BUILD_ARGS}
 
 do-install:
-	${MAKE_CMD} -C ${WRKSRC} DESTDIR=${STAGEDIR}/${PREFIX} install
+	@${CARGO_CARGO_RUN} cinstall --verbose --verbose \
+	    --destdir "${STAGEDIR}" \
+	    --prefix "${PREFIX}" \
+	    ${CARGO_INSTALL_ARGS}
+	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/*.so
 
 .include <bsd.port.mk>
diff --git a/security/rustls-ffi/patch b/security/rustls-ffi/patch
new file mode 100644
index 000000000000..c97b74715006
--- /dev/null
+++ b/security/rustls-ffi/patch
@@ -0,0 +1,53 @@
+diff --git a/security/rustls-ffi/Makefile b/security/rustls-ffi/Makefile
+index cd09e6272781..4ea9c2641a92 100644
+--- a/security/rustls-ffi/Makefile
++++ b/security/rustls-ffi/Makefile
+@@ -1,6 +1,7 @@
+ PORTNAME=	rustls-ffi
+-PORTVERSION=	0.13.0
+ DISTVERSIONPREFIX=	v
++DISTVERSION=	0.13.0
++PORTREVISION=	1
+ CATEGORIES=	security
+ 
+ MAINTAINER=	brnrd@FreeBSD.org
+@@ -13,18 +14,22 @@ LICENSE_FILE_APACHE20=	${WRKSRC}/LICENSE-APACHE
+ LICENSE_FILE_ISCL=	${WRKSRC}/LICENSE-ISC
+ LICENSE_FILE_MIT=	${WRKSRC}/LICENSE-MIT
+ 
+-USES=		cargo gmake
++BUILD_DEPENDS=	cargo-cbuild:devel/cargo-c
++
++USES=		cargo
++USE_LDCONFIG=	yes
+ 
+ USE_GITHUB=	yes
+ GH_ACCOUNT=	rustls
+ 
+-PLIST_FILES=	include/rustls.h \
+-		lib/librustls.a
+-
+ do-build:
+-	${MAKE_CMD} -C ${WRKSRC}
++	@${CARGO_CARGO_RUN} cbuild --verbose --verbose ${CARGO_BUILD_ARGS}
+ 
+ do-install:
+-	${MAKE_CMD} -C ${WRKSRC} DESTDIR=${STAGEDIR}/${PREFIX} install
++	@${CARGO_CARGO_RUN} cinstall --verbose --verbose \
++	    --destdir "${STAGEDIR}" \
++	    --prefix "${PREFIX}" \
++	    ${CARGO_INSTALL_ARGS}
++	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/*.so
+ 
+ .include <bsd.port.mk>
+diff --git a/security/rustls-ffi/pkg-plist b/security/rustls-ffi/pkg-plist
+new file mode 100644
+index 000000000000..84d04e86784b
+--- /dev/null
++++ b/security/rustls-ffi/pkg-plist
+@@ -0,0 +1,5 @@
++include/rustls.h
++lib/librustls.a
++lib/librustls.so
++lib/librustls.so.0.13.0
++libdata/pkgconfig/rustls.pc
diff --git a/security/rustls-ffi/pkg-plist b/security/rustls-ffi/pkg-plist
new file mode 100644
index 000000000000..84d04e86784b
--- /dev/null
+++ b/security/rustls-ffi/pkg-plist
@@ -0,0 +1,5 @@
+include/rustls.h
+lib/librustls.a
+lib/librustls.so
+lib/librustls.so.0.13.0
+libdata/pkgconfig/rustls.pc