git: d709ba8de8ec - main - devel/cpu_features: Install cmake files, install headers into a dedicated directory

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Wed, 26 Jan 2022 16:45:31 UTC
The branch main has been updated by yuri:

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

commit d709ba8de8ec14887beffe99233eec09b26b7ed1
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-01-26 16:43:15 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-01-26 16:45:29 +0000

    devel/cpu_features: Install cmake files, install headers into a dedicated directory
    
    do-install is removed in favor of project's install target,
    
    Also update 3 other ports to build with cpu_features.
    
    PR:             261252
    Approved by:    skreuzer@ (maintainer)
---
 biology/spoa/Makefile                              |  1 +
 devel/cpu_features/Makefile                        | 13 +++++-------
 .../files/patch-cmake_googletest.CMakeLists.txt.in | 17 +++++++++++++++
 devel/cpu_features/pkg-plist                       | 24 ++++++++++------------
 security/hexl/Makefile                             |  2 ++
 security/softether5/Makefile                       |  4 +++-
 6 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/biology/spoa/Makefile b/biology/spoa/Makefile
index 05da6a20b28e..b598f6a520ff 100644
--- a/biology/spoa/Makefile
+++ b/biology/spoa/Makefile
@@ -26,6 +26,7 @@ GH_ACCOUNT=	rvaser
 CMAKE_ON=	BUILD_SHARED_LIBS spoa_optimize_for_portability spoa_build_executable spoa_use_simde spoa_use_simde_nonvec spoa_use_simde_openmp
 CMAKE_OFF=	spoa_optimize_for_native
 
+CXXFLAGS+=	-I${LOCALBASE}/include/cpu_features
 LDFLAGS+=	-lz -lcpu_features
 
 .include <bsd.port.options.mk>
diff --git a/devel/cpu_features/Makefile b/devel/cpu_features/Makefile
index 2c2ee5028668..061b43b57598 100644
--- a/devel/cpu_features/Makefile
+++ b/devel/cpu_features/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	cpu_features
-PORTVERSION=	0.6.0
+DISTVERSION=	0.6.0
+PORTREVISION=	1
 DISTVERSIONPREFIX=	v
 CATEGORIES=	devel
 
@@ -12,7 +13,7 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 NOT_FOR_ARCHS=		aarch64 armv6 armv7 mips mips64 riscv64
 NOT_FOR_ARCHS_REASON=	assumes android if on ARM or MIPS; not ported to riscv64
 
-USES=	cmake:insource
+USES=		cmake:testing # 3 tests fail, see https://github.com/google/cpu_features/issues/215
 USE_GITHUB=	yes
 GH_ACCOUNT=	google
 
@@ -20,11 +21,7 @@ CMAKE_ON=	BUILD_SHARED_LIBS
 
 CFLAGS+=	-fPIC
 
-do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/list_cpu_features ${STAGEDIR}${PREFIX}/bin
-	${INSTALL_LIB} ${WRKSRC}/libcpu_features.so ${STAGEDIR}${PREFIX}/lib
-	${MKDIR} ${STAGEDIR}${PREFIX}/include/internal
-	${INSTALL_DATA} ${WRKSRC}/include/*.h ${STAGEDIR}${PREFIX}/include
-	${INSTALL_DATA} ${WRKSRC}/include/internal/*.h ${STAGEDIR}${PREFIX}/include/internal
+post-install:
+	${INSTALL_DATA} ${WRKSRC}/include/cpuinfo_*.h ${STAGEDIR}${PREFIX}/include/${PORTNAME}
 
 .include <bsd.port.mk>
diff --git a/devel/cpu_features/files/patch-cmake_googletest.CMakeLists.txt.in b/devel/cpu_features/files/patch-cmake_googletest.CMakeLists.txt.in
new file mode 100644
index 000000000000..574ffd9b7c5c
--- /dev/null
+++ b/devel/cpu_features/files/patch-cmake_googletest.CMakeLists.txt.in
@@ -0,0 +1,17 @@
+--- cmake/googletest.CMakeLists.txt.in.orig	2022-01-16 19:20:55 UTC
++++ cmake/googletest.CMakeLists.txt.in
+@@ -5,11 +5,11 @@ project(googletest-download NONE)
+ include(ExternalProject)
+ ExternalProject_Add(googletest
+   GIT_REPOSITORY    https://github.com/google/googletest.git
+-  GIT_TAG           master
++  GIT_TAG           main
+   SOURCE_DIR        "${CMAKE_BINARY_DIR}/googletest-src"
+   BINARY_DIR        "${CMAKE_BINARY_DIR}/googletest-build"
+   CONFIGURE_COMMAND ""
+   BUILD_COMMAND     ""
+   INSTALL_COMMAND   ""
+   TEST_COMMAND      ""
+-)
+\ No newline at end of file
++)
diff --git a/devel/cpu_features/pkg-plist b/devel/cpu_features/pkg-plist
index e89c9e3391a6..c38fceecee8a 100644
--- a/devel/cpu_features/pkg-plist
+++ b/devel/cpu_features/pkg-plist
@@ -1,15 +1,13 @@
 bin/list_cpu_features
-include/cpu_features_cache_info.h
-include/cpu_features_macros.h
-include/cpuinfo_aarch64.h
-include/cpuinfo_arm.h
-include/cpuinfo_mips.h
-include/cpuinfo_ppc.h
-include/cpuinfo_x86.h
-include/internal/bit_utils.h
-include/internal/cpuid_x86.h
-include/internal/filesystem.h
-include/internal/hwcaps.h
-include/internal/stack_line_reader.h
-include/internal/string_view.h
+include/cpu_features/cpu_features_cache_info.h
+include/cpu_features/cpu_features_macros.h
+include/cpu_features/cpuinfo_aarch64.h
+include/cpu_features/cpuinfo_arm.h
+include/cpu_features/cpuinfo_mips.h
+include/cpu_features/cpuinfo_ppc.h
+include/cpu_features/cpuinfo_x86.h
+lib/cmake/CpuFeatures/CpuFeaturesConfig.cmake
+lib/cmake/CpuFeatures/CpuFeaturesConfigVersion.cmake
+lib/cmake/CpuFeatures/CpuFeaturesTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/CpuFeatures/CpuFeaturesTargets.cmake
 lib/libcpu_features.so
diff --git a/security/hexl/Makefile b/security/hexl/Makefile
index cf60790555f4..e589e0b20de7 100644
--- a/security/hexl/Makefile
+++ b/security/hexl/Makefile
@@ -24,4 +24,6 @@ CMAKE_OFF=		HEXL_BENCHMARK HEXL_TESTING
 CMAKE_TESTING_ON=	HEXL_TESTING
 CMAKE_TESTING_TARGET=	unittest
 
+CXXFLAGS+=	-I${LOCALBASE}/include/cpu_features
+
 .include <bsd.port.mk>
diff --git a/security/softether5/Makefile b/security/softether5/Makefile
index 3ed91a1caedc..17b4d28cf2fa 100644
--- a/security/softether5/Makefile
+++ b/security/softether5/Makefile
@@ -35,6 +35,8 @@ CMAKE_ARGS+=	-DCMAKE_BUILD_TYPE=RelWithDebInfo \
 		-DSE_LOGDIR="${SE_LOGDIR}" \
 		-DSE_PIDDIR="${SE_PIDDIR}"
 
+CFLAGS+=	-I${LOCALBASE}/include/cpu_features
+
 OPTIONS_DEFINE=	DOCS
 
 PORTDOCS=	DISCLAIMER.md WARNING.TXT
@@ -54,7 +56,7 @@ SUB_FILES=	pkg-message
 # skip cpu_features when devel/cpu_features is not available
 CMAKE_BOOL_ON+=	SKIP_CPU_FEATURES
 .else
-BUILD_DEPENDS+=	${LOCALBASE}/include/cpu_features_macros.h:devel/cpu_features
+BUILD_DEPENDS+=	${LOCALBASE}/include/cpu_features/cpu_features_macros.h:devel/cpu_features
 LIB_DEPENDS+=	libcpu_features.so:devel/cpu_features
 .endif