From 86d30ecc1f9c92138c8f9981ec12aa29de50d740 Mon Sep 17 00:00:00 2001 From: gahr Date: Fri, 25 Jul 2008 08:12:22 +0000 Subject: - New port: p5-Sys-Cpu Obtain CPU information from a perl script PR: 125947 Submitted by: terry@sucked-in.com --- devel/Makefile | 1 + devel/p5-Sys-Cpu/Makefile | 21 ++++++++++++++ devel/p5-Sys-Cpu/distinfo | 3 ++ devel/p5-Sys-Cpu/files/patch-CPU.xs | 57 +++++++++++++++++++++++++++++++++++++ devel/p5-Sys-Cpu/pkg-descr | 8 ++++++ devel/p5-Sys-Cpu/pkg-plist | 7 +++++ 6 files changed, 97 insertions(+) create mode 100644 devel/p5-Sys-Cpu/Makefile create mode 100644 devel/p5-Sys-Cpu/distinfo create mode 100644 devel/p5-Sys-Cpu/files/patch-CPU.xs create mode 100644 devel/p5-Sys-Cpu/pkg-descr create mode 100644 devel/p5-Sys-Cpu/pkg-plist (limited to 'devel') diff --git a/devel/Makefile b/devel/Makefile index 7c9aeb3d0ec4..4d3bf226729d 100644 --- a/devel/Makefile +++ b/devel/Makefile @@ -1653,6 +1653,7 @@ SUBDIR += p5-Sub-Override SUBDIR += p5-Sub-Uplevel SUBDIR += p5-Sub-WrapPackages + SUBDIR += p5-Sys-Cpu SUBDIR += p5-Sys-Mmap SUBDIR += p5-Sys-Sig SUBDIR += p5-Sys-SigAction diff --git a/devel/p5-Sys-Cpu/Makefile b/devel/p5-Sys-Cpu/Makefile new file mode 100644 index 000000000000..091499fb32a9 --- /dev/null +++ b/devel/p5-Sys-Cpu/Makefile @@ -0,0 +1,21 @@ +# New ports collection makefile for: Sys-Cpu +# Date created: 25 July 2008 +# Whom: Terry Sposato +# +# $FreeBSD$ +# + +PORTNAME= Sys-CPU +PORTVERSION= 0.40 +CATEGORIES= devel perl5 +MASTER_SITES= CPAN +PKGNAMEPREFIX= p5- + +MAINTAINER= terry@sucked-in.com +COMMENT= Sys::CPU - Perl extension for getting CPU information + +PERL_CONFIGURE= yes + +MAN3= Sys::CPU.3 + +.include diff --git a/devel/p5-Sys-Cpu/distinfo b/devel/p5-Sys-Cpu/distinfo new file mode 100644 index 000000000000..98a0e736a330 --- /dev/null +++ b/devel/p5-Sys-Cpu/distinfo @@ -0,0 +1,3 @@ +MD5 (Sys-CPU-0.40.tar.gz) = c2731716e5c1eaa4e88860ccc09791e2 +SHA256 (Sys-CPU-0.40.tar.gz) = 48efce686727f6529a555c3a6f7c57f91285e364675370007bb462174e773558 +SIZE (Sys-CPU-0.40.tar.gz) = 4696 diff --git a/devel/p5-Sys-Cpu/files/patch-CPU.xs b/devel/p5-Sys-Cpu/files/patch-CPU.xs new file mode 100644 index 000000000000..eed00a62f42c --- /dev/null +++ b/devel/p5-Sys-Cpu/files/patch-CPU.xs @@ -0,0 +1,57 @@ +--- CPU.xs.orig 2008-07-25 09:06:35.000000000 +0200 ++++ CPU.xs 2008-07-25 09:24:13.000000000 +0200 +@@ -35,6 +35,9 @@ + #define _have_cpu_clock + #define _have_cpu_type + #endif ++#ifdef __FreeBSD__ ++ #include ++#endif + + #ifdef WINDOWS + /* Registry Functions */ +@@ -237,6 +240,10 @@ + { + int clock = 0; + int retcode = 0; ++#ifdef __FreeBSD__ ++ size_t len = sizeof(clock); ++ sysctlbyname("hw.clockrate", &clock, &len, NULL, 0); ++#else + #ifdef __linux__ + int value = proc_cpuinfo_clock(); + if (value) clock = value; +@@ -263,12 +270,13 @@ + } + } + #endif ++#endif + if (clock) { + ST(0) = sv_newmortal(); + sv_setiv (ST(0), clock); + } else { + ST(0) = &PL_sv_undef; +- } ++ } + } + + SV * +@@ -277,6 +285,10 @@ + { + char *value = malloc(MAX_IDENT_SIZE); + int retcode = 0; ++#ifdef __FreeBSD__ ++ size_t len = MAX_IDENT_SIZE; ++ sysctlbyname("hw.model", value, &len, NULL, 0); ++#else + #ifdef __linux__ + value = proc_cpuinfo_field ("model name"); + if (!value) value = proc_cpuinfo_field ("machine"); +@@ -296,6 +308,7 @@ + value = infop->pi_processor_type; + } + #endif ++#endif + if (value) { + ST(0) = sv_newmortal(); + sv_setpv (ST(0), value); diff --git a/devel/p5-Sys-Cpu/pkg-descr b/devel/p5-Sys-Cpu/pkg-descr new file mode 100644 index 000000000000..a34977c1d8ac --- /dev/null +++ b/devel/p5-Sys-Cpu/pkg-descr @@ -0,0 +1,8 @@ +Sys::CPU - Perl extension for getting CPU information. +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). + +WWW: http://search.cpan.org/dist/Sys-Cpu/ diff --git a/devel/p5-Sys-Cpu/pkg-plist b/devel/p5-Sys-Cpu/pkg-plist new file mode 100644 index 000000000000..9ca56e2cc8b7 --- /dev/null +++ b/devel/p5-Sys-Cpu/pkg-plist @@ -0,0 +1,7 @@ +%%SITE_PERL%%/%%PERL_ARCH%%/Sys/CPU.pm +%%SITE_PERL%%/%%PERL_ARCH%%/auto/Sys/CPU/CPU.so +%%SITE_PERL%%/%%PERL_ARCH%%/auto/Sys/CPU/CPU.bs +%%SITE_PERL%%/%%PERL_ARCH%%/auto/Sys/CPU/.packlist +@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/Sys/CPU +@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/Sys +@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/auto/Sys -- cgit