summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2012-05-03 13:22:41 +0000
committerFabian Groffen <grobian@gentoo.org>2012-05-03 13:22:41 +0000
commit03cb3b60e0531065fa4f2b96f2a509f004bb620d (patch)
tree7db39c3a4ebfff3d0ea4eee46d8a9cbdcd4e2155 /sys-process
parentMigrate to virtual/pkgconfig. (diff)
downloadgentoo-2-03cb3b60e0531065fa4f2b96f2a509f004bb620d.tar.gz
gentoo-2-03cb3b60e0531065fa4f2b96f2a509f004bb620d.tar.bz2
gentoo-2-03cb3b60e0531065fa4f2b96f2a509f004bb620d.zip
Initial ebuild of Apple's version of top from Mac OS X Lion, patched to compile on older versions as well.
(Portage version: 2.2.01.20366-prefix/cvs/SunOS i386)
Diffstat (limited to 'sys-process')
-rw-r--r--sys-process/top-apple/ChangeLog11
-rw-r--r--sys-process/top-apple/Manifest5
-rw-r--r--sys-process/top-apple/files/top-apple-73-darwin9.patch40
-rw-r--r--sys-process/top-apple/metadata.xml5
-rw-r--r--sys-process/top-apple/top-apple-73.ebuild45
5 files changed, 106 insertions, 0 deletions
diff --git a/sys-process/top-apple/ChangeLog b/sys-process/top-apple/ChangeLog
new file mode 100644
index 000000000000..925af10ed13a
--- /dev/null
+++ b/sys-process/top-apple/ChangeLog
@@ -0,0 +1,11 @@
+# ChangeLog for sys-process/top-apple
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-process/top-apple/ChangeLog,v 1.1 2012/05/03 13:22:41 grobian Exp $
+
+*top-apple-73 (03 May 2012)
+
+ 03 May 2012; Fabian Groffen <grobian@gentoo.org>
+ +files/top-apple-73-darwin9.patch, +metadata.xml, +top-apple-73.ebuild:
+ Initial ebuild of Apple's version of top from Mac OS X Lion, patched to
+ compile on older versions as well.
+
diff --git a/sys-process/top-apple/Manifest b/sys-process/top-apple/Manifest
new file mode 100644
index 000000000000..df8460d0b18f
--- /dev/null
+++ b/sys-process/top-apple/Manifest
@@ -0,0 +1,5 @@
+AUX top-apple-73-darwin9.patch 1157 RMD160 abee6012460e5b499305cc643801bbfcd0c6776b SHA1 834ee1c08de5c1cb2300846957cf44038853bbc6 SHA256 3f6ac323299af89277d4903bfacbbe5f6bcc97cb8fd10bdef85480207e74a02d
+DIST libutil-11-top-73.h 5641 RMD160 8e26ce8af772ae3837f1b1ce1ba6d96a5334c362 SHA1 c327aca97c07e520131f3c7c1a84732afffdc56f SHA256 b7f92a89bb8907a00709cd564d673806f46af4875c3016e6e27191ca5f73adc6
+DIST top-73.tar.gz 69253 RMD160 277855e04a73e96c4592b39e75ea5be98c922df4 SHA1 f329fc83855a88457d28f46ca9ab3d42874e3ec1 SHA256 69668602b008a04b808e37cfbbca4335e60a1c69cac0f51891a573687d0d7227
+EBUILD top-apple-73.ebuild 1386 RMD160 c31e1026c394e0f59587b8a1cad74a5ce3daf5af SHA1 2d0cf28b08a63a0ceeb56955bb9e1973f1d37754 SHA256 889bc74919e7f9c53d03ffd19dc939abe9045683bc30c42b5bf29dbcf1f3e2e5
+MISC metadata.xml 160 RMD160 baab82f4bc435813cfde4796d42840882a9a4f8f SHA1 144e248704973cfad031c92a930aad01a62a2fda SHA256 27667dd7db1d188c12342624ec5ff2155717821d646e442aef9a691c65539ac4
diff --git a/sys-process/top-apple/files/top-apple-73-darwin9.patch b/sys-process/top-apple/files/top-apple-73-darwin9.patch
new file mode 100644
index 000000000000..63d37c58f30b
--- /dev/null
+++ b/sys-process/top-apple/files/top-apple-73-darwin9.patch
@@ -0,0 +1,40 @@
+--- libtop.c.orig 2012-05-03 14:35:48.000000000 +0200
++++ libtop.c 2012-05-03 14:41:36.000000000 +0200
+@@ -23,6 +23,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <limits.h>
++#include <inttypes.h>
+ #include <sys/types.h>
+ #include <mach/bootstrap.h>
+ #include <mach/host_priv.h>
+@@ -1458,6 +1459,7 @@
+ libtop_pinfo_update_kernmem_info(task_t task, libtop_pinfo_t* pinfo) {
+ kern_return_t kr;
+
++#ifdef TASK_KERNELMEMORY_INFO_COUNT
+ mach_msg_type_number_t count = TASK_KERNELMEMORY_INFO_COUNT;
+
+ pinfo->psamp.p_palloc = pinfo->psamp.palloc;
+@@ -1466,6 +1468,9 @@
+ pinfo->psamp.p_sfree = pinfo->psamp.sfree;
+
+ kr = task_info(task, TASK_KERNELMEMORY_INFO, (task_info_t)&pinfo->psamp.palloc, &count);
++#else
++ memset(&pinfo->psamp.palloc, 0, sizeof(pinfo->psamp.palloc));
++#endif
+ return kr;
+ }
+
+@@ -1630,9 +1635,11 @@
+ }
+
+ switch (info.share_mode) {
++#ifdef SM_LARGE_PAGE
+ case SM_LARGE_PAGE:
+ // Treat SM_LARGE_PAGE the same as SM_PRIVATE
+ // since they are not shareable and are wired.
++#endif
+ case SM_PRIVATE:
+ rprvt += info.private_pages_resident * pagesize;
+ rprvt += info.shared_pages_resident * pagesize;
diff --git a/sys-process/top-apple/metadata.xml b/sys-process/top-apple/metadata.xml
new file mode 100644
index 000000000000..4561e552bd04
--- /dev/null
+++ b/sys-process/top-apple/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>prefix</herd>
+</pkgmetadata>
diff --git a/sys-process/top-apple/top-apple-73.ebuild b/sys-process/top-apple/top-apple-73.ebuild
new file mode 100644
index 000000000000..36a7d3c8489e
--- /dev/null
+++ b/sys-process/top-apple/top-apple-73.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-process/top-apple/top-apple-73.ebuild,v 1.1 2012/05/03 13:22:41 grobian Exp $
+
+EAPI="4"
+
+inherit toolchain-funcs eutils
+
+DESCRIPTION="Apple's top from Mac OS X Lion 10.7"
+HOMEPAGE="http://www.opensource.apple.com/"
+SRC_URI="http://www.opensource.apple.com/tarballs/top/top-${PV}.tar.gz
+ http://www.opensource.apple.com/source/libutil/libutil-11/libutil.h?txt -> libutil-11-top-${PV}.h"
+
+LICENSE="APSL-2 BSD"
+SLOT="0"
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+IUSE=""
+
+S=${WORKDIR}/top-${PV}
+
+src_prepare() {
+ # libutil.h header is missing at least on Leopard (10.5), the dylib just
+ # exists
+ [[ ! -e ${ROOT}/usr/include/libutil.h ]] && \
+ cp "${DISTDIR}"/libutil-11-top-${PV}.h "${S}"/libutil.h || die
+ epatch "${FILESDIR}"/${P}-darwin9.patch
+}
+
+src_compile() {
+ local libs="-lutil -lpanel -lncurses -framework CoreFoundation -framework IOKit"
+ echo "$(tc-getCC) ${CFLAGS} ${LDFLAGS} -o top -I." *.c ${libs}
+ $(tc-getCC) ${CFLAGS} ${LDFLAGS} -o top -I. *.c ${libs} || die
+}
+
+src_install() {
+ dodir /usr/bin
+ exeinto /usr/bin
+ doexe top
+}
+
+pkg_postinst() {
+ ewarn "To use top, you need to perform the following commands:"
+ ewarn " % sudo chown root ${EPREFIX}/usr/bin/top"
+ ewarn " % sudo chmod u+s ${EPREFIX}/usr/bin/top"
+}