git: fb665ff9ffbb - main - www/adguardhome: Set version using GO_BUILDFLAGS

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sun, 24 Jul 2022 17:59:00 UTC
The branch main has been updated by yuri:

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

commit fb665ff9ffbbf77084e4bcaa48b2c6eb2fb66c55
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-07-24 17:58:03 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-07-24 17:58:03 +0000

    www/adguardhome: Set version using GO_BUILDFLAGS
    
    Suggested by:   dmgk@
---
 www/adguardhome/Makefile | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/www/adguardhome/Makefile b/www/adguardhome/Makefile
index 52cadb15f9b9..ca7dbd134b77 100644
--- a/www/adguardhome/Makefile
+++ b/www/adguardhome/Makefile
@@ -15,6 +15,7 @@ RUN_DEPENDS=	ca_root_nss>=0:security/ca_root_nss
 USES=		cpe go:modules
 
 GO_MODULE=	github.com/AdguardTeam/AdGuardHome
+GO_BUILDFLAGS=  -ldflags="-s -w -X github.com/AdguardTeam/AdGuardHome/internal/version.version=${DISTVERSION}" # workaround for https://github.com/AdguardTeam/AdGuardHome/issues/4774
 
 # to rebuild the deps archives:
 #   1. set DEV_UPDATE_MODE=yes
@@ -31,10 +32,6 @@ USE_RC_SUBR=	${PORTNAME}
 
 CPE_VENDOR=	adguard
 
-post-patch:
-	# workaround for https://github.com/AdguardTeam/AdGuardHome/issues/4774
-	@${REINPLACE_CMD} -e 's|version    string|version    string = "${PORTVERSION}"|' ${WRKSRC}/internal/version/version.go
-
 .if (${DEV_UPDATE_MODE} == "yes")
 BUILD_DEPENDS=	npm:www/npm \
 		yarn:www/yarn