make makepatchsum after applying

Index: libtorrent/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/net/libtorrent/Makefile,v
retrieving revision 1.46
diff -u -p -r1.46 Makefile
--- libtorrent/Makefile	23 Oct 2012 17:18:35 -0000	1.46
+++ libtorrent/Makefile	1 Feb 2013 07:05:34 -0000
@@ -47,6 +47,10 @@ CXXFLAGS+=	-fpermissive -fno-strength-re
 CXXFLAGS+=	-march=i486
 .endif
 
+.if !empty(CC_VERSION:Mgcc-*) && !empty(MACHINE_ARCH:Marm)
+CXXFLAGS+=	-DARM_HACK
+.endif
+
 .include "../../security/openssl/buildlink3.mk"
 .if !exists(${BUILDLINK_PREFIX.openssl}/lib/pkgconfig/openssl.pc)
 OPENSSL_CFLAGS=	-I${BUILDLINK_PREFIX.openssl}/include
Index: libtorrent/distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/net/libtorrent/distinfo,v
retrieving revision 1.29
diff -u -p -r1.29 distinfo
--- libtorrent/distinfo	16 May 2012 17:42:37 -0000	1.29
+++ libtorrent/distinfo	1 Feb 2013 07:05:34 -0000
@@ -3,3 +3,8 @@ $NetBSD: distinfo,v 1.29 2012/05/16 17:4
 SHA1 (libtorrent-0.13.2.tar.gz) = 4f34a744fbe10c54aaf53d34681fabc1a49d7257
 RMD160 (libtorrent-0.13.2.tar.gz) = 090e6af9b4318a6176064159f6a8f70ab708c7fe
 Size (libtorrent-0.13.2.tar.gz) = 725088 bytes
+SHA1 (patch-aa) = b8a7c3ffb1965a32ca3b154c9d0a8043de62ee83
+SHA1 (patch-ab) = d166783a89e3de3df4d915d9ce1957f58bf1492a
+SHA1 (patch-ac) = dd020de0e7ffdedc7c713c3db7ea6f351bda5e5d
+SHA1 (patch-ad) = 198ea4a4e39f4102e3ab173388cd6ef6ae8d6566
+SHA1 (patch-ae) = 33453da8844933482711044a6474839cb2766434
Index: libtorrent/patches/patch-aa
===================================================================
RCS file: libtorrent/patches/patch-aa
diff -N libtorrent/patches/patch-aa
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libtorrent/patches/patch-aa	1 Feb 2013 07:05:34 -0000
@@ -0,0 +1,23 @@
+--- src/thread_disk.cc.orig	2013-01-31 18:47:48.000000000 +0200
++++ src/thread_disk.cc	2013-01-31 18:49:44.000000000 +0200
+@@ -36,6 +36,7 @@
+ 
+ #include "config.h"
+ 
++#include <sys/atomic.h>
+ #include <rak/timer.h>
+ 
+ #include "thread_disk.h"
+@@ -63,8 +64,11 @@ thread_disk::call_events() {
+   if ((m_flags & flag_do_shutdown)) {
+     if ((m_flags & flag_did_shutdown))
+       throw internal_error("Already trigged shutdown.");
+-
++#ifndef ARM_HACK
+     __sync_or_and_fetch(&m_flags, flag_did_shutdown);
++#else
++    atomic_or_32(&m_flags, flag_did_shutdown);
++#endif
+     throw shutdown_exception();
+   }
+ 
Index: libtorrent/patches/patch-ab
===================================================================
RCS file: libtorrent/patches/patch-ab
diff -N libtorrent/patches/patch-ab
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libtorrent/patches/patch-ab	1 Feb 2013 07:05:34 -0000
@@ -0,0 +1,25 @@
+--- src/torrent/utils/signal_bitfield.h.orig	2012-04-20 09:41:43.000000000 +0300
++++ src/torrent/utils/signal_bitfield.h	2013-01-31 19:52:36.000000000 +0200
+@@ -37,6 +37,10 @@
+ #ifndef LIBTORRENT_UTILS_SIGNAL_BITFIELD_H
+ #define LIBTORRENT_UTILS_SIGNAL_BITFIELD_H
+ 
++#ifdef ARM_HACK
++#include <sys/atomic.h>
++#endif
++
+ #include <tr1/functional>
+ #include <torrent/common.h>
+ 
+@@ -52,7 +56,11 @@ public:
+   signal_bitfield() : m_bitfield(0), m_size(0) {}
+   
+   // Do the interrupt from the thread?
++#ifndef ARM_HACK
+   void          signal(unsigned int index) { __sync_or_and_fetch(&m_bitfield, 1 << index); }
++#else
++  void	signal(unsigned int index) { atomic_or_32(&m_bitfield, 1 << index); }
++#endif
+   void          work();
+ 
+   unsigned int  add_signal(slot_type slot);
Index: libtorrent/patches/patch-ac
===================================================================
RCS file: libtorrent/patches/patch-ac
diff -N libtorrent/patches/patch-ac
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libtorrent/patches/patch-ac	1 Feb 2013 07:05:34 -0000
@@ -0,0 +1,27 @@
+--- src/torrent/utils/signal_bitfield.cc.orig	2013-01-31 18:53:14.000000000 +0200
++++ src/torrent/utils/signal_bitfield.cc	2013-01-31 18:59:20.000000000 +0200
+@@ -52,7 +52,11 @@ signal_bitfield::add_signal(slot_type sl
+     throw internal_error("signal_bitfield::add_signal(...): Cannot add empty slot.");
+ 
+   unsigned int index = m_size;
++#ifndef ARM_HACK
+   __sync_add_and_fetch(&m_size, 1);
++#else
++  atomic_inc_32(&m_size);
++#endif
+ 
+   m_slots[index] = slot;
+   return index;
+@@ -61,8 +65,11 @@ signal_bitfield::add_signal(slot_type sl
+ void
+ signal_bitfield::work() {
+   bitfield_type bitfield;
+-
++#ifndef ARM_HACK
+   while (!__sync_bool_compare_and_swap(&m_bitfield, (bitfield = m_bitfield), 0))
++#else
++  while (atomic_cas_32(&m_bitfield, (bitfield = m_bitfield), 0) != m_bitfield)
++#endif
+     ; // Do nothing.
+ 
+   unsigned int i = 0;
Index: libtorrent/patches/patch-ad
===================================================================
RCS file: libtorrent/patches/patch-ad
diff -N libtorrent/patches/patch-ad
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libtorrent/patches/patch-ad	1 Feb 2013 07:05:34 -0000
@@ -0,0 +1,53 @@
+--- src/torrent/utils/thread_base.h.orig	2012-03-05 14:18:18.000000000 +0200
++++ src/torrent/utils/thread_base.h	2013-01-31 19:28:01.000000000 +0200
+@@ -39,6 +39,11 @@
+ 
+ #include <pthread.h>
+ #include <sys/types.h>
++
++#ifdef ARM_HACK
++#include <sys/atomic.h>
++#endif
++
+ #include <torrent/common.h>
+ #include <torrent/utils/signal_bitfield.h>
+ #include <tr1/functional>
+@@ -148,9 +153,17 @@ thread_base::send_event_signal(unsigned 
+ 
+ inline void
+ thread_base::acquire_global_lock() {
++#ifndef ARM_HACK
+   __sync_add_and_fetch(&thread_base::m_global.waiting, 1);
++#else
++  atomic_add_int((unsigned int*)&thread_base::m_global.waiting, 1);
++#endif
+   pthread_mutex_lock(&thread_base::m_global.lock);
++#ifndef ARM_HACK
+   __sync_sub_and_fetch(&thread_base::m_global.waiting, 1);
++#else
++  atomic_add_int((unsigned int*)&thread_base::m_global.waiting, -1);
++#endif
+ }
+ 
+ inline bool
+@@ -180,12 +193,20 @@ thread_base::waive_global_lock() {
+ // 'interrupt_main_polling' unless 'is_main_polling() == false'.
+ inline void
+ thread_base::entering_main_polling() {
++#ifndef ARM_HACK
+   __sync_lock_test_and_set(&thread_base::m_global.main_polling, 1);
++#else
++  atomic_swap_uint((unsigned int*)&thread_base::m_global.main_polling, 1);
++#endif
+ }
+ 
+ inline void
+ thread_base::leaving_main_polling() {
++#ifndef ARM_HACK
+   __sync_lock_test_and_set(&thread_base::m_global.main_polling, 0);
++#else
++  atomic_swap_uint((unsigned int *)&thread_base::m_global.main_polling, 0);
++#endif
+ }
+ 
+ }  
Index: libtorrent/patches/patch-ae
===================================================================
RCS file: libtorrent/patches/patch-ae
diff -N libtorrent/patches/patch-ae
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libtorrent/patches/patch-ae	1 Feb 2013 07:05:34 -0000
@@ -0,0 +1,73 @@
+--- src/torrent/utils/thread_base.cc.orig	2012-04-02 10:04:22.000000000 +0300
++++ src/torrent/utils/thread_base.cc	2013-01-31 20:13:22.000000000 +0200
+@@ -69,7 +69,11 @@ thread_base::start_thread() {
+ 
+ void
+ thread_base::stop_thread() {
++#ifndef ARM_HACK
+   __sync_fetch_and_or(&m_flags, flag_do_shutdown);
++#else
++  atomic_or_uint((unsigned int*)&m_flags, flag_do_shutdown);
++#endif
+   interrupt();
+ }
+ 
+@@ -88,7 +92,11 @@ thread_base::stop_thread_wait() {
+ 
+ void
+ thread_base::interrupt() {
++#ifndef ARM_HACK
+   __sync_fetch_and_or(&m_flags, flag_no_timeout);
++#else
++  atomic_or_uint((unsigned int*)&m_flags, flag_no_timeout);
++#endif
+ 
+   while (is_polling() && has_no_timeout()) {
+     pthread_kill(m_thread, SIGUSR1);
+@@ -102,7 +110,11 @@ thread_base::interrupt() {
+ 
+ void*
+ thread_base::event_loop(thread_base* thread) {
++#ifndef ARM_HACK
+   __sync_lock_test_and_set(&thread->m_state, STATE_ACTIVE);
++#else
++  atomic_swap_uint((unsigned int*)&thread->m_state, STATE_ACTIVE);
++#endif
+ 
+   lt_log_print(torrent::LOG_THREAD_NOTICE, "%s: Starting thread.", thread->name());
+   
+@@ -115,7 +127,11 @@ thread_base::event_loop(thread_base* thr
+       thread->call_events();
+       thread->signal_bitfield()->work();
+ 
++#ifndef ARM_HACK
+       __sync_fetch_and_or(&thread->m_flags, flag_polling);
++#else
++      atomic_or_uint((unsigned int*)&thread->m_flags, flag_polling);
++#endif
+ 
+       // Call again after setting flag_polling to ensure we process
+       // any events set while it was working.
+@@ -143,14 +159,22 @@ thread_base::event_loop(thread_base* thr
+         poll_flags = torrent::Poll::poll_worker_thread;
+ 
+       thread->m_poll->do_poll(next_timeout, poll_flags);
++#ifndef ARM_HACK
+       __sync_fetch_and_and(&thread->m_flags, ~(flag_polling | flag_no_timeout));
++#else
++      atomic_and_uint((unsigned int*)&thread->m_flags, ~(flag_polling | flag_no_timeout));
++#endif
+     }
+ 
+   } catch (torrent::shutdown_exception& e) {
+     lt_log_print(torrent::LOG_THREAD_NOTICE, "%s: Shutting down thread.", thread->name());
+   }
+ 
++#ifndef ARM_HACK
+   __sync_lock_test_and_set(&thread->m_state, STATE_INACTIVE);
++#else
++  atomic_swap_uint((unsigned int*)&thread->m_state, STATE_INACTIVE);
++#endif
+   return NULL;
+ }
+ 
Index: rtorrent/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/net/rtorrent/Makefile,v
retrieving revision 1.52
diff -u -p -r1.52 Makefile
--- rtorrent/Makefile	16 Dec 2012 01:52:30 -0000	1.52
+++ rtorrent/Makefile	1 Feb 2013 07:05:34 -0000
@@ -42,6 +42,10 @@ CXXFLAGS+=	-fpermissive -fno-strength-re
 CXXFLAGS+=	-march=i486
 .endif
 
+.if !empty(CC_VERSION:Mgcc-*) && !empty(MACHINE_ARCH:Marm)
+CXXFLAGS+=      -DARM_HACK
+.endif
+
 INSTALLATION_DIRS=	share/examples/rtorrent
 
 post-install:
Index: rtorrent/distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/net/rtorrent/distinfo,v
retrieving revision 1.30
diff -u -p -r1.30 distinfo
--- rtorrent/distinfo	24 May 2012 17:01:43 -0000	1.30
+++ rtorrent/distinfo	1 Feb 2013 07:05:34 -0000
@@ -8,3 +8,5 @@ SHA1 (patch-ad) = f993340975dca61d5f7d70
 SHA1 (patch-ae) = a370881bfdd8534eb25fcbcff8d258b19797941f
 SHA1 (patch-af) = 842a01cbc75e61092b4d33fe9155a728e7c502e6
 SHA1 (patch-ag) = b7e5fe242b19f994f013acc9ec54a65fed729c29
+SHA1 (patch-ax) = 1d784486658f3260cb45ea06af5e4c6eacd8eafb
+SHA1 (patch-ay) = f7a3f98ac2183bf0b3eb54e432dc86cb9461eaca
Index: rtorrent/patches/patch-ax
===================================================================
RCS file: rtorrent/patches/patch-ax
diff -N rtorrent/patches/patch-ax
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ rtorrent/patches/patch-ax	1 Feb 2013 07:05:34 -0000
@@ -0,0 +1,42 @@
+--- src/thread_base.cc.orig	2012-02-14 05:41:20.000000000 +0200
++++ src/thread_base.cc	2013-01-31 23:33:28.000000000 +0200
+@@ -36,6 +36,10 @@
+ 
+ #include "config.h"
+ 
++#ifdef ARM_HACK
++#include <sys/atomic.h>
++#endif
++
+ #include "thread_base.h"
+ 
+ #include <cassert>
+@@ -65,10 +69,13 @@ public:
+   static const unsigned int max_size = 32;
+ 
+   thread_queue_hack() { std::memset(this, 0, sizeof(thread_queue_hack)); }
+-
++#ifndef ARM_HACK
+   void     lock()   { while (!__sync_bool_compare_and_swap(&m_lock, 0, 1)) usleep(0); }
+   void     unlock() { __sync_bool_compare_and_swap(&m_lock, 1, 0); }
+-
++#else
++  void lock() { while (atomic_cas_uint((unsigned int*)&m_lock, 0, 1) != 0) usleep(0); }
++  void unlock() { atomic_cas_uint((unsigned int*)&m_lock, 1, 0); }
++#endif
+   iterator begin() { return m_queue; }
+   iterator max_capacity() { return m_queue + max_size; }
+ 
+@@ -81,8 +88,11 @@ public:
+   
+     if (itr == max_capacity())
+       throw torrent::internal_error("Overflowed thread_queue.");
+-
++#ifndef ARM_HACK
+     __sync_bool_compare_and_swap(itr, NULL, v);
++#else
++    atomic_cas_ptr((void*)itr, NULL, (void*)v);
++#endif
+     unlock();
+   }
+ 
Index: rtorrent/patches/patch-ay
===================================================================
RCS file: rtorrent/patches/patch-ay
diff -N rtorrent/patches/patch-ay
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ rtorrent/patches/patch-ay	1 Feb 2013 07:05:34 -0000
@@ -0,0 +1,27 @@
+--- src/thread_worker.cc.old	2013-01-31 22:03:37.000000000 +0200
++++ src/thread_worker.cc	2013-01-31 22:06:05.000000000 +0200
+@@ -36,6 +36,10 @@
+ 
+ #include "config.h"
+ 
++#ifdef ARM_HACK
++#include <sys/atomic.h>
++#endif
++
+ #include "thread_worker.h"
+ #include "globals.h"
+ #include "control.h"
+@@ -67,8 +71,13 @@ ThreadWorker::init_thread() {
+ 
+ bool
+ ThreadWorker::set_scgi(rpc::SCgi* scgi) {
++#ifndef ARM_HACK
+   if (!__sync_bool_compare_and_swap(&m_safe.scgi, NULL, scgi))
+     return false;
++#else
++  if (atomic_cas_ptr(&m_safe.scgi, NULL, scgi) != NULL)
++    return false;
++#endif
+ 
+   change_xmlrpc_log();
+ 
