4 pkgdesc="STUN Server and Client"
5 url="http://downloads.sourceforge.net/project/stun/stun/"
6 source=("http://downloads.sourceforge.net/project/stun/stun/0.96/stund_0.96_Aug13.tgz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fstun%2F&ts=1299326697&use_mirror=puzzle")
10 arch=('x86_64' 'i686')
12 md5sums=('3273abb1a6f299f4e611b658304faefa')
17 if [ `uname -m` = 'x86_64' ]
18 then echo '@DPATCH@' >> fix_non_i386.patch
19 echo 'diff -urNad stun-0.96~/stun.cxx stun-0.96/stun.cxx' >> fix_non_i386.patch
20 echo '--- stun-0.96~/stun.cxx 2005-08-14 00:39:03.000000000 +0000' >> fix_non_i386.patch
21 echo '+++ stun-0.96/stun.cxx 2006-01-03 00:54:33.000000000 +0000' >> fix_non_i386.patch
22 echo '@@ -669,16 +669,8 @@' >> fix_non_i386.patch
23 echo ' tick = hightick;' >> fix_non_i386.patch
24 echo ' tick <<= 32;' >> fix_non_i386.patch
25 echo ' tick |= lowtick;' >> fix_non_i386.patch
26 echo '-#elif defined(__GNUC__) && ( defined(__i686__) || defined(__i386__) )' >> fix_non_i386.patch
27 echo '- asm("rdtsc" : "=A" (tick));' >> fix_non_i386.patch
28 echo '-#elif defined (__SUNPRO_CC) || defined( __sparc__ ) ' >> fix_non_i386.patch
29 echo '- tick = gethrtime();' >> fix_non_i386.patch
30 echo '-#elif defined(__MACH__) ' >> fix_non_i386.patch
31 echo '- int fd=open("/dev/random",O_RDONLY);' >> fix_non_i386.patch
32 echo '- read(fd,&tick,sizeof(tick));' >> fix_non_i386.patch
33 echo '- closesocket(fd);' >> fix_non_i386.patch
34 echo ' #else' >> fix_non_i386.patch
35 echo '-# error Need some way to seed the random number generator ' >> fix_non_i386.patch
36 echo '+ tick = time(NULL);' >> fix_non_i386.patch
37 echo ' #endif ' >> fix_non_i386.patch
38 echo ' int seed = int(tick);' >> fix_non_i386.patch
39 echo ' #ifdef WIN32' >> fix_non_i386.patch
40 patch --strip 1 < fix_non_i386.patch
44 mkdir $pkgdir/usr/bin -p
45 cp server $pkgdir/usr/bin/stund || return 1
46 cp client $pkgdir/usr/bin/stunc || return 1