summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornikita <nikita@pkgsrc.org>2022-04-12 22:22:26 +0000
committernikita <nikita@pkgsrc.org>2022-04-12 22:22:26 +0000
commitc23917c0adfd17bb34a2cc2c0442cd1cefe1dd72 (patch)
tree40f869767bedcd3093a181a9572183f1f46f9bdb
parentbe9bb4cb060c5c0e7fd8b04bc3b3b8732d0f9d56 (diff)
downloadpkgsrc-c23917c0adfd17bb34a2cc2c0442cd1cefe1dd72.tar.gz
libcpuid: Add version 0.5.1
libcpuid provides CPU identification for the x86 (and x86_64). For details about the programming API, you might want to take a look at the project's website on sourceforge (http://libcpuid.sourceforge.net/). There you'd find a short tutorial, as well as the full API reference.
-rw-r--r--sysutils/Makefile3
-rw-r--r--sysutils/libcpuid/DESCR5
-rw-r--r--sysutils/libcpuid/Makefile27
-rw-r--r--sysutils/libcpuid/PLIST7
-rw-r--r--sysutils/libcpuid/distinfo7
-rw-r--r--sysutils/libcpuid/patches/patch-configure.ac34
-rw-r--r--sysutils/libcpuid/patches/patch-libcpuid_libcpuid_util.c56
7 files changed, 138 insertions, 1 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index ac3dd4db77f..1f7df221720 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1000 2022/03/12 14:28:54 tnn Exp $
+# $NetBSD: Makefile,v 1.1001 2022/04/12 22:22:26 nikita Exp $
#
COMMENT= System utilities
@@ -389,6 +389,7 @@ SUBDIR+= lf
SUBDIR+= libbaloo4
SUBDIR+= libburn
SUBDIR+= libcap
+SUBDIR+= libcpuid
SUBDIR+= libdevkit-gobject
SUBDIR+= libfm
SUBDIR+= libfm-extra
diff --git a/sysutils/libcpuid/DESCR b/sysutils/libcpuid/DESCR
new file mode 100644
index 00000000000..6bc79fe6eb1
--- /dev/null
+++ b/sysutils/libcpuid/DESCR
@@ -0,0 +1,5 @@
+libcpuid provides CPU identification for the x86 (and x86_64). For
+details about the programming API, you might want to take a look at
+the project's website on sourceforge
+(http://libcpuid.sourceforge.net/). There you'd find a short tutorial,
+as well as the full API reference.
diff --git a/sysutils/libcpuid/Makefile b/sysutils/libcpuid/Makefile
new file mode 100644
index 00000000000..052e0a48677
--- /dev/null
+++ b/sysutils/libcpuid/Makefile
@@ -0,0 +1,27 @@
+# $NetBSD: Makefile,v 1.1 2022/04/12 22:22:26 nikita Exp $
+
+DISTNAME= v${VERSION}
+PKGNAME= ${GITHUB_PROJECT}-${DISTNAME:S,^v,,}
+VERSION= 0.5.1
+GITHUB_PROJECT= libcpuid
+GITHUB_TAG= ${DISTNAME}
+CATEGORIES= sysutils
+MASTER_SITES= ${MASTER_SITE_GITHUB:=anrieff/}
+DIST_SUBDIR= ${GITHUB_PROJECT}
+
+MAINTAINER= pkgsrc-users@NetBSD.org
+HOMEPAGE= https://github.com/anrieff/libcpuid/
+COMMENT= Small x86 CPU identification library
+LICENSE= 2-clause-bsd
+
+GNU_CONFIGURE= yes
+USE_LIBTOOL= yes
+USE_LANGUAGES= c
+USE_TOOLS= autoconf automake
+
+pre-configure:
+ cd ${WRKSRC} && autoreconf --install
+
+# only for a couple of archs, specify here.
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/sysutils/libcpuid/PLIST b/sysutils/libcpuid/PLIST
new file mode 100644
index 00000000000..1b0ccc4a901
--- /dev/null
+++ b/sysutils/libcpuid/PLIST
@@ -0,0 +1,7 @@
+@comment $NetBSD: PLIST,v 1.1 2022/04/12 22:22:26 nikita Exp $
+bin/cpuid_tool
+include/libcpuid/libcpuid.h
+include/libcpuid/libcpuid_constants.h
+include/libcpuid/libcpuid_types.h
+lib/libcpuid.la
+lib/pkgconfig/libcpuid.pc
diff --git a/sysutils/libcpuid/distinfo b/sysutils/libcpuid/distinfo
new file mode 100644
index 00000000000..b8b36e6a29d
--- /dev/null
+++ b/sysutils/libcpuid/distinfo
@@ -0,0 +1,7 @@
+$NetBSD: distinfo,v 1.1 2022/04/12 22:22:26 nikita Exp $
+
+BLAKE2s (libcpuid/v0.5.1.tar.gz) = 66c0d89cdf0350649581ff01aabaa032eafdf74f5f24d998ad4e735f81bea8cd
+SHA512 (libcpuid/v0.5.1.tar.gz) = d725bc82e5aa2db69cea7b3590afbe11d6028cf4802fde8d498b4f1cc6d823e73d71b89a453d81bf996d97b36a71f6c00d0f6e8292b72f2be8a64b5d59c01861
+Size (libcpuid/v0.5.1.tar.gz) = 166522 bytes
+SHA1 (patch-configure.ac) = 130cf88478f611b2b96f17a7040d5733eb492a5d
+SHA1 (patch-libcpuid_libcpuid_util.c) = 2b041a0829ff23acf8f6adf741d9427879cab363
diff --git a/sysutils/libcpuid/patches/patch-configure.ac b/sysutils/libcpuid/patches/patch-configure.ac
new file mode 100644
index 00000000000..a9fa7599e69
--- /dev/null
+++ b/sysutils/libcpuid/patches/patch-configure.ac
@@ -0,0 +1,34 @@
+$NetBSD: patch-configure.ac,v 1.1 2022/04/12 22:22:26 nikita Exp $
+
+Upstream commit 1acaf9980b55ae180cc08db218b9face28202519
+from Alyssa Ross.
+
+Use popcount64 from libc when available
+
+Without this, we get a compiler error on NetBSD because the one in
+libc has a slightly different prototype.
+
+libcpuid_util.c:78:12: error: conflicting types for 'popcount64'
+ 78 | static int popcount64(uint64_t mask)
+ | ^~~~~~~~~~
+In file included from /nix/store/155rj8nqh3xd80vpa8hl35p3hk7pacys-include-netbsd-8.0/include/string.h:98,
+ from libcpuid_util.c:30:
+/nix/store/155rj8nqh3xd80vpa8hl35p3hk7pacys-include-netbsd-8.0/include/strings.h:61:14: note: previous declaration of 'popcount64' was here
+ 61 | unsigned int popcount64(__uint64_t) __constfunc;
+ | ^~~~~~~~~~
+
+* Return unsigned int from popcount64
+
+Matches NetBSD libc, where popcount64 originates.
+
+--- configure.ac.orig
++++ configure.ac
+@@ -43,6 +43,8 @@ LT_INIT
+ AM_CPPFLAGS="$CPPFLAGS"
+
+ AC_CHECK_HEADERS([stdint.h])
++AC_CHECK_FUNCS([popcount64])
++
+ AC_CHECK_PROGS([DOXYGEN], [doxygen])
+ AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
+
diff --git a/sysutils/libcpuid/patches/patch-libcpuid_libcpuid_util.c b/sysutils/libcpuid/patches/patch-libcpuid_libcpuid_util.c
new file mode 100644
index 00000000000..48bd2a4714a
--- /dev/null
+++ b/sysutils/libcpuid/patches/patch-libcpuid_libcpuid_util.c
@@ -0,0 +1,56 @@
+$NetBSD: patch-libcpuid_libcpuid_util.c,v 1.1 2022/04/12 22:22:26 nikita Exp $
+
+Upstream commit 1acaf9980b55ae180cc08db218b9face28202519
+from Alyssa Ross.
+
+Use popcount64 from libc when available
+
+Without this, we get a compiler error on NetBSD because the one in
+libc has a slightly different prototype.
+
+libcpuid_util.c:78:12: error: conflicting types for 'popcount64'
+ 78 | static int popcount64(uint64_t mask)
+ | ^~~~~~~~~~
+In file included from /nix/store/155rj8nqh3xd80vpa8hl35p3hk7pacys-include-netbsd-8.0/include/string.h:98,
+ from libcpuid_util.c:30:
+/nix/store/155rj8nqh3xd80vpa8hl35p3hk7pacys-include-netbsd-8.0/include/strings.h:61:14: note: previous declaration of 'popcount64' was here
+ 61 | unsigned int popcount64(__uint64_t) __constfunc;
+ | ^~~~~~~~~~
+
+* Return unsigned int from popcount64
+
+Matches NetBSD libc, where popcount64 originates.
+
+--- libcpuid/libcpuid_util.c.orig
++++ libcpuid/libcpuid_util.c
+@@ -29,6 +29,9 @@
+ #include <stdarg.h>
+ #include <string.h>
+ #include <ctype.h>
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
+ #include "libcpuid.h"
+ #include "libcpuid_util.h"
+
+@@ -74,9 +77,10 @@ void debugf(int verboselevel, const char* format, ...)
+ _warn_fun(buff);
+ }
+
+-static int popcount64(uint64_t mask)
++#ifndef HAVE_POPCOUNT64
++static unsigned int popcount64(uint64_t mask)
+ {
+- int num_set_bits = 0;
++ unsigned int num_set_bits = 0;
+
+ while (mask) {
+ mask &= mask - 1;
+@@ -85,6 +89,7 @@ static int popcount64(uint64_t mask)
+
+ return num_set_bits;
+ }
++#endif
+
+ static int score(const struct match_entry_t* entry, const struct cpu_id_t* data,
+ int brand_code, uint64_t bits, int model_code)