git: 975f499675d8 - main - devel/gf2: Improve port

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Sat, 01 Mar 2025 11:41:46 UTC
The branch main has been updated by diizzy:

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

commit 975f499675d8b7447212f575b09af022faede51b
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2025-03-01 11:11:42 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2025-03-01 11:11:47 +0000

    devel/gf2: Improve port
    
    Upstream shell script doesn't import external flags so instead of
    hacking it just build the binary direct as it's only one file.
    While at it enable SSE2 optimization on amd64.
    
    PR:             284987
    Reviewed by:    Paco Pascal <me@pacopascal.com> (maintainer)
---
 devel/gf2/Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/devel/gf2/Makefile b/devel/gf2/Makefile
index eb4f91d526a3..24cbe37c7e4f 100644
--- a/devel/gf2/Makefile
+++ b/devel/gf2/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	gf2 # name of the executable that is built, while the repo is called gf
 DISTVERSION=	g20250204
+PORTREVISION=	1
 CATEGORIES=	devel
 
 MAINTAINER=	me@pacopascal.com
@@ -12,7 +13,7 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 LIB_DEPENDS=	libfreetype.so:print/freetype2
 RUN_DEPENDS=	${LOCALBASE}/bin/gdb:devel/gdb
 
-USES=		xorg
+USES=		localbase:ldflags xorg
 USE_XORG=	x11
 
 USE_GITHUB=	yes
@@ -20,10 +21,16 @@ GH_ACCOUNT=	nakst
 GH_PROJECT=	gf
 GH_TAGNAME=	9c16864
 
+CXXFLAGS+=	-DUI_FREETYPE -I${LOCALBASE}/include/freetype2 \
+		-Wall -Wextra -Wno-unused-parameter -Wno-unused-result \
+		-Wno-missing-field-initializers -Wno-format-truncation
+CXXFLAGS_amd64+=	-DUI_SSE2
+LDFLAGS+=	-lX11 -pthread -lfreetype
+
 PLIST_FILES=	bin/gf2
 
 do-build:
-	@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${SH} build_freebsd.sh
+	(cd ${WRKSRC} && ${SETENVI} ${CXX} ${PORTNAME}.cpp -o ${PORTNAME} ${CXXFLAGS} ${LDFLAGS})
 
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/gf2 ${STAGEDIR}${PREFIX}/bin