git: 0252c46bb8d9 - 2023Q3 - multimedia/wl-screenrec: make --version report Git hash

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Sat, 22 Jul 2023 19:24:21 UTC
The branch 2023Q3 has been updated by jbeich:

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

commit 0252c46bb8d9a40cd8b9205b3ae9e6b83659e9c6
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-07-22 19:07:57 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-07-22 19:24:13 +0000

    multimedia/wl-screenrec: make --version report Git hash
    
    Based on `git describe --tags`. As upstream doesn't have any tags yet
    use snapshot date as an offset with a synthetic tag to unbreak build.
    
     $ wl-screenrec --version
    -wl-screenrec 0.1.0
    +wl-screenrec 0.1.0-s20230716-g20c6da9
    
    (cherry picked from commit aa953ce86cbf06c8cbd3577ff633c57674e1f6f4)
---
 multimedia/wl-screenrec/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/multimedia/wl-screenrec/Makefile b/multimedia/wl-screenrec/Makefile
index 69bf48b019a4..5665be271aa1 100644
--- a/multimedia/wl-screenrec/Makefile
+++ b/multimedia/wl-screenrec/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	wl-screenrec
 PORTVERSION=	s20230716
+PORTREVISION=	1
 CATEGORIES=	multimedia wayland
 
 MAINTAINER=	jbeich@FreeBSD.org
@@ -17,6 +18,9 @@ GH_TAGNAME=	20c6da9
 PLIST_FILES=	bin/${PORTNAME}
 
 post-patch:
+# Extract (snapshot) version from the port instead of Cargo.toml
+	@${REINPLACE_CMD} -i .nogit -e '/^version/s/0\.1\.0/&-${DISTVERSION}-g${GH_TAGNAME}/' \
+		${WRKSRC}/Cargo.toml
 	@${REINPLACE_CMD} -e 's,"llvm-config,"${LLVM_CONFIG},' \
 		${WRKSRC_crate_clang-sys}/build/common.rs \
 		${WRKSRC_crate_clang-sys}/src/support.rs