diff options
author | tnn <tnn@pkgsrc.org> | 2020-12-14 15:07:49 +0000 |
---|---|---|
committer | tnn <tnn@pkgsrc.org> | 2020-12-14 15:07:49 +0000 |
commit | fd093802b9314f12c32a8d13906315c250b9262e (patch) | |
tree | a95d0d43f5af82f8ff022fbd9a7f267127240674 | |
parent | 7caef619a24480d468d49914a0a4e95d2e5e63fa (diff) | |
download | pkgsrc-fd093802b9314f12c32a8d13906315c250b9262e.tar.gz |
devel/cpu_features: import cpu_features-0.6.0
A cross-platform C library to retrieve CPU features
(such as available instructions) at runtime.
-rw-r--r-- | devel/cpu_features/DESCR | 2 | ||||
-rw-r--r-- | devel/cpu_features/Makefile | 18 | ||||
-rw-r--r-- | devel/cpu_features/PLIST | 10 | ||||
-rw-r--r-- | devel/cpu_features/buildlink3.mk | 14 | ||||
-rw-r--r-- | devel/cpu_features/distinfo | 8 | ||||
-rw-r--r-- | devel/cpu_features/patches/patch-include_cpu__features__macros.h | 17 | ||||
-rw-r--r-- | devel/cpu_features/patches/patch-src_cpuinfo__x86.c | 29 |
7 files changed, 98 insertions, 0 deletions
diff --git a/devel/cpu_features/DESCR b/devel/cpu_features/DESCR new file mode 100644 index 00000000000..9019b047355 --- /dev/null +++ b/devel/cpu_features/DESCR @@ -0,0 +1,2 @@ +A cross-platform C library to retrieve CPU features +(such as available instructions) at runtime. diff --git a/devel/cpu_features/Makefile b/devel/cpu_features/Makefile new file mode 100644 index 00000000000..5759cf3c33f --- /dev/null +++ b/devel/cpu_features/Makefile @@ -0,0 +1,18 @@ +# $NetBSD: Makefile,v 1.1 2020/12/14 15:07:49 tnn Exp $ + +GITHUB_TAG= v${PKGVERSION_NOREV} +DISTNAME= cpu_features-0.6.0 +CATEGORIES= devel +MASTER_SITES= ${MASTER_SITE_GITHUB:=google/} + +MAINTAINER= pkgsrc-users@NetBSD.org +HOMEPAGE= https://github.com/google/cpu_features/ +COMMENT= Cross platform C99 library to get CPU features at runtime +LICENSE= apache-2.0 + +USE_CMAKE= yes +USE_LANGUAGES= c c++ + +PLIST_SUBST+= CPU_FEATURES_ARCH=${MACHINE_ARCH:S/i386/x86/:S/x86_64/x86/} + +.include "../../mk/bsd.pkg.mk" diff --git a/devel/cpu_features/PLIST b/devel/cpu_features/PLIST new file mode 100644 index 00000000000..d1083fbff45 --- /dev/null +++ b/devel/cpu_features/PLIST @@ -0,0 +1,10 @@ +@comment $NetBSD: PLIST,v 1.1 2020/12/14 15:07:49 tnn Exp $ +bin/list_cpu_features +include/cpu_features/cpu_features_cache_info.h +include/cpu_features/cpu_features_macros.h +include/cpu_features/cpuinfo_${CPU_FEATURES_ARCH}.h +lib/cmake/CpuFeatures/CpuFeaturesConfig.cmake +lib/cmake/CpuFeatures/CpuFeaturesConfigVersion.cmake +lib/cmake/CpuFeatures/CpuFeaturesTargets-release.cmake +lib/cmake/CpuFeatures/CpuFeaturesTargets.cmake +lib/libcpu_features.a diff --git a/devel/cpu_features/buildlink3.mk b/devel/cpu_features/buildlink3.mk new file mode 100644 index 00000000000..ccc0323e33c --- /dev/null +++ b/devel/cpu_features/buildlink3.mk @@ -0,0 +1,14 @@ +# $NetBSD: buildlink3.mk,v 1.1 2020/12/14 15:07:49 tnn Exp $ + +BUILDLINK_TREE+= cpu_features + +.if !defined(CPU_FEATURES_BUILDLINK3_MK) +CPU_FEATURES_BUILDLINK3_MK:= + +BUILDLINK_API_DEPENDS.cpu_features+= cpu_features>=0.6.0 +BUILDLINK_PKGSRCDIR.cpu_features?= ../../devel/cpu_features +BUILDLINK_DEPMETHOD.cpu_features?= build + +.endif # CPU_FEATURES_BUILDLINK3_MK + +BUILDLINK_TREE+= -cpu_features diff --git a/devel/cpu_features/distinfo b/devel/cpu_features/distinfo new file mode 100644 index 00000000000..eb751403d1b --- /dev/null +++ b/devel/cpu_features/distinfo @@ -0,0 +1,8 @@ +$NetBSD: distinfo,v 1.1 2020/12/14 15:07:49 tnn Exp $ + +SHA1 (cpu_features-0.6.0.tar.gz) = bb723e78b7726359114575c3c7af80031c986b7b +RMD160 (cpu_features-0.6.0.tar.gz) = b61c55c5e95d8e2f593271fea09d099bdfbcfdbf +SHA512 (cpu_features-0.6.0.tar.gz) = 006a2e05253712cf605ecabccdda63dd9325445f8d145d5e2432c4342332e652f318810997321849be131082db435d88143020fdc85268fba204586cf37eef0d +Size (cpu_features-0.6.0.tar.gz) = 63255 bytes +SHA1 (patch-include_cpu__features__macros.h) = 4d93afe4ac314895f0823b992af463bf39d67379 +SHA1 (patch-src_cpuinfo__x86.c) = 948cba79e96fdabfe5ec48780d5f6d5077018b4e diff --git a/devel/cpu_features/patches/patch-include_cpu__features__macros.h b/devel/cpu_features/patches/patch-include_cpu__features__macros.h new file mode 100644 index 00000000000..62aa1ca2581 --- /dev/null +++ b/devel/cpu_features/patches/patch-include_cpu__features__macros.h @@ -0,0 +1,17 @@ +$NetBSD: patch-include_cpu__features__macros.h,v 1.1 2020/12/14 15:07:49 tnn Exp $ + +NetBSD support. + +--- include/cpu_features_macros.h.orig 2020-10-15 09:09:51.000000000 +0000 ++++ include/cpu_features_macros.h +@@ -71,6 +71,10 @@ + #define CPU_FEATURES_OS_LINUX_OR_ANDROID + #endif + ++#if defined(__NetBSD__) ++#define CPU_FEATURES_OS_NETBSD ++#endif ++ + #if defined(__ANDROID__) + #define CPU_FEATURES_OS_ANDROID + #endif diff --git a/devel/cpu_features/patches/patch-src_cpuinfo__x86.c b/devel/cpu_features/patches/patch-src_cpuinfo__x86.c new file mode 100644 index 00000000000..1f5577f6da5 --- /dev/null +++ b/devel/cpu_features/patches/patch-src_cpuinfo__x86.c @@ -0,0 +1,29 @@ +$NetBSD: patch-src_cpuinfo__x86.c,v 1.1 2020/12/14 15:07:49 tnn Exp $ + +Use /proc/cpuinfo on NetBSD/x86 for now. + +--- src/cpuinfo_x86.c.orig 2020-10-15 09:09:51.000000000 +0000 ++++ src/cpuinfo_x86.c +@@ -1,3 +1,4 @@ ++ + // Copyright 2017 Google LLC + // Copyright 2020 Intel Corporation + // +@@ -97,7 +98,7 @@ + // 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_NETBSD) + #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,7 +1240,7 @@ static void DetectSseViaOs(X86Features* + 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_LINUX_OR_ANDROID) ++#elif defined(CPU_FEATURES_OS_LINUX_OR_ANDROID) || defined(CPU_FEATURES_OS_NETBSD) + // Handling Linux platform through /proc/cpuinfo. + const int fd = CpuFeatures_OpenFile("/proc/cpuinfo"); + if (fd >= 0) { |