git: f2258673f15e - main - x11/hyprpaper: drop GCC dependency via bundled libc++

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Fri, 03 Feb 2023 12:35:02 UTC
The branch main has been updated by jbeich:

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

commit f2258673f15eab0c0202809ec6109e3311705f4b
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-01-30 23:52:38 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-02-03 12:34:04 +0000

    x11/hyprpaper: drop GCC dependency via bundled libc++
---
 x11/hyprpaper/Makefile | 30 ++++++++++++++++++++++++++----
 x11/hyprpaper/distinfo |  2 ++
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/x11/hyprpaper/Makefile b/x11/hyprpaper/Makefile
index 2933233c9c05..25eb373e5c73 100644
--- a/x11/hyprpaper/Makefile
+++ b/x11/hyprpaper/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	hyprpaper
 PORTVERSION=	s20230115
+PORTREVISION=	1
 CATEGORIES=	x11 wayland
 
 MAINTAINER=	jbeich@FreeBSD.org
@@ -13,13 +14,11 @@ BUILD_DEPENDS=	gmake:devel/gmake \
 		wayland-protocols>0:graphics/wayland-protocols
 LIB_DEPENDS=	libwayland-client.so:graphics/wayland
 
-USES=		compiler:c++11-lib cmake gnome jpeg pkgconfig
-USE_GCC=	yes:build # C++23
+USES=		compiler:c++11-lib cmake gnome jpeg localbase:ldflags pkgconfig
 USE_GNOME=	cairo
 USE_GITHUB=	yes
 GH_ACCOUNT=	hyprwm
 GH_TAGNAME=	f77a664
-LDFLAGS+=	-static-libstdc++ -static-libgcc # avoid libc++ conflict
 PLIST_FILES=	bin/${PORTNAME}
 
 post-patch:
@@ -30,11 +29,13 @@ post-patch:
 		-e 's/$${GIT_COMMIT_MESSAGE}/<unknown>/' \
 		-e 's/$${GIT_DIRTY}/portbld/' \
 		${WRKSRC}/CMakeLists.txt
+# https://clang.llvm.org/cxx_status.html#cxx23
+	@${REINPLACE_CMD} -e 's/c++23/c++2b/' \
+		${WRKSRC}/CMakeLists.txt
 # Drop unused dependencies
 	@${REINPLACE_CMD} 's/ wlroots//' ${WRKSRC}/Makefile
 	@${REINPLACE_CMD} -e 's/ pango pangocairo//' \
 		-e '/OpenGL/d; /GLESv2/d' \
-		-e '/pthread/d; /CMAKE_THREAD_LIBS_INIT/d' \
 		-e '/ rt)/d' \
 		${WRKSRC}/CMakeLists.txt
 
@@ -45,4 +46,25 @@ do-install:
 	${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/${PORTNAME} \
 		${STAGEDIR}${PREFIX}/bin
 
+# XXX Drop after FreeBSD 12.3 EOL around 2023-03-01 (don't forget distinfo)
+.if !exists(/usr/include/c++/v1/concepts) || make(makesum) || make(fetch)
+USES+=		llvm:min=12,build
+CC=		clang${LLVM_VERSION}
+CXX=		clang++${LLVM_VERSION}
+CPP=		clang-cpp${LLVM_VERSION}
+
+# XXX Move into separate port and standardize via USES
+GH_TUPLE+=	llvm:llvm-project:llvmorg-13.0.1:libcxx
+CXXFLAGS+=	-nostdinc++ -isystem${WRKDIR}/libcxx_prefix/include/c++/v1
+# Don't link against new libc++ as it's not necessary
+#LDFLAGS+=	-nostdlib++ -L${WRKDIR}/libcxx_prefix/lib -l:libc++.a -lcxxrt
+
+pre-configure:	bundled-libcxx
+bundled-libcxx:
+	@${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS:M*Ninja*} \
+		-DCMAKE_INSTALL_PREFIX:PATH=${WRKDIR}/libcxx_prefix \
+		-B ${WRKDIR}/libcxx_build -S ${WRKSRC_libcxx}/libcxx
+	@${DO_MAKE_BUILD:NDESTDIR*} install -C ${WRKDIR}/libcxx_build
+.endif
+
 .include <bsd.port.mk>
diff --git a/x11/hyprpaper/distinfo b/x11/hyprpaper/distinfo
index 993ca8cd6a08..22a273ada71a 100644
--- a/x11/hyprpaper/distinfo
+++ b/x11/hyprpaper/distinfo
@@ -1,3 +1,5 @@
 TIMESTAMP = 1673799209
 SHA256 (hyprwm-hyprpaper-s20230115-f77a664_GH0.tar.gz) = a0e3b22c800f3475ae13dffa4f779eefafcdda58271322edf7a4a5e291d3a8c6
 SIZE (hyprwm-hyprpaper-s20230115-f77a664_GH0.tar.gz) = 23554
+SHA256 (llvm-llvm-project-llvmorg-13.0.1_GH0.tar.gz) = 09c50d558bd975c41157364421820228df66632802a4a6a7c9c17f86a7340802
+SIZE (llvm-llvm-project-llvmorg-13.0.1_GH0.tar.gz) = 147290251