diff options
author | wiz <wiz@pkgsrc.org> | 2014-08-13 20:20:23 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2014-08-13 20:20:23 +0000 |
commit | 9bb714810c92f1339836464ff659a09e20cedca5 (patch) | |
tree | 0f237fa3ef2246e1735eae8d7bf4cc04513b8926 /sysutils/p5-Sys-CPU | |
parent | 44a21b2a0feecbdf2be5537812e9cb5757bb8c5e (diff) | |
download | pkgsrc-9bb714810c92f1339836464ff659a09e20cedca5.tar.gz |
Import p5-Sys-CPU-0.61 as sysutils/p5-Sys-CPU, packaged for wip by noud4
and myself.
In responce to a post on perlmonks.org, a module for counting the number of
CPU's on a system. Support has now also been added for type of CPU and clock
speed. While much of the code is from UNIX::Processors, win32 support has been
added (but not tested).
Diffstat (limited to 'sysutils/p5-Sys-CPU')
-rw-r--r-- | sysutils/p5-Sys-CPU/DESCR | 4 | ||||
-rw-r--r-- | sysutils/p5-Sys-CPU/Makefile | 17 | ||||
-rw-r--r-- | sysutils/p5-Sys-CPU/distinfo | 6 | ||||
-rw-r--r-- | sysutils/p5-Sys-CPU/patches/patch-CPU.xs | 46 |
4 files changed, 73 insertions, 0 deletions
diff --git a/sysutils/p5-Sys-CPU/DESCR b/sysutils/p5-Sys-CPU/DESCR new file mode 100644 index 00000000000..a7188606ac4 --- /dev/null +++ b/sysutils/p5-Sys-CPU/DESCR @@ -0,0 +1,4 @@ +In responce to a post on perlmonks.org, a module for counting the number of +CPU's on a system. Support has now also been added for type of CPU and clock +speed. While much of the code is from UNIX::Processors, win32 support has been +added (but not tested). diff --git a/sysutils/p5-Sys-CPU/Makefile b/sysutils/p5-Sys-CPU/Makefile new file mode 100644 index 00000000000..fcbceee8ad8 --- /dev/null +++ b/sysutils/p5-Sys-CPU/Makefile @@ -0,0 +1,17 @@ +# $NetBSD: Makefile,v 1.1 2014/08/13 20:20:23 wiz Exp $ + +DISTNAME= Sys-CPU-0.61 +PKGNAME= p5-${DISTNAME} +CATEGORIES= sysutils perl5 +MASTER_SITES= ${MASTER_SITE_PERL_CPAN:=../../authors/id/M/MZ/MZSANFORD/} + +MAINTAINER= pkgsrc-users@NetBSD.org +HOMEPAGE= http://search.cpan.org/~mzsanford/Sys-CPU/ +COMMENT= Perl 5 module for getting CPU information +LICENSE= ${PERL5_LICENSE} + +USE_LANGUAGES= c +PERL5_PACKLIST= auto/Sys/CPU/.packlist + +.include "../../lang/perl5/module.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/sysutils/p5-Sys-CPU/distinfo b/sysutils/p5-Sys-CPU/distinfo new file mode 100644 index 00000000000..45a5940a88e --- /dev/null +++ b/sysutils/p5-Sys-CPU/distinfo @@ -0,0 +1,6 @@ +$NetBSD: distinfo,v 1.1 2014/08/13 20:20:23 wiz Exp $ + +SHA1 (Sys-CPU-0.61.tar.gz) = 3bca409742fd47a06768b9ba9d8f14d73171c8c1 +RMD160 (Sys-CPU-0.61.tar.gz) = 147d6f4d87d76fd15c35cbd6ebc902f416f0bec6 +Size (Sys-CPU-0.61.tar.gz) = 6497 bytes +SHA1 (patch-CPU.xs) = b1f1a59ff6eb02b7d9691423b2084fccd21f74cf diff --git a/sysutils/p5-Sys-CPU/patches/patch-CPU.xs b/sysutils/p5-Sys-CPU/patches/patch-CPU.xs new file mode 100644 index 00000000000..723179fcb09 --- /dev/null +++ b/sysutils/p5-Sys-CPU/patches/patch-CPU.xs @@ -0,0 +1,46 @@ +$NetBSD: patch-CPU.xs,v 1.1 2014/08/13 20:20:23 wiz Exp $ + +Add NetBSD support. +https://rt.cpan.org/Public/Bug/Display.html?id=98004 + +--- CPU.xs.orig 2013-11-27 22:40:07.000000000 +0000 ++++ CPU.xs +@@ -40,7 +40,7 @@ + #define _have_cpu_clock + #define _have_cpu_type + #endif +-#ifdef __FreeBSD__ ++#if defined(__FreeBSD__) || defined(__NetBSD__) + #include <sys/sysctl.h> + #define _have_cpu_type + #define _have_cpu_clock +@@ -345,6 +345,17 @@ CODE: + size_t len = sizeof(clock); + sysctlbyname("hw.clockrate", &clock, &len, NULL, 0); + #endif ++#ifdef __NetBSD__ ++ size_t len = sizeof(clock); ++ char const *name; ++ ++ if (sysctlbyname("machdep.powernow.frequency.current", NULL, &len, NULL, 0) == 0) ++ name = "machdep.powernow.frequency.current"; ++ else if (sysctlbyname("machdep.est.frequency.current", NULL, &len, NULL, 0) == 0) ++ name = "machdep.est.frequency.current"; ++ ++ sysctlbyname(name, &clock, &len, NULL, 0); ++#endif + #ifdef WINDOWS + char *clock_str = malloc(MAX_IDENT_SIZE); + /*!! untested !!*/ +@@ -394,6 +405,11 @@ CODE: + size_t len = MAX_IDENT_SIZE; + sysctlbyname("hw.model", value, &len, NULL, 0); + #endif ++#ifdef __NetBSD__ ++ value = malloc(MAX_IDENT_SIZE); ++ size_t len = MAX_IDENT_SIZE; ++ sysctlbyname("hw.model", value, &len, NULL, 0); ++#endif + #ifdef __linux__ + #if defined __s390__ || defined __s390x__ + value = processor_machine_field (proc_cpuinfo_field ("processor") ); |