libtorrent: Switch to static library.
authorRosen Penev <rosenp@gmail.com>
Mon, 9 Sep 2019 22:00:42 +0000 (15:00 -0700)
committerRosen Penev <rosenp@gmail.com>
Mon, 9 Sep 2019 22:32:29 +0000 (15:32 -0700)
libtorrent is only used by rtorrent. Switch to a static library to save
space.

Removed libsigc++ dependency. It seems it's not needed.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
libs/libtorrent/Makefile
libs/libtorrent/patches/010-usleep.patch [new file with mode: 0644]

index 86d6f7dbfc9d91991b50d5d438eda62e1c52909c..15b018d700cf38c710ae5b5ad05574d36c8182d9 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libtorrent
 PKG_VERSION:=0.13.8
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/rakshasa/libtorrent/tar.gz/v$(PKG_VERSION)?
@@ -22,7 +22,6 @@ PKG_LICENSE_FILES:=COPYING
 PKG_FIXUP:=autoreconf
 PKG_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
-PKG_REMOVE_FILES:=autogen.sh
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -31,7 +30,7 @@ define Package/libtorrent
   CATEGORY:=Libraries
   TITLE:=Rakshasa's BitTorrent library
   URL:=https://rakshasa.github.io/rtorrent/
-  DEPENDS:=+libopenssl +libsigcxx +zlib
+  DEPENDS:=+libopenssl +libstdcpp +zlib
 endef
 
 define Package/libtorrent/description
@@ -59,14 +58,9 @@ define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include
        $(CP) $(PKG_INSTALL_DIR)/usr/include/torrent $(1)/usr/include/
        $(INSTALL_DIR) $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtorrent.{a,so*} $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtorrent.a $(1)/usr/lib/
        $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libtorrent.pc $(1)/usr/lib/pkgconfig/
 endef
 
-define Package/libtorrent/install
-       $(INSTALL_DIR) $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtorrent.so.* $(1)/usr/lib/
-endef
-
 $(eval $(call BuildPackage,libtorrent))
diff --git a/libs/libtorrent/patches/010-usleep.patch b/libs/libtorrent/patches/010-usleep.patch
new file mode 100644 (file)
index 0000000..6539fad
--- /dev/null
@@ -0,0 +1,54 @@
+--- a/src/data/hash_queue.cc
++++ b/src/data/hash_queue.cc
+@@ -38,9 +38,10 @@
+ #define __STDC_FORMAT_MACROS
++#include <chrono>
++#include <thread>
+ #include <functional>
+ #include <rak/functional.h>
+-#include <unistd.h>
+ #include "torrent/exceptions.h"
+ #include "torrent/data/download_data.h"
+@@ -137,7 +138,7 @@ HashQueue::remove(HashQueueNode::id_type id) {
+       while ((done_itr = m_done_chunks.find(hash_chunk)) == m_done_chunks.end()) {
+         pthread_mutex_unlock(&m_done_chunks_lock);
+-        usleep(100);
++        std::this_thread::sleep_for(std::chrono::microseconds(100));
+         pthread_mutex_lock(&m_done_chunks_lock);
+       }
+--- a/src/torrent/utils/thread_base.cc
++++ b/src/torrent/utils/thread_base.cc
+@@ -37,8 +37,9 @@
+ #include "config.h"
+ #include <cstring>
++#include <chrono>
++#include <thread>
+ #include <signal.h>
+-#include <unistd.h>
+ #include "exceptions.h"
+ #include "poll.h"
+@@ -97,7 +98,7 @@ thread_base::stop_thread_wait() {
+   release_global_lock();
+   while (!is_inactive()) {
+-    usleep(1000);
++    std::this_thread::sleep_for(std::chrono::milliseconds(1));
+   }  
+   acquire_global_lock();
+@@ -161,7 +162,7 @@ thread_base::event_loop(thread_base* thread) {
+       }
+       // Add the sleep call when testing interrupts, etc.
+-      // usleep(50);
++      // std::this_thread::sleep_for(std::chrono::microseconds(50));
+       int poll_flags = 0;