git: 441e7193407d - main - devel/cpu_features: update to 0.7.0

From: Steven Kreuzer <skreuzer_at_FreeBSD.org>
Date: Sat, 18 Feb 2023 22:43:19 UTC
The branch main has been updated by skreuzer:

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

commit 441e7193407d623e9fd29e32c335c676cbda0f37
Author:     Steven Kreuzer <skreuzer@FreeBSD.org>
AuthorDate: 2023-02-18 22:40:30 +0000
Commit:     Steven Kreuzer <skreuzer@FreeBSD.org>
CommitDate: 2023-02-18 22:43:11 +0000

    devel/cpu_features: update to 0.7.0
    
    Changes:
      - https://github.com/google/cpu_features/releases/tag/v0.7.0
    
    PR:             269107
    Reported by:    Yuri Victorovich <yuri@freebsd.org>
---
 devel/cpu_features/Makefile                        |  4 +-
 devel/cpu_features/distinfo                        |  6 +-
 .../files/patch-cmake_googletest.CMakeLists.txt.in | 17 -----
 .../files/patch-include_cpu__features__macros.h    | 13 ----
 .../files/patch-include_cpuinfo__x86.h             | 10 ---
 devel/cpu_features/files/patch-src_cpuinfo__x86.c  | 76 ----------------------
 6 files changed, 5 insertions(+), 121 deletions(-)

diff --git a/devel/cpu_features/Makefile b/devel/cpu_features/Makefile
index ca36502cfac6..8b9fb30b5a8d 100644
--- a/devel/cpu_features/Makefile
+++ b/devel/cpu_features/Makefile
@@ -1,7 +1,6 @@
 PORTNAME=	cpu_features
-DISTVERSION=	0.6.0
-PORTREVISION=	2
 DISTVERSIONPREFIX=	v
+DISTVERSION=	0.7.0
 CATEGORIES=	devel
 
 MAINTAINER=	skreuzer@FreeBSD.org
@@ -19,6 +18,7 @@ USE_GITHUB=	yes
 GH_ACCOUNT=	google
 
 CMAKE_ON=	BUILD_SHARED_LIBS
+CMAKE_OFF=	BUILD_TESTING
 
 CFLAGS+=	-fPIC
 
diff --git a/devel/cpu_features/distinfo b/devel/cpu_features/distinfo
index e40d46a8fd60..fddb56d861a2 100644
--- a/devel/cpu_features/distinfo
+++ b/devel/cpu_features/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1631796486
-SHA256 (google-cpu_features-v0.6.0_GH0.tar.gz) = 95a1cf6f24948031df114798a97eea2a71143bd38a4d07d9a758dda3924c1932
-SIZE (google-cpu_features-v0.6.0_GH0.tar.gz) = 63255
+TIMESTAMP = 1674435781
+SHA256 (google-cpu_features-v0.7.0_GH0.tar.gz) = df80d9439abf741c7d2fdcdfd2d26528b136e6c52976be8bd0cd5e45a27262c0
+SIZE (google-cpu_features-v0.7.0_GH0.tar.gz) = 85986
diff --git a/devel/cpu_features/files/patch-cmake_googletest.CMakeLists.txt.in b/devel/cpu_features/files/patch-cmake_googletest.CMakeLists.txt.in
deleted file mode 100644
index 574ffd9b7c5c..000000000000
--- a/devel/cpu_features/files/patch-cmake_googletest.CMakeLists.txt.in
+++ /dev/null
@@ -1,17 +0,0 @@
---- 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/files/patch-include_cpu__features__macros.h b/devel/cpu_features/files/patch-include_cpu__features__macros.h
deleted file mode 100644
index afb5fb2ea3c7..000000000000
--- a/devel/cpu_features/files/patch-include_cpu__features__macros.h
+++ /dev/null
@@ -1,13 +0,0 @@
---- include/cpu_features_macros.h.orig	2021-09-16 15:06:15 UTC
-+++ include/cpu_features_macros.h
-@@ -83,6 +83,10 @@
- #define CPU_FEATURES_OS_DARWIN
- #endif
- 
-+#if (defined(__freebsd__) || defined(__FreeBSD__))
-+#define CPU_FEATURES_OS_FREEBSD
-+#endif
-+
- ////////////////////////////////////////////////////////////////////////////////
- // Compilers
- ////////////////////////////////////////////////////////////////////////////////
diff --git a/devel/cpu_features/files/patch-include_cpuinfo__x86.h b/devel/cpu_features/files/patch-include_cpuinfo__x86.h
deleted file mode 100644
index e59e56aecb31..000000000000
--- a/devel/cpu_features/files/patch-include_cpuinfo__x86.h
+++ /dev/null
@@ -1,10 +0,0 @@
---- include/cpuinfo_x86.h.orig	2021-09-16 15:51:24 UTC
-+++ include/cpuinfo_x86.h
-@@ -137,6 +137,7 @@ typedef enum {
-   AMD_BULLDOZER,   // K15
-   AMD_JAGUAR,      // K16
-   AMD_ZEN,         // K17
-+  AMD_ZEN3,        // K19
- } X86Microarchitecture;
- 
- // Returns the underlying microarchitecture by looking at X86Info's vendor,
diff --git a/devel/cpu_features/files/patch-src_cpuinfo__x86.c b/devel/cpu_features/files/patch-src_cpuinfo__x86.c
deleted file mode 100644
index f88cee0a7325..000000000000
--- a/devel/cpu_features/files/patch-src_cpuinfo__x86.c
+++ /dev/null
@@ -1,76 +0,0 @@
---- src/cpuinfo_x86.c.orig	2020-10-15 09:09:51 UTC
-+++ src/cpuinfo_x86.c
-@@ -97,7 +97,8 @@
- // microarchitectures.
- #if defined(CPU_FEATURES_OS_WINDOWS)
- #include <windows.h>  // IsProcessorFeaturePresent
--#elif defined(CPU_FEATURES_OS_LINUX_OR_ANDROID)
-+#elif defined(CPU_FEATURES_OS_LINUX_OR_ANDROID) || \
-+    defined(CPU_FEATURES_OS_FREEBSD)
- #include "internal/filesystem.h"         // Needed to parse /proc/cpuinfo
- #include "internal/stack_line_reader.h"  // Needed to parse /proc/cpuinfo
- #include "internal/string_view.h"        // Needed to parse /proc/cpuinfo
-@@ -1239,6 +1240,45 @@ static void DetectSseViaOs(X86Features* features) {
-   features->ssse3 = GetDarwinSysCtlByName("hw.optional.supplementalsse3");
-   features->sse4_1 = GetDarwinSysCtlByName("hw.optional.sse4_1");
-   features->sse4_2 = GetDarwinSysCtlByName("hw.optional.sse4_2");
-+#elif defined(CPU_FEATURES_OS_FREEBSD)
-+    // Handling FreeBSD platform through parsing /var/run/dmesg.boot.
-+    const int fd = CpuFeatures_OpenFile("/var/run/dmesg.boot");
-+    if (fd >= 0) {
-+      StackLineReader reader;
-+      StackLineReader_Initialize(&reader, fd);
-+      for (;;) {
-+        const LineResult result = StackLineReader_NextLine(&reader);
-+        const StringView line = result.line;
-+        const bool is_feature =
-+            CpuFeatures_StringView_StartsWith(line, str("  Features="));
-+        const bool is_feature2 =
-+            CpuFeatures_StringView_StartsWith(line, str("  Features2="));
-+        if (is_feature || is_feature2) {
-+          // Lines of interests are of the following form:
-+          // "  Features=0x1783fbff<PSE36,MMX,FXSR,SSE,SSE2,HTT>"
-+          // We replace '<', '>' and ',' with space so we can search by
-+          // whitespace separated word.
-+          // TODO: Fix CpuFeatures_StringView_HasWord to allow for different
-+          // separators.
-+          for (size_t i = 0; i < line.size; ++i) {
-+            char* c = (char*)(&(line.ptr[i]));
-+            if (*c == '<' || *c == '>' || *c == ',') *c = ' ';
-+          }
-+          if (is_feature) {
-+            features->sse = CpuFeatures_StringView_HasWord(line, "SSE");
-+            features->sse2 = CpuFeatures_StringView_HasWord(line, "SSE2");
-+          }
-+          if (is_feature2) {
-+            features->sse3 = CpuFeatures_StringView_HasWord(line, "SSE3");
-+            features->ssse3 = CpuFeatures_StringView_HasWord(line, "SSSE3");
-+            features->sse4_1 = CpuFeatures_StringView_HasWord(line, "SSE4.1");
-+            features->sse4_2 = CpuFeatures_StringView_HasWord(line, "SSE4.2");
-+          }
-+        }
-+        if (result.eof) break;
-+      }
-+      CpuFeatures_CloseFile(fd);
-+    }
- #elif defined(CPU_FEATURES_OS_LINUX_OR_ANDROID)
-   // Handling Linux platform through /proc/cpuinfo.
-   const int fd = CpuFeatures_OpenFile("/proc/cpuinfo");
-@@ -1525,6 +1565,8 @@ X86Microarchitecture GetX86Microarchitecture(const X86
-         return AMD_JAGUAR;
-       case 0x17:
-         return AMD_ZEN;
-+      case 0x19:
-+        return AMD_ZEN3;
-       default:
-         return X86_UNKNOWN;
-     }
-@@ -1617,6 +1659,8 @@ const char* GetX86MicroarchitectureName(X86Microarchit
-       return "AMD_JAGUAR";
-     case AMD_ZEN:
-       return "AMD_ZEN";
-+    case AMD_ZEN3:
-+      return "AMD_ZEN3";
-   }
-   return "unknown microarchitecture";
- }