the Fink project is an effort to port
popular Unix programs to Mac OS X
Package: trickle
Version: 1.06
Revision: 1012
Description: Lightweight userspace bandwidth manager
License: BSD
Maintainer: Khairulmizam Samsudin
# Dependencies
Depends: daemonic (>= 20010902-1), libevent1-shlibs
BuildDepends: fink (>= 0.24.12-1), libevent1
# Unpack Phase
Source: http://monkey.org/~marius/trickle/%n-%v.tar.gz
Source-MD5: 8e9b7fcdd49ee8fb94700dd1653f5537
# Patch Phase
UpdateLibtool: True
PatchFile: %n.patch
PatchFile-MD5: 434ae3463404751e25a527b48798a258
# Compile Phase
NoSetMAKEFLAGS: true
SetMAKEFLAGS: -j1
ConfigureParams: --mandir=%p/share/man --sysconfdir=%p/etc
# Install Phase
InstallScript: <<
#!/bin/sh -ev
make install prefix=%i mandir=%i/share/man
install -d -m 755 %i/etc
cat <
# this file is an example for a system-wide or personal settings file
# for trickle (see manual pages for trickle, trickled and trickled.conf
# below are two examples that should be self-explaining
#[ssh]
#Priority = 1
#Time-Smoothing = 0.1
#Length-Smoothing = 2
#[ftp]
#Priority = 8
#Time-Smoothing = 5
#Length-Smoothing = 20
END
<<
DocFiles: LICENSE README
ConfFiles: %p/etc/trickled.conf
# Build Phase
PostInstScript: <<
# update daemonic init script if necessary
daemonic install trickle
<<
PreRmScript: <<
# clean up
if [ $1 != "upgrade" ]; then
daemonic remove trickle
fi
<<
DaemonicFile: <<
#
<<
# Additional Data
Homepage: http://www.monkey.org/~marius/trickle/
DescDetail: <<
Trickle is a voluntary, cooperative bandwidth shaper. trickle
works entirely in userland and easy to use.
Currently, trickle supports the shaping of any SOCK_STREAM
connection established via the socket(2) interface. Furthermore,
trickle will not work with statically linked executables, nor
with setuid(2) executables.
<<
DescUsage: <<
trickle(1) can be used with or without a daemon. The daemon,
trickled(8) can manage several trickle session at a time.
You can start trickled(8) manually, i.e. 'trickled -d 10 -u 20'
which limit aggregate trickle(1) download bandwidth consumption to
10 KB/s and upload consumption to 20 KB/s. You can also
start trickled(8) during each startup with 'daemonic enable
trickle' as root. Edit /sw/etc/daemons/trickle.xml to pass
additional option to trickled
<<
DescPackaging: <<
By default trickle(1) will depend on trickled(8), that is why they are not
separated. However, if trickled(8) is not started, trickle(1)
will automatically operate in standalone mode.
<<
DescPort: <<
Patch some file for poll() support & Darwin related header file. Libtool
scripts are also updated to build shared libraries
dmacks: make sure local -I come before global/installed ones.
<<
diff -Nurd -x'*~' trickle-1.06.orig/Makefile.in trickle-1.06/Makefile.in
--- trickle-1.06.orig/Makefile.in 2003-06-02 07:49:28.000000000 -0400
+++ trickle-1.06/Makefile.in 2007-04-04 22:49:11.000000000 -0400
@@ -105,7 +105,7 @@
tricklectl_SOURCES = tricklectl.c trickledu.c atomicio.c xdr.c
tricklectl_LDADD = @ERRO@ @LIBOBJS@
-AM_CFLAGS = -Wall -Icompat @EVENTINC@
+AM_CPPFLAGS = -Wall -Icompat @EVENTINC@
overloaddir = $(libdir)
overload_DATA = libtrickle.so
diff -Nurd -x'*~' trickle-1.06.orig/trickle-overload.c trickle-1.06/trickle-overload.c
--- trickle-1.06.orig/trickle-overload.c 2003-06-02 19:13:28.000000000 -0400
+++ trickle-1.06/trickle-overload.c 2007-04-04 22:48:58.000000000 -0400
@@ -35,7 +35,9 @@
#include
#include
#include
-#include
+#ifndef __APPLE__
+#include "poll.h"
+#endif /* done below */
#include
#include
#if defined(HAVE_TIME_H) && defined(TIME_WITH_SYS_TIME)
@@ -473,10 +475,37 @@
#define POLL_WRMASK (POLLOUT | POLLWRNORM | POLLWRBAND)
#define POLL_RDMASK (POLLIN | /* POLLNORM | */ POLLPRI | POLLRDNORM | POLLRDBAND)
+#if defined(__APPLE__)
+/* Data structure describing a polling request, from fakepoll.h */
+struct pollfd
+ {
+ int fd; /* file desc to poll */
+ short events; /* events of interest on fd */
+ short revents; /* events that occurred on fd */
+ };
+
+//poll flags
+#define POLLIN 0x0001
+#define POLLOUT 0x0004
+#define POLLERR 0x0008
+
+// synonyms
+#define POLLNORM POLLIN
+#define POLLPRI POLLIN
+#define POLLRDNORM POLLIN
+#define POLLRDBAND POLLIN
+#define POLLWRNORM POLLOUT
+#define POLLWRBAND POLLOUT
+
+// ignored
+#define POLLHUP 0x0010
+#define POLLNVAL 0x0020
+#endif /*__APPLE__*/
+
#if defined(__linux__) || (defined(__svr4__) && defined(__sun__))
int
poll(struct pollfd *fds, nfds_t nfds, int __timeout)
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || (defined(__APPLE))
int
poll(struct pollfd *fds, unsigned int nfds, int __timeout)
#else
diff -urN trickle-1.06.ori/xdr.c trickle-1.06/xdr.c
--- trickle-1.06.ori/xdr.c Mon Jun 2 01:07:01 2003
+++ trickle-1.06/xdr.c Wed Mar 3 20:26:39 2004
@@ -8,7 +8,9 @@
*/
#include
-
+#ifdef __APPLE__
+#include
+#endif
#include "message.h"
#define X(x) do { \